oTree Forum >

AttributeError: module 'otree' has no attribute 'settings'

#1 by Robert

Hi, I recently brought an oTree program that definitely runs, from one laptop to a second laptop. On the second laptop, I installed the latest version of python and oTree, but I've run into the following issue when I tried to run "otree resetdb" but this seems to actually carry over to any otree command. I would appreciate any tips on fixing this

(base) NAME-MBP-2:MYOTREEPROJECT NAME$ otree resetdb
Traceback (most recent call last):
  File "/Users/NAME/anaconda3/bin/otree", line 8, in <module>
  File "/Users/NAME/anaconda3/lib/python3.7/site-packages/otree/main.py", line 106, in execute_from_command_line
  File "/Users/NAME/anaconda3/lib/python3.7/site-packages/otree/main.py", line 130, in setup
    from otree import settings
  File "/Users/NAME/anaconda3/lib/python3.7/site-packages/otree/settings.py", line 30, in <module>
    import settings
  File "/Users/NAME/Dropbox/PROJECT/MYOTREEPROJECT/settings.py", line 153, in <module>
AttributeError: module 'otree' has no attribute 'settings'

#2 by Chris_oTree

Remove this line from your settings.py:


This is no longer used with oTree Lite.

#3 by Chris_oTree

In any case you should also consider installing the same version of Python and oTree to ensure compatibility. Sounds like it's an older project so it might take some work to get it running on oTree Lite.

#4 by Robert

Thank you Chris. I've tried commenting out that specific line, as well as also commenting out the import line for that package, but neither seems to have worked. But I think you are right about needing to make sure I'm installing the same version of Python and oTree, as it is an older project. 

I've started out here: https://www.otree.org/blog/install-old-version.html, it looks like the pip dependency resolver is not installing all packages because I have several things not installed on my laptop, so I will need to install them first to make sure the old version is installing properly.

#5 by Robert

Hi Chris,

Do you know how I figure out which version of oTree I have? In my project, within requirements_base.txt, I have otree-core==1.4.14, which I assume is the otree version.

Does that mean I would install Python 1.4.14 too?

#6 by Umer

Hey Robert! Were you able to resolve all these issues ? I think I am using the same code for a replication and I am getting same errors. Could you please help me with this?

#7 by Victor

If you really want to run the same setup, I think it helps to ensure you have the same Python, packages, and Otree version running in the environment. However, you might also want to try to update to more recent versions (see oTree documentation). I don't know how old the original code of your study is, but, depending on that, you might have to update more.

Write a reply

Set forum username