oTree Forum >

Bug in otree[mturk] 5.9.0 when deploying on heroku

#1 by Elias

Hi,
It may not be an otree bug per se, that's why I am posting it here and not on github. I have this error that crops up when I try to deploy an app on Heroku with the latest Python stack. It does not happen when locally testing the app, but there is not mturk dependency in that case.
It only shows up when otree[mturk] is in version 5.9.0 or 5.8.5 in my requirements.txt, but it does not when otree[mturk] is in version 5.8.4 or 5.8.0 (I have not tried version in between but I believe it should not happen either).

from .packages import chardet
File "/app/.heroku/python/lib/python3.10/site-packages/botocore/vendored/requests/packages/__init__.py", line 3, in <module>
from . import urllib3
File "/app/.heroku/python/lib/python3.10/site-packages/botocore/vendored/requests/packages/urllib3/__init__.py", line 10, in <module>
from .connectionpool import (
File "/app/.heroku/python/lib/python3.10/site-packages/botocore/vendored/requests/packages/urllib3/connectionpool.py", line 38, in <module>
from .response import HTTPResponse
File "/app/.heroku/python/lib/python3.10/site-packages/botocore/vendored/requests/packages/urllib3/response.py", line 9, in <module>
from ._collections import HTTPHeaderDict
File "/app/.heroku/python/lib/python3.10/site-packages/botocore/vendored/requests/packages/urllib3/_collections.py", line 1, in <module>
from collections import Mapping, MutableMapping
ImportError: cannot import name 'Mapping' from 'collections' (/app/.heroku/python/lib/python3.10/collections/__init__.py)

It looks to me like a dependency from otree has changed in between the two versions that makes this bug happen, but that is as far as I can go.
Thanks for your help!
Elias

#2 by Chris_oTree

Hi, thanks for reporting this. I just learned that oTree's MTurk integration is not working on Python 3.10. I will look into the best way to address this long term; in the meanwhile I published a new oTree version that will alert about this issue. You should either use oTree HR (https://otree-hr.herokuapp.com/) or downgrade Python to 3.9.

#3 by Chris_oTree

By the way it didn't work on 5.8.4 either; it just failed silently and although you didn't get an error message, the 'publish to mturk' button would be unavailable.

#4 by Elias

Thanks for the quick answer!

#5 by Chris_oTree

I just published an update that fixes the issue, allowing you to run MTurk on Python 3.10. (I removed the boto3 dependency and wrote the AWS integration code from scratch.) Please give it a try and let me know:

pip3 install -U --pre otree

#6 by Victor

I also stumbled on this issue recently and rolled back a version. Good to hear it's being worked on. Thanks a lot, Chris.

#7 by Chris_oTree

Try the beta I just published (see above); it should fix the mturk functionality on Python 3.10. Otherwise you would need to downgrade to python 3.9 and reinstall python, otree, etc.

(rolling back to the old oTree version doesn't fix the issue as described above.)

#8 by Elias

Thanks a lot! It does seem to work.
I have not been till running an actual experiment, but I can deploy to Heroku and create a session for Mturk.

Write a reply

Set forum username