Search code examples
pythonheroku

Error while pushing to Heroku: requested runtime is not available for this stack


After creating a repository in Heroku, I want to push my project from master branch to my heroku repo.

On my first try I got the following error message:

No default language could be detected for this app

After searching, I used the following command:

heroku buildpacks:set heroku/python

Now it gave me this error message:

App not compatible with buildpack: https://buildpack-registry.s3.amazonaws.com/buildpacks/heroku/python.tgz

So now I tried everything from the beginning and it gives me the following error:

Python app detected

Requested runtime ("python-3.7.1") is not available for this stack (heroku-18).

I am stuck here.

I do have a requirements.txt with all the requirements and a runtime.txt in the same folder as my manage.py file.


Solution

  • Python 3.7.1 is not supported by Heroku, as per their documentation on supported runtimes. Change the Python version to 3.7.2 if you want Python 3.7, or 3.6.8 if you don't.

    For information on specifying a runtime, see this page of the documentation. By default it uses 3.6.8 for Python, so if you want 3.7.2 you need to create a file called runtime.txt in the root directory of your app with python-3.7.2 written inside.