1

I'm using Django 2.2.3 and I'm getting this error:

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

But, Heroku's Python documentation says that python-3.7.3 should be available in stack heroku-18.

runtime.txt contains Python-3.7.3.

FULL ERROR

Counting objects: 100% (43/43), done.
Delta compression using up to 4 threads
Compressing objects: 100% (36/36), done.
Writing objects: 100% (43/43), 10.70 KiB | 996.00 KiB/s, done.
Total 43 (delta 6), reused 0 (delta 0)
remote: Compressing source files... done.
remote: Building source:
remote:
remote: -----> Python app detected
remote:  !     Requested runtime (Python-3.7.3) 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
ChrisGPT was on strike
  • 127,765
  • 105
  • 273
  • 257
12944qwerty
  • 2,001
  • 1
  • 10
  • 30

5 Answers5

7

Like just about everything else in the Heroku ecosystem, runtime.txt is case-sensitive. Change its contents to

python-3.7.3

with a lowercase p.

ChrisGPT was on strike
  • 127,765
  • 105
  • 273
  • 257
3

I found my self into this error using Windows10 and trying to push my project into Heroku. Mine is a Flask app.

ERROR:

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

What happened? I did have Python 3.7.1 installed on my machine. Even when declaring python-3.7.2 into runtime.txt I had the error.

What I did? Checked my python version via powershell (as admin): python --version Was 3.7.1

Then upgraded the python via chocolatey. Check this answer.

  1. choco upgrade python -y

  2. refreshenv

  3. Close and reopen your code editor OR reboot the system.

Checked my python version one more time: now I have 3.8.0, which is a supported stack.

I did go back to my project and deleted the virtualenv folder (mine was venv). Started over the venv creation, dependencies installation, and setup.

Add python-3.8.0 into runtime.txt and retry the whole heroku deployment.

VOILÁ!

Note: remember to update your environment variables and python Path.

Note 2: Please let us know your results or solutions.

0

I think this stack of heroku is not compatible with this python version, try upgarding your stack using this command: heroku stack:set heroku-20 or try some other stack from this documentation

0

I had to select from the supported Python versions listed here: https://devcenter.heroku.com/articles/python-support

Rivers Cuomo
  • 316
  • 2
  • 5
  • 11
-1

I don't know how it will help you. I just removed the requirements.txt file from my django app then heroku automatically detected the python version and now it works fine

  • 1
    I'm not sure this is the best solution. To start, the `requirements.txt` is there for a reason- to specify the exact versions necessary to run the project. Removing them could mess up other things along the way. – Xiddoc May 29 '21 at 12:06