Installing oTree on Windows¶
If you publish research conducted using oTree, you are required by the oTree license to cite this paper. (Citation: Chen, D.L., Schonger, M., Wickens, C., 2016. oTree - An open-source platform for laboratory, online and field experiments. Journal of Behavioral and Experimental Finance, vol 9: 88-97)
If the below steps don’t work for you, please email email@example.com with details.
Step 2: Install oTree¶
Go to the folder where you want to create your oTree project. Then click the “File” menu and open PowerShell:
Enter this command at the prompt:
pip3 install -U otree
If you get an error like this:
error: Microsoft Visual C++ 9.0 is required (Unable to find vcvarsall.bat).
To fix this, install the Visual C++ Build Tools.
Step 3: Run oTree¶
Create your project folder:
otree startproject oTree
When it asks you “Include sample games?” choose yes.
Move into the folder you just created:
Run the server:
Open your browser to http://localhost:8000/. You should see the oTree demo site.
To stop the server, press
Control + C at your command line.
Step 4: Install PyCharm¶
Install PyCharm, which you will use for editing your Python files.
After installing, open PyCharm, go to “File -> Open...” and select your project folder
File –> Settings
and click through the following steps:
- “Project -> Project interpreter”
- Click the “gear” icon
- System Interpreter
And set it to the location of your Python executable,
which you can get in your command prompt by entering
powershell -command "get-command python".
Usually it is
Once it’s configured, the imports at the top of an app’s
models.py should look
If PyCharm displays this warning, select “Ignore requirements”:
Note: Even if you normally use another text editor, we recommend at least trying PyCharm, because PyCharm’s autocompletion makes learning oTree much easier:
We recommend you upgrade on a weekly basis, so that you can get the latest bug fixes and features. This will also ensure that you are using a version that is consistent with the current documentation.
The command to upgrade is the same as the command to install:
pip3 install -U otree
If there is a problem with the upgrade, uninstall then reinstall:
pip3 uninstall otree pip3 install -U otree