oTree Forum >

Old oTree Hub site stuck on Python 3.9 (Heroku EOL) – cannot create new site

#1 by LIDONGDONG

Hello oTree team,

I am using an old oTree Hub account/site that appears to have been created around 2018–2019.

My existing Heroku site can no longer be deployed because Heroku has deprecated Python 3.9. 
The build log shows:
“Using Python 3.9.16 specified in runtime.txt”
and the deployment fails due to Python 3.9 being end-of-life.

However, in my oTree Hub interface:
- I cannot edit or override the Python version.
- There is no option to create a new site.
- runtime.txt is not accessible or editable by the user.
- Local changes (runtime.txt, .python-version, otree zip) do not affect the deployment.

It seems that the Python version is hard-coded in the legacy oTree Hub site configuration.

Could you please advise whether my account/site can be:
1) migrated to the current oTree Hub infrastructure (Python ≥ 3.11), or
2) provided with a new site under the new runtime?

This is purely a deployment/runtime issue; the experiment code and design are unchanged.

Thank you very much for your help.

Attached is the information showed after I upload my new experiment

Build result Failed Time 14 seconds ago Build output -----> Building on the Heroku-22 stack -----> Using buildpack: heroku/python -----> Python app detected -----> Using Python 3.9.16 specified in runtime.txt  ! Error: The requested Python version has reached end-of-life.  !   ! Python 3.9 has reached its upstream end-of-life, and is  ! therefore no longer receiving security updates:  ! https://devguide.python.org/versions/#supported-versions  !   ! As such, it's no longer supported by this buildpack:  ! https://devcenter.heroku.com/articles/python-support#supported-python-versions  !   ! Please upgrade to at least Python 3.10 by changing the  ! version in your runtime.txt file.  !   ! If possible, we recommend upgrading all the way to Python 3.14,  ! since it contains many performance and usability improvements. ! Push rejected, failed to compile Python app. ! Push failed

Thank you

#2 by Chris_oTree

You can resolve the problem either by upgrading oTree, or by manually editing your runtime.txt file (and when prompted tell oTree not to overwrite it). The new oTree version uses .python-version instead of runtime.txt.

#3 by Eirini

I have the same problem. How can you upgrade oTree or how exactly can you manually edit your runtime.txt file ? What exactly do you need to add? Thanks in advance

#4 by Eirini

I see in my otree code opened through pycharm that I have the python-version 3.12

#5 by Juliana

Hi,

I have the same issue. I have done what Chris suggested and the problem remains. Has anyone found a solution? Thank you.

#6 by Juliana

The zip.py file has the following code. When I use the command otree zip, the runtime file is created and the python version written on the file is 3.9.16, even though I am using 3.12. I updated oTree as well as Python (and PyCharm). Nothing seems to resolve the issue.
 
 overwrite_runtime_txt = not os.getenv('OTREE_NO_RUNTIME_TXT')
    if overwrite_runtime_txt:
        runtime_txt = project_path / '.python-version'
        runtime_txt.write_text('3.12')
    with tarfile.open(archive_name, 'w:gz') as tar:
        # if i omit arcname, it nests the project 2 levels deep.
        # if i say arcname=proj, it puts the whole project in a folder.
        # if i say arcname='', it has 0 levels of nesting.
        tar.add(project_path, arcname='', filter=filter_func)
    if overwrite_runtime_txt:
        runtime_txt.unlink()
    logger.info(f'Saved your code into file "{archive_name}"')

#7 by ExperimenterDan

Any updates to this issue? I'm having the same trouble even after upgrading oTree and really need to fix this to run an experiment next week. Thanks in advance if anyone sees this!

#8 by Experimentalist96

Hi,
I have the exact same issue. Did any of you find a solution?

#9 by ExperimenterDan

I added my own .python-version file in the root of my project, and it worked after that. 

I can't confirm that was the actual fix, but it would seem like a crazy coincidence if it wasn't since I hadn't changed anything else in between upgrading oTree and trying this out!

#10 by Chris_oTree

Another approach if you can't upgrade oTree is to find the file zip.py in oTree's source code installed on your computer, and change the line that sets the python version.

#11 by Bird25

Using the approach specified from Chris works when uploading, make sure to do it on all zip source code as there would be multiple.

Write a reply

Set forum username