Could not find a version that satisfies the requirement pywin32==227 heroku - python

I am having this issue with heroku.
i am trying to push my application to heroku but
it seems that heroku can not install pywin32=227 but i do not know why is this happening.
i hope that someone can help me whit this issue.
Requirements.txt:
appdirs==1.4.3
asgiref==3.2.3
awsebcli==3.17.1
botocore==1.14.17
cement==2.8.2
certifi==2019.11.28
chardet==3.0.4
colorama==0.3.9
distlib==0.3.0
dj-database-url==0.5.0
Django==2.1.15
django-pyodbc-azure==2.1.0.0
docutils==0.15.2
filelock==3.0.12
future==0.16.0
gunicorn==20.0.4
idna==2.7
importlib-metadata==1.5.0
jmespath==0.9.5
pathspec==0.5.9
Pillow==7.0.0
psycopg2==2.8.4
pyodbc==4.0.30
pypiwin32==223
python-dateutil==2.8.0
python-decouple==3.3
pytz==2019.3
pywin32==227
PyYAML==5.2
requests==2.20.1
semantic-version==2.5.0
six==1.11.0
sqlparse==0.3.1
stripe==2.43.0
termcolor==1.1.0
urllib3==1.24.3
virtualenv==20.0.7
wcwidth==0.1.8
whitenoise==5.0.1
zipp==3.1.0
I'm developing on Windows 10 Professional, and the application works fine there:
C:\Users\GuGarza\test>git push heroku master
Enumerating objects: 363, done.
Counting objects: 100% (363/363), done.
Delta compression using up to 4 threads
Compressing objects: 100% (348/348), done.
Writing objects: 100% (363/363), 257.21 KiB | 1.42 MiB/s, done.
Total 363 (delta 107), reused 0 (delta 0)
remote: Downloading pytz-2019.3-py2.py3-none-any.whl (509 kB)
remote: ERROR: Could not find a version that satisfies the requirement pywin32==227 (from -r
/tmp/build_000de559e8272ea11b28b5ee568bf649/requirements.txt (line 28)) (from versions: none)
remote: ERROR: No matching distribution found for pywin32==227 (from -r
/tmp/build_000de559e8272ea11b28b5ee568bf649/requirements.txt (line 28))
remote: ! Push rejected, failed to compile Python app.
remote:
remote: ! Push failed
remote: Verifying deploy...
remote:
remote: ! Push rejected to memotion.
remote:
To https://git.heroku.com/memotion.git
! [remote rejected] master -> master (pre-receive hook declined)
error: failed to push some refs to 'https://git.heroku.com/memotion.git'

I got the same error while deploying flask app in azure app server.
Removing/commentting out pywin32==227 in requirements.txt worked for me.

Conditional dependencies is a better choice in this situation. This way you don't break things on Windows.
Add ;platform_system == "Windows" right after the Windows-only packages

I had the same problem in Pycharm.
Installing new version or packages like pypiwin32 did not work as described above.
Removing packages from the req file did not work either.
I copied my dev files, then I deleted the project.
I set up a completely new project and copied the Py files into it.
It worked.
The cause for the error message above was:
I did corrupt my project by trying to install chart_studio with pip, which did not work. It only works with Conda.
This corrupted my req and my site packages.

Related

Heroku Django app deployment fails after trying to install python requirement

I installed django-user-visit with pip install django-user-visit , tested it in my local environment and everything seems to work fine, but when i try to deploy my app to production with Heroku i get the following error :
remote: Collecting django-cors-headers==3.6.0
remote: Downloading django_cors_headers-3.6.0-py3-none-any.whl (12 kB)
remote: ERROR: Could not find a version that satisfies the requirement django-user-visit==0.4.1 (from -r /tmp/build_940d12d0/requirements.txt (line 4)) (from versions: none)
remote: ERROR: _No matching distribution_ found for django-user-visit==0.4.1 (from -r /tmp/build_940d12d0/requirements.txt (line 4))
remote: ! Push rejected, failed to compile Python app.
remote:
remote: ! Push failed
Does anyone know why Heroku can't find the package and if i can fix this ?
My packages are being installed by running the libraries indicated in my requirements.txt file:
asgiref==3.3.1
Django==3.1.5
django-cors-headers==3.6.0
django-user-visit==0.4.1
djangorestframework==3.12.2
gunicorn==20.0.4
psycopg2==2.8.6
pytz==2020.5
sqlparse==0.4.1
ua-parser==0.10.0
user-agents==2.2.0
whitenoise==5.2.0
What i've tried so far is to change the version to 0.4 and to not specify a version at all
From the documentation: https://devcenter.heroku.com/articles/python-runtimes
If you’re running a Python application that requires a different supported runtime, or if you simply want to lock your project against patch updates until you’re ready to upgrade, you can specify which runtime to use for your app.
To specify a Python runtime, add a runtime.txt file to your app’s root directory that declares the exact version number to use.
after that
pip freeze > requirements.txt

Heroku git master push

I'm new to heroku, but I've been following the documentation to the letter. I am deploying my dash app to heroku. The setup was going well until the final master push
> (venv) -MacBook-Air-3 heroku % git push heroku master
Enumerating objects: 12155, done.
Counting objects: 100% (12155/12155), done.
Delta compression using up to 4 threads
Compressing objects: 100% (2900/2900), done.
Writing objects: 100% (12155/12155), 15.08 MiB | 1.53 MiB/s, done.
Total 12155 (delta 9145), reused 12155 (delta 9145)
remote: Compressing source files... done.
remote: Building source:
remote:
remote: -----> Building on the Heroku-20 stack
remote: -----> Python app detected
remote: -----> Installing python-3.6.12
remote: -----> Installing pip 20.1.1, setuptools 47.1.1 and wheel 0.34.2
remote: -----> Installing SQLite3
remote: -----> Installing requirements with pip
remote: ERROR: Could not find a version that satisfies the requirement hBrotli==1.0.9
(from -r /tmp/build_77052133/requirements.txt (line 1)) (from versions: none)
remote: ERROR: No matching distribution found for hBrotli==1.0.9 (from -r /tmp/build_77052133/requirements.txt (line 1))
remote: ! Push rejected, failed to compile Python app.
remote:
remote: ! Push failed
I went to the requirements.txt that I created with pip3 freeze >requirements.txt as per the documentation and indeed on line 1 there was hBrotli== 1.0.9. I am not familiar with hBrotli and don't use it for my code and can't seem to find any information about it. I'm not sure what the error message is implying.
there is no package named hBrotli it may be due to some typo just change hBrotli to Brotli
This is the package that you are looking for https://pypi.org/project/Brotli/ so just change the hBrotli to Brotli
Or just do pip install Brotli
Also if needed change imports into from brotli import nameOfClass

ERROR: Could not install packages due to an EnvironmentError: [Errno 2] No such file or directory: '/C:/ci/astroid_1592481955828/work'

I am trying to push a little python project to Heroku and I keep getting this error anytime I run git push heroku master
$ git push heroku master
Enumerating objects: 19, done.
Counting objects: 100% (19/19), done.
Delta compression using up to 4 threads
Compressing objects: 100% (14/14), done.
Writing objects: 100% (19/19), 4.27 KiB | 728.00 KiB/s, done.
Total 19 (delta 2), reused 0 (delta 0)
remote: Compressing source files... done.
remote: Building source:
remote:
remote: -----> Python app detected
remote: -----> Installing python-3.6.10
remote: -----> Installing pip
remote: -----> Installing SQLite3
remote: -----> Installing requirements with pip
remote: Processing /C:/ci/astroid_1592481955828/work
remote: ERROR: Could not install packages due to an EnvironmentError: [Errno 2] No such file or directory: '/C:/ci/astroid_1592481955828/work'
remote:
remote: ! Push rejected, failed to compile Python app.
remote:
remote: ! Push failed
remote: Verifying deploy...
remote:
remote: ! Push rejected to flask-plan-app.
remote:
To https://git.heroku.com/flask-plan-app.git
! [remote rejected] master -> master (pre-receive hook declined)
error: failed to push some refs to 'https://git.heroku.com/flask-plan-app.git'
I have also tried locating the missing files on my laptop but I couldn't, please how do I fix this?
This is my requirement.txt file
astroid # file:C:/ci/astroid_1592481955828/work
certifi==2020.6.20
click==7.1.2
colorama==0.4.3
Flask==1.1.2
Flask-SQLAlchemy==2.4.3
gunicorn==20.0.4
isort==4.3.21
itsdangerous==1.1.0
Jinja2==2.11.2
lazy-object-proxy==1.4.3
MarkupSafe==1.1.1
mccabe==0.6.1
pylint # file:///C:/ci/pylint_1592487534522/work
six==1.15.0
SQLAlchemy==1.3.18
toml # file:///tmp/build/80754af9/toml_1592853716807/work
typed-ast==1.4.1
Werkzeug==1.0.1
wincertstore==0.2
wrapt==1.11.2
I'm a beginner so take this with a grain of salt.
I deleted all the "# paths" suffixes in the requirements file and just left the names of the packages, this stopped this error from happening.
So:
astroid
certifi==2020.6.20
click==7.1.2
colorama==0.4.3
Flask==1.1.2
Flask-SQLAlchemy==2.4.3
gunicorn==20.0.4
isort==4.3.21
itsdangerous==1.1.0
Jinja2==2.11.2
lazy-object-proxy==1.4.3
MarkupSafe==1.1.1
mccabe==0.6.1
pylint
six==1.15.0
SQLAlchemy==1.3.18
toml
typed-ast==1.4.1
Werkzeug==1.0.1
wincertstore==0.2
wrapt==1.11.2
Hi I just ran into this issue and was able to solve it. Posting in case any one runs into the same issue in the future.
Follow #extracheez's instructions of removing the surplus # paths. Then make sure you commit and push to Git after. That solved it for me.
git add -A
git commit -m "removed surplus # paths in requirements.txt file"
git push -u origin master
Another error might pop up though, something like FileNotFoundError: [Errno 2] No such file or directory: '/tmp/build_51de3815/static'.
To solve that, create a .temporary_file file in your static folder. Something to do with Git not tracking empty directories, ergo it doesn't exist on Heroku.
touch static/.keep

Push rejected, failed to compile Python app in heroku (Python Crash Course)

I am working through the learning log project in Python Crash Course by Eric Matthes, specifically working on the learning log app. I am trying to deploy to heroku but get this error:
(ll_env) C:\Users\benpg\Documents\Coding\Python\learning_log>git push heroku master
Enumerating objects: 54, done.
Counting objects: 100% (54/54), done.
Delta compression using up to 4 threads
Compressing objects: 100% (46/46), done.
Writing objects: 100% (54/54), 16.54 KiB | 940.00 KiB/s, done.
Total 54 (delta 4), reused 0 (delta 0)
remote: Compressing source files... done.
remote: Building source:
remote:
remote: -----> Python app detected
remote: ! Python has released a security update! Please consider upgrading to python-3.7.3
remote: Learn More: https://devcenter.heroku.com/articles/python-runtimes
remote: -----> Installing python-3.7.4
remote: -----> Installing pip
remote: -----> Installing SQLite3
remote: -----> Installing requirements with pip
remote: ! Push rejected, failed to compile Python app.
remote:
remote: ! Push failed
remote: Verifying deploy...
remote:
remote: ! Push rejected to pacific-refuge-12657.
remote:
To https://git.heroku.com/pacific-refuge-12657.git
! [remote rejected] master -> master (pre-receive hook declined)
error: failed to push some refs to 'https://git.heroku.com/pacific-refuge-12657.git'
Tried everything here including the two other questions linked at the start, no luck.
Here's my requirements.txt:
Django==1.8.4
dj-database-url==0.3.0
dj-static==0.0.6
django-bootstrap3==6.2.2
gunicorn==19.3.0
static3==0.6.1
psycopg2>=2.6.1
Edit:
I am using django 2.2.4. My requirements.txt is the way it is because there is a note in the book saying 'if you're using Windows, make sure your version of requirements.txt matches the list shown here regardless of which packages you were able to install'. Why is this?
This is the first requirements.txt I had, autogenerated except for the last line. This one didn't work either, same error message:
dj-database-url==0.5.0
dj-static==0.0.6
Django==2.2.4
django-bootstrap3==11.1.0
gunicorn==19.9.0
pytz==2019.2
sqlparse==0.3.0
static3==0.7.0
psycopg2>=2.6.1
Just had the same issue, changing the Python version back do 3.7.3 fixed it. Was able to build python and execute.

Push failed heroku

I need some help to solve this. I have others websites in another heroku account, but I 'm not getting in my empty account. I am using python3.5.0 (but I tried change python version without sucess) and Django 1.10. I have in my git repositore, runtime.txt, procfile.txt, but I'm having this problem: (terminal)
Counting objects: 105, done.
Delta compression using up to 4 threads.
Compressing objects: 100% (97/97), done.
Writing objects: 100% (105/105), 2.22 MiB | 113.00 KiB/s, done.
Total 105 (delta 34), reused 0 (delta 0)
remote: Compressing source files... done.
remote: Building source:
remote:
remote: -----> Python app detected
remote: -----> Installing python-3.5.0
remote: ! Requested runtime (python-3.5.0) is not available for this stack (heroku-16).
remote: ! Aborting. More info: https://devcenter.heroku.com/articles/python-support
remote: ! Push rejected, failed to compile Python app.
remote:
remote: ! Push failed
remote: Verifying deploy...
remote:
remote: ! Push rejected to confiam2.
remote:
To https://git.heroku.com/confiam2.git
! [remote rejected] master -> master (pre-receive hook declined)
error: failed to push some refs to 'https://git.heroku.com/
How can I solve this? I tried to update heroku version, and change python version. Without sucess. Very thanks who can help me.
The error code is this -
Requested runtime (python-3.5.0) is not available for this stack (heroku-16).
If you visit the support page suggested, you will see that Python 3.6.2 and 2.7.13 are the only supported runtimes. Why would you expect 3.5.0 to work? Change your runtime.txt file to contain python-3.6.2 (or try another version, such as python-3.5.2, and maybe it will work. Who knows, it's not supported) and the app should be accepted by Heroku (as long as there are not other, non-related problems).
Best answer i was found to remove this error is:-
uninstall the pkg-resources==0.0.0 by pip uninstall pkg-resources==0.0.0 commmand
and run
pip freeze > requirements.txt command
and then
git add .
git commit -m "deleted the pkg from requirements.txt"
git push heroku master
enjoy the day with heroku....
pipenv lock
git add.
git commit -am "make it better"
git push heroku master
If you need a different version edit the new file and enter which version you want.
Like this:
[requires]
python_version = "2.7"
or
[requires]
python_full_version = "2.7.15"

Categories