pythonpython-3.xherokuheroku-cliheroku-api

Unable to deploy project to Heroku using Python 3.9 or 3.8


Currently, Heroku supports multiple versions of Python as per their documentation. However, I run into an error when I try to deploy a project while including a runtime.txt:

Requested runtime (cat runtime.txt python-3.9.0) 
is not available for this stack (Heroku-20).

Within the runtime.txt I have:

cat runtime.txt
python-3.9.0

Solution

  • Within the runtime.txt I have:

    cat runtime.txt
    python-3.9.0
    

    That file should only contain

    python-3.9.0
    

    cat, short for "concatenate", is a command that you can run on some operating systems (Linux, Unix, likely macOS, maybe others) to show the contents of a file. You probably saw some documentation that said something like

    $ cat runtime.txt
    python-3.9.0
    

    which is supposed to mean "if you run cat runtime.txt you should see python-3.9.0".

    Edit your runtime.txt to remove the cat line, commit, and redeploy.