'sqlalchemy._collections'

85 views
Skip to first unread message

Miriam Schmidt

unread,
Aug 15, 2021, 4:37:17 PM8/15/21
to oTree help & discussion

Hi all,

I am trying to launch an experiment via otree devserver, but I am always getting this error message: ModuleNotFoundError: No module named 'sqlalchemy._collections'
Has anyone an idea why? Thank you in advance!

Chris @ oTree

unread,
Aug 15, 2021, 4:48:11 PM8/15/21
to Miriam Schmidt, oTree help & discussion
(1) pip3 uninstall otree
(2) verify that it was uninstalled by trying to run a command like devserver
(2) reinstall otree

Maybe somehow oTree did not get fully installed or uninstalled (perhaps because the process was interrupted)

Sent from my phone

On Aug 15, 2021, at 2:37 PM, Miriam Schmidt <mirisc...@gmail.com> wrote:



Hi all,

I am trying to launch an experiment via otree devserver, but I am always getting this error message: ModuleNotFoundError: No module named 'sqlalchemy._collections'
Has anyone an idea why? Thank you in advance!

--
You received this message because you are subscribed to the Google Groups "oTree help & discussion" group.
To unsubscribe from this group and stop receiving emails from it, send an email to otree+un...@googlegroups.com.
To view this discussion on the web, visit https://groups.google.com/d/msgid/otree/060a2d17-acf3-4a06-b76c-6632d4225fb9n%40googlegroups.com.

Miriam Schmidt

unread,
Aug 15, 2021, 5:29:01 PM8/15/21
to oTree help & discussion
Hi Chris,  thank you so much for the quick answer! I uninstalled otree, I checked via otree devserver and it told me it is not defined. Then I installed it again with pip3 install otree. It still gave me the same error. I use pip version 21.2.4 and otree versiob 5.2.8, so the latest version I coul dget.

Chris @ oTree

unread,
Aug 15, 2021, 5:32:14 PM8/15/21
to oTree help & discussion
Can you show the full traceback you get when you run "otree devserver"? also the output of 'pip3 freeze'

Miriam Schmidt

unread,
Aug 15, 2021, 5:41:49 PM8/15/21
to oTree help & discussion

sure! The results of pip3 freeze are:
aiofiles==0.6.0
asgi-redis==0.14.1
asgiref==0.14.0
autobahn==0.16.0
certifi==2021.5.30
channels==0.17.3
click==7.1.2
colorama==0.3.7
contextlib2==0.5.4
daphne==0.14.3
dj-database-url==0.4.1
Django==1.11.2
django-idmap==1.0.3
django-vanilla-views==1.0.4
h11==0.12.0
honcho==0.7.1
huey==1.10.2
IPy==0.83
itsdangerous==1.1.0
lib==3.0.0
MarkupSafe==1.1.1
msgpack-python==0.4.8
numpy==1.21.1
otree==5.2.8
otree-boto2-shim==0.3.2
otree-core==0.0.0b1
otree-save-the-change==1.1.3
pbr==1.10.0
psycopg2==2.9.1
py==1.4.31
pytest==2.9.2
pytest-django==3.0.0
python-multipart==0.0.5
python-redis-lock==3.7.0
pytz==2017.3
redis==2.10.5
requests==2.11.1
schema==0.6.2
sentry-sdk==0.7.9
six==1.10.0
SQLAlchemy==1.3.22
starlette==0.14.1
termcolor==1.1.0
Twisted==16.2.0
txaio==2.5.1
unicodecsv==0.14.1
urllib3==1.26.6
uvicorn==0.13.4
websockets==8.1
whitenoise==3.2.1
ws4py==0.3.5
WTForms==2.3.3
WTForms-SQLAlchemy==0.2
XlsxWriter==0.9.3
zope.interface==4.2.0


the full traceback is:
PS C:\Users\M\Documents\Experiment> otree devserver
Traceback (most recent call last):
  File "C:\Users\M\AppData\Local\Programs\Python\Python39\lib\runpy.py", line 197, in _run_module_as_main
    return _run_code(code, main_globals, None,
  File "C:\Users\M \AppData\Local\Programs\Python\Python39\lib\runpy.py", line 87, in _run_code
    exec(code, run_globals)
  File "C:\Users\M\Documents\Experiment\venv\Scripts\otree.exe\__main__.py", line 7, in <module>
  File "C:\Users\M\Documents\Experiment\venv\lib\site-packages\otree\main.py", line 106, in execute_from_command_line
    setup()
  File " C:\Users\M\Documents\Experiment\venv\lib\site-packages\otree\main.py", line 137, in setup
    from otree.database import init_orm  # noqa
  File " C:\Users\M\Documents\Experiment\venv\lib\site-packages\otree\database.py", line 12, in <module>
    import sqlalchemy
  File " C:\Users\M\Documents\Experiment\venv\lib\site-packages\sqlalchemy\__init__.py", line 14, in <module>
    from ._collections import coerce_generator_arg  # noqa

ModuleNotFoundError: No module named 'sqlalchemy._collections'

Chris @ oTree

unread,
Aug 15, 2021, 5:58:54 PM8/15/21
to oTree help & discussion
Try running python:

python3

Then enter:

import sqlalchemy

Does that produce any output?

I don't know what happened here. Somehow your sqlalchemy installation is not working as expected. I see you have some other packages like pytest and Django that are not part of the oTree 5 installation. Maybe they are interfering somehow. I see you are using a virtualenv. Try deleting it, create a new fresh virtualenv and try that instead.

Chris @ oTree

unread,
Aug 15, 2021, 6:04:47 PM8/15/21
to oTree help & discussion
or do "pip3 uninstall sqlalchemy" and then install oTree again.
Message has been deleted

Miriam Schmidt

unread,
Aug 15, 2021, 7:39:33 PM8/15/21
to oTree help & discussion
Thanks Chris. I got another error, but the sqlalchemy error disappeared after uninstalling it as well as downgrading a couple of packages.
Reply all
Reply to author
Forward
0 new messages