My flask app runs locally.
When I push it to Heroku via git push heroku master, I get the following error:
ERROR: Could not find a version that satisfies the requirement numpy==1.20.0 (from -r /tmp/build_b6c59d74/requirements.txt (line 12))
I believe this is because my local python version does not match Heroku’s.
When I run python -V I get Python 3.7.4.
As per the full logs below, Heroku is using the current default of python-3.6.12.
As per this article, I added a runtime.txt file to my root directory (the same directory as my requirements.txt file).
I initially added python-3.7.4, but after checking Heroku’s supported runtimes, it seems I should be using python-3.7.9.
I've updated it to python-3.7.9.
When I run cat runtime.txt, I get python-3.7.9.
I've checked that there are no line breaks, spaces and that I'm using the right dash.
But when I run git push Heroku master, it seems to be ignoring runtime.txt and installing python-3.6.12 (see full logs below).
I've checked that I'm running a supported stack, and when I run heroku stack it shows heroku-20.
heroku buildpacks returns `heroku/python/.
Below are the full logs of the error returned when I run git push heroku master
Total 0 (delta 0), reused 0 (delta 0)
remote: Compressing source files... done.
remote: Building source:
remote:
remote: -----> Building on the Heroku-20 stack
remote: -----> Python app detected
remote: -----> Requirements file has been changed, clearing cached dependencies
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 alembic==1.5.3
remote: Downloading alembic-1.5.3.tar.gz (1.1 MB)
remote: Collecting click==7.1.2
remote: Downloading click-7.1.2-py2.py3-none-any.whl (82 kB)
remote: Collecting Flask==1.1.2
remote: Downloading Flask-1.1.2-py2.py3-none-any.whl (94 kB)
remote: Collecting Flask-Migrate==2.6.0
remote: Downloading Flask_Migrate-2.6.0-py2.py3-none-any.whl (13 kB)
remote: Collecting Flask-SQLAlchemy==2.4.4
remote: Downloading Flask_SQLAlchemy-2.4.4-py2.py3-none-any.whl (17 kB)
remote: Collecting Flask-WTF==0.14.3
remote: Downloading Flask_WTF-0.14.3-py2.py3-none-any.whl (13 kB)
remote: Collecting gunicorn==20.0.4
remote: Downloading gunicorn-20.0.4-py2.py3-none-any.whl (77 kB)
remote: Collecting itsdangerous==1.1.0
remote: Downloading itsdangerous-1.1.0-py2.py3-none-any.whl (16 kB)
remote: Collecting Jinja2==2.11.2
remote: Downloading Jinja2-2.11.2-py2.py3-none-any.whl (125 kB)
remote: Collecting Mako==1.1.4
remote: Downloading Mako-1.1.4.tar.gz (479 kB)
remote: Collecting MarkupSafe==1.1.1
remote: Downloading MarkupSafe-1.1.1-cp36-cp36m-manylinux2010_x86_64.whl (32 kB)
remote: ERROR: Could not find a version that satisfies the requirement numpy==1.20.0 (from -r /tmp/build_b6c59d74/requirements.txt (line 12)) (from versions: 1.3.0, 1.4.1, 1.5.0, 1.5.1, 1.6.0, 1.6.1, 1.6.2, 1.7.0, 1.7.1, 1.7.2, 1.8.0, 1.8.1, 1.8.2, 1.9.0, 1.9.1, 1.9.2, 1.9.3, 1.10.0.post2, 1.10.1, 1.10.2, 1.10.4, 1.11.0b3, 1.11.0rc1, 1.11.0rc2, 1.11.0, 1.11.1rc1, 1.11.1, 1.11.2rc1, 1.11.2, 1.11.3, 1.12.0b1, 1.12.0rc1, 1.12.0rc2, 1.12.0, 1.12.1rc1, 1.12.1, 1.13.0rc1, 1.13.0rc2, 1.13.0, 1.13.1, 1.13.3, 1.14.0rc1, 1.14.0, 1.14.1, 1.14.2, 1.14.3, 1.14.4, 1.14.5, 1.14.6, 1.15.0rc1, 1.15.0rc2, 1.15.0, 1.15.1, 1.15.2, 1.15.3, 1.15.4, 1.16.0rc1, 1.16.0rc2, 1.16.0, 1.16.1, 1.16.2, 1.16.3, 1.16.4, 1.16.5, 1.16.6, 1.17.0rc1, 1.17.0rc2, 1.17.0, 1.17.1, 1.17.2, 1.17.3, 1.17.4, 1.17.5, 1.18.0rc1, 1.18.0, 1.18.1, 1.18.2, 1.18.3, 1.18.4, 1.18.5, 1.19.0rc1, 1.19.0rc2, 1.19.0, 1.19.1, 1.19.2, 1.19.3, 1.19.4, 1.19.5)
remote: ERROR: No matching distribution found for numpy==1.20.0 (from -r /tmp/build_b6c59d74/requirements.txt (line 12))
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: dd64a89ce1402daf7c7b0804558f3f6ec776d188
remote: !
remote: ! We have detected that you have triggered a build from source code with version dd64a89ce1402daf7c7b0804558f3f6ec776d188
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 pure-lowlands-59273.
remote:
To https://git.heroku.com/pure-lowlands-59273.git
! [remote rejected] master -> master (pre-receive hook declined)
error: failed to push some refs to 'https://git.heroku.com/pure-lowlands-59273.git'
Note that I believe the warning above is unrelated and is instead due to me trying to push to Heroku multiple times.
I checked https://devcenter.heroku.com/articles/duplicate-build-version and this does not seem to be the issue. All local changes are committed and the branch is correct (both on the master branch).
This seemingly simple process is really making me question my sanity.
I can't find anything online above people reporting similar errors, so I'm presuming it's some kind of typo?
I checked the spelling of runtime.txt 17 times and its file contents for extra spaces or line breaks. No dice.
I'd love some help on this. Thank you so much for your assistance!