Reputation: 77
I've encountered an error while trying to push my Python-Flask code to Heroku.
Error:
compressing objects: 100% (7/7), done.
Writing objects: 100% (12/12), 1.52 KiB | 777.00 KiB/s, done.
Total 12 (delta 0), reused 0 (delta 0), pack-reused 0
remote: Compressing source files... done.
remote: Building source:
remote:
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: Collecting astroid==2.4.2
remote: Downloading astroid-2.4.2-py3-none-any.whl (213 kB)
remote: Collecting backcall==0.2.0
remote: Downloading backcall-0.2.0-py2.py3-none-any.whl (11 kB)
remote: Collecting click==7.1.2
remote: Downloading click-7.1.2-py2.py3-none-any.whl (82 kB)
remote: Collecting colorama==0.4.4
remote: Downloading colorama-0.4.4-py2.py3-none-any.whl (16 kB)
remote: Collecting decorator==4.4.2
remote: Downloading decorator-4.4.2-py2.py3-none-any.whl (9.2 kB)
remote: Collecting Flask==1.1.2
remote: Downloading Flask-1.1.2-py2.py3-none-any.whl (94 kB)
remote: Collecting Flask-SQLAlchemy==2.4.4
remote: Downloading Flask_SQLAlchemy-2.4.4-py2.py3-none-any.whl (17 kB)
remote: Collecting gunicorn==20.0.4
remote: Downloading gunicorn-20.0.4-py2.py3-none-any.whl (77 kB)
remote: Collecting ipykernel==5.4.2
remote: Downloading ipykernel-5.4.2-py3-none-any.whl (119 kB)
remote: ERROR: Could not find a version that satisfies the requirement ipython==7.19.0 (from -r /tmp/build_e6e2039b/requirements.txt (line 10)) (from versions: 0.10, 0.10.1, 0.10.2, 0.11, 0.12, 0.12.1, 0.13, 0.13.1, 0.13.2, 1.0.0, 1.1.0, 1.2.0, 1.2.1, 2.0.0, 2.1.0, 2.2.0, 2.3.0, 2.3.1, 2.4.0, 2.4.1, 3.0.0, 3.1.0, 3.2.0, 3.2.1, 3.2.2, 3.2.3, 4.0.0b1, 4.0.0, 4.0.1, 4.0.2, 4.0.3, 4.1.0rc1, 4.1.0rc2, 4.1.0, 4.1.1, 4.1.2, 4.2.0, 4.2.1, 5.rc1, 6.0.0, 6.1.0, 6.2.0, 6.2.1, 6.3.0, 6.3.1, 6.4.0, 6.5.0, 7.0.0b1, 7.0.0rc1, 7.0.0, 7.0.1, 7.1.0, 7.1.1, 7.2.0, 7.3.0, 7.4.0, 7.5.0, 7.6.0, 7.6.1, 7.7.0, 7.8.0, 7.9.0, 7.10.0, 7.10.1, 7.10.2, 7.11.0, 7.11.1, 7.12.0, 7.13.0, 7.14.0, 7.15.0, 7.16.0, 7.16.1)
remote: ERROR: No matching distribution found for ipython==7.19.0 (from -r /tmp/build_e6e2039b/requirements.txt (line 10))
remote: ! Push rejected, failed to compile Python app.
remote:
remote: ! Push failed
remote: !
remote: ! ## Warning - The same version of this code has already been built: 1b953aa70b4350a9b5c04e44ec9852f65b074873
remote: !
remote: ! We have detected that you have triggered a build from source code with version 1b953aa70b4350a9b5c04e44ec9852f65b074873
remote: ! at least twice. One common cause of this behavior is attempting to deploy code from a different branch.
remote: !
remote: ! If you are developing on a branch and deploying via git you must run:
remote: !
remote: ! git push heroku <branchname>:main
remote: !
remote: ! This article goes into details on the behavior:
remote: ! https://devcenter.heroku.com/articles/duplicate-build-version
remote:
remote: Verifying deploy...
remote:
remote: ! Push rejected to tmtvsc.
remote:
To https://git.heroku.com/tmtvsc.git
! [remote rejected] master -> master (pre-receive hook declined)
error: failed to push some refs to 'https://git.heroku.com/tmtvsc.git'
The app is running on python 3.9.1, and I have a runtime.txt
file to specify the version of python I'm using. I've also done pip install ipython
, created a Procfile
and requirements.txt
.
Lastly, I tried doing pip install -r requirements.txt
, but that doesn't work either. I would really appreciate your help in this matter.
Upvotes: 1
Views: 298
Reputation: 13973
It looks like Heroku cannot download the required version 7.19.0
, but it can fetch previous releases
ERROR: Could not find a version that satisfies the requirement ipython==7.19.0
(from -r /tmp/build_e6e2039b/requirements.txt (line 10))
(from versions: 0.10, 0.10.1, 0.10.2, 0.11, 0.12, 0.12.1, 0.13, 0.13.1, 0.13.2, 1.0.0,
1.1.0, 1.2.0, 1.2.1, 2.0.0, 2.1.0, 2.2.0, 2.3.0, 2.3.1, 2.4.0, 2.4.1, 3.0.0, 3.1.0,
3.2.0, 3.2.1, 3.2.2, 3.2.3, 4.0.0b1, 4.0.0, 4.0.1, 4.0.2, 4.0.3, 4.1.0rc1, 4.1.0rc2,
4.1.0, 4.1.1, 4.1.2, 4.2.0, 4.2.1, 5.rc1, 6.0.0, 6.1.0, 6.2.0, 6.2.1, 6.3.0, 6.3.1,
6.4.0, 6.5.0, 7.0.0b1, 7.0.0rc1, 7.0.0, 7.0.1, 7.1.0, 7.1.1, 7.2.0, 7.3.0, 7.4.0,
7.5.0, 7.6.0, 7.6.1, 7.7.0, 7.8.0, 7.9.0, 7.10.0, 7.10.1, 7.10.2, 7.11.0, 7.11.1,
7.12.0, 7.13.0, 7.14.0, 7.15.0, 7.16.0, 7.16.1)
You could try to downgrade to 7.16.1
According to Heroku
Anything that works with a standard pip requirements file will work as expected on Heroku.
but in this case it is not clear what happens (caching?)
An alternative (more robust in my opinion) is to deploy the application using the Heroku Docker Registry: build the Docker image locally (collecting all pip dependencies) and push it to Heroku. This approach makes sure Heroku runs the same Docker image you build and run on your local dev environment.
Upvotes: 1