oTree Forum >

Issue with python version

#1 by janohirmas

I'm trying to deploy a project in Heroku, but I'm getting this problem. 


-----> Building on the Heroku-22 stack
-----> Determining which buildpack to use for this app
-----> Python app detected
-----> No Python version was specified. Using the buildpack default: python-3.12.3
       To use a different version, see: https://devcenter.heroku.com/articles/python-runtimes
-----> Installing python-3.12.3
-----> Installing pip 24.0, setuptools 69.2.0 and wheel 0.43.0
-----> Installing SQLite3
-----> Installing requirements with pip
       Collecting otree>=5.0.0a21 (from -r requirements.txt (line 4))
         Downloading otree-6.0.0b4.tar.gz (459 kB)
         Preparing metadata (setup.py): started
         Preparing metadata (setup.py): finished with status 'error'
         error: subprocess-exited-with-error
         × python setup.py egg_info did not run successfully.
         │ exit code: 1
         ╰─> [6 lines of output]
             * Error: This version of oTree is only compatible with these Python versions:
             * 3.7, 3.8, 3.9, 3.10, 3.11
             [end of output]
         note: This error originates from a subprocess, and is likely not a problem with pip.
       error: metadata-generation-failed
       × Encountered error while generating package metadata.
       ╰─> See above for output.
       note: This is an issue with the package mentioned above, not pip.
       hint: See above for details.
 !     Push rejected, failed to compile Python app.
 !     Push failed

#2 by DavidP

You'll have to tell heroku to use a version of python older than 3.12, e.g. 3.11.

To do so, create a file runtime.txt in the project folder.
It should contain just one line:

Save the file, git commit (don't forget), and push again to heroku.

This should do the trick.

Write a reply

Set forum username