otree zipserver gives "Apps aren't loaded yet." error

115 views
Skip to first unread message

Elif Bike Ösün

unread,
Sep 28, 2021, 5:16:15 PM9/28/21
to oTree help & discussion
When I run the command "otree zipserver", I get the error below. I tried updating python, updating oTree, downgrading oTree but none seem to work. Could anyone help me on how to fix this?

"Running dpa-new_project.otreezip

Traceback (most recent call last):

  File "/Users/elifbikeosun/Library/Python/3.8/lib/python/site-packages/otree_startup/__init__.py", line 201, in do_django_setup

    django.setup()

  File "/Library/Python/3.8/site-packages/django/__init__.py", line 24, in setup

    apps.populate(settings.INSTALLED_APPS)

  File "/Library/Python/3.8/site-packages/django/apps/registry.py", line 91, in populate

    app_config = AppConfig.create(entry)

  File "/Library/Python/3.8/site-packages/django/apps/config.py", line 90, in create

    module = import_module(entry)

  File "/Library/Developer/CommandLineTools/Library/Frameworks/Python3.framework/Versions/3.8/lib/python3.8/importlib/__init__.py", line 127, in import_module

    return _bootstrap._gcd_import(name[level:], package, level)

  File "<frozen importlib._bootstrap>", line 1014, in _gcd_import

  File "<frozen importlib._bootstrap>", line 991, in _find_and_load

  File "<frozen importlib._bootstrap>", line 975, in _find_and_load_unlocked

  File "<frozen importlib._bootstrap>", line 671, in _load_unlocked

  File "<frozen importlib._bootstrap_external>", line 783, in exec_module

  File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed

  File "/private/var/folders/f8/b971xh6d1dq92nx5497fvx080000gn/T/tmpywwu6mr7/prisoner/__init__.py", line 2, in <module>

    from otree.api import *

  File "/Users/elifbikeosun/Library/Python/3.8/lib/python/site-packages/otree/api.py", line 2, in <module>

    from otree.models import BaseSubsession, BaseGroup, BasePlayer, ExtraModel  # noqa

  File "/Users/elifbikeosun/Library/Python/3.8/lib/python/site-packages/otree/models/__init__.py", line 5, in <module>

    from otree.db.models import *  # noqa

  File "/Users/elifbikeosun/Library/Python/3.8/lib/python/site-packages/otree/db/models.py", line 101, in <module>

    class OTreeModel(models.Model, metaclass=OTreeModelBase):

  File "/Users/elifbikeosun/Library/Python/3.8/lib/python/site-packages/otree/db/models.py", line 35, in __new__

    new_class = super().__new__(mcs, name, bases, attrs)

  File "/Library/Python/3.8/site-packages/django/db/models/base.py", line 103, in __new__

    app_config = apps.get_containing_app_config(module)

  File "/Library/Python/3.8/site-packages/django/apps/registry.py", line 252, in get_containing_app_config

    self.check_apps_ready()

  File "/Library/Python/3.8/site-packages/django/apps/registry.py", line 135, in check_apps_ready

    raise AppRegistryNotReady("Apps aren't loaded yet.")

django.core.exceptions.AppRegistryNotReady: Apps aren't loaded yet."

Chris @ oTree

unread,
Sep 28, 2021, 5:21:04 PM9/28/21
to oTree help & discussion
That traceback indicates that the app is written for oTree 5, but you have oTree 3 installed (it mentions Django, which is gone in oTree 5). Upgrade to oTree Lite with:

pip3 install -U otree

If it still gives you that traceback, that suggests you have multiple Pythons installed. Make sure to uninstall the other one to avoid confusion.

Elif Bike Ösün

unread,
Sep 28, 2021, 5:29:55 PM9/28/21
to oTree help & discussion
I have only one Python installed. The new error I get when I upgrade to oTree 5 is the following:

"bash-3.2$ otree zipserver

Traceback (most recent call last):

  File "/usr/local/bin/otree", line 10, in <module>

    sys.exit(execute_from_command_line())

  File "/Library/Python/3.8/site-packages/otree_startup/__init__.py", line 106, in execute_from_command_line

    from . import zipserver  # expensive import

  File "/Library/Python/3.8/site-packages/otree_startup/zipserver.py", line 8, in <module>

    from otree.management.commands.unzip import unzip

ModuleNotFoundError: No module named 'otree.management'"

Chris @ oTree

unread,
Sep 28, 2021, 5:41:48 PM9/28/21
to oTree help & discussion
Try uninstalling:

pip3 uninstall otree

Because that tracebacks shows that you still have at least part of the old otree installed. Maybe it didn't uninstall fully. (There is no "otree_startup" package in oTree 5)

Reply all
Reply to author
Forward
0 new messages