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

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.

Related

ERROR:Deploying Python app using heroku CLI

When I enter
$ git push heroku master
It Shows:
ERROR: Double requirement given: telegram (from -r /tmp/build_996aa7e0/requirements.txt (line 60)) (already in telegram==0.0.1 (from -r /tmp/build_996aa7e0/requirements.txt (line 47)), name='telegram')
There is the All logs:
Enumerating objects: 8, done.
Counting objects: 100% (8/8), done.
Delta compression using up to 8 threads
Compressing objects: 100% (5/5), done.
Writing objects: 100% (8/8), 7.00 KiB | 716.00 KiB/s, done.
Total 8 (delta 0), reused 0 (delta 0), pack-reused 0
remote: Compressing source files... done.
remote: Building source:
remote: -----> Building on the Heroku-20 stack
remote: -----> Using buildpack: heroku/python
remote: -----> Python app detected
remote: -----> Installing python-3.6.13
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: Double requirement given: telegram (from -r /tmp/build_996aa7e0/requirements.txt (line 60)) (already in telegram==0.0.1 (from -r /tmp/build_996aa7e0/requirements.txt (line 47)), name='telegram')
remote: ! Push rejected, failed to compile Python app.
remote: ! Push failed
remote: ! ## Warning - The same version of this code has already been built: 084ac888b168cf47da1ece8fd2b17b05e1d4df48
remote: ! We have detected that you have triggered a build from source code with version 084ac888b168cf47da1ece8fd2b17b05e1d4df48
remote: ! at least twice. One common cause of this behavior is attempting to deploy code from a different branch.
remote: ! If you are developing on a branch and deploying via git you must run:
remote: ! git push heroku :main
remote: ! This article goes into details on the behavior:
remote: ! https://devcenter.heroku.com/articles/duplicate-build-version
remote: Verifying deploy...
remote: ! Push rejected to zsk766.
remote: To https://git.heroku.com/zsk766.git
It looks like you've got telegram twice in your requirements.txt, once at line 60 and once at line 47.
Open requirements.txt, delete one of those lines, and repush your files.

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

Requested runtime (Python 3.7.2) is not available for this stack (heroku-18)

django (2.0)
I am trying to upload my django app to heroku but i couldn't because it
says requested runtime(python 3.7.2) is not available.
Counting objects: 100% (1725/1725), done.
Delta compression using up to 4 threads
Compressing objects: 100% (1721/1721), done.
Writing objects: 100% (1725/1725), 9.34 MiB | 21.00 KiB/s, done.
Total 1725 (delta 93), reused 0 (delta 0)
remote: Compressing source files... done.
remote: Building source:
remote:
remote: -----> Python app detected
remote: ! Requested runtime (Python 3.7.2) is not available for this stack (heroku-18).
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 mubashartech.
remote:
To https://git.heroku.com/mubashartech.git
! [remote rejected] master -> master (pre-receive hook declined)
error: failed to push some refs to 'https://git.heroku.com/mubashartech.git'
The Heroku Docs show that the currently supported version of Python 3.7.X is 3.7.3.
Change the value in your runtime.txt file to python-3.7.3 to use Python 3.7.3.
in the current herouku stack -20 , even 3.7.3 is not supported. check this link
Hence please use 3.7.10 in the runtime.txt file
Refer to the supported python versions and align your runtime.txt file make sure it as follows python-3.7.3 with no spacing, if your project is using an extremely lower version of python, you need to align to make sure you aren't using libraries that are not supported as per python-3.7X

Heroku Deployment Issue - Python version

I have been working on a Django project that I am trying to deploy to Heroku. I've followed a tutorial from Python Crash Course. When I enter git push heroku master, I get the following as a response:
Counting objects: 73, done.
Delta compression using up to 4 threads.
Compressing objects: 100% (65/65), done.
Writing objects: 100% (73/73), 26.20 KiB | 0 bytes/s, done.
Total 73 (delta 8), reused 0 (delta 0)
remote: Compressing source files... done.
remote: Building source:
remote:
remote: -----> Python app detected
remote: ! The latest version of Python 3 is python-3.6.2 (you are using Python-2.7.12, which is unsupported).
remote: ! We recommend upgrading by specifying the latest version (python-3.6.2).
remote: Learn More: https://devcenter.heroku.com/articles/python-runtimes
remote: -----> Installing Python-2.7.12
remote: ! Requested runtime (Python-2.7.12) 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 fathomless-scrubland-11916.
remote:
When I Python --version the cmd line returns 2.7.14 which is the most up-to-date version. I feel like this error is telling me I need to use Python3 but their site says that 2.7.14 is supported as well. My runtime.txt specifies 2.7.14.
Please try python-3.5.2 in runtime.txt
though it gives a warning it still works

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