Tutorial B: Installing the Seldonian Toolkit libraries


Contents


Toolkit structure

The Seldonian Toolkit consists of two Python libraries and a GUI. The two libraries are the Seldonian Engine library and the Seldonian Experiments library. We recommend always installing the libraries in the same virtual environment. If using the GUI, install that in the same environment as well.

The toolkit is compatible and tested with Python versions 3.8, 3.9, and 3.10. It is incompatible with Python versions lower than version 3.8. We do not plan to support Python versions lower than 3.8, but we do plan to add support for Python version 3.11 soon.

Engine installation

The Seldonian Engine library can be installed with a single line:

$ python -m pip install --upgrade seldonian-engine 

This will make the seldonian package available for you to import in Python. Warnings about scripts not being in PATH can be ignored. To turn off these warnings in the future, one can add --no-warn-script-location to the pip install command. To test that the install worked, run this command from the command line:

$  python -c "from seldonian.seldonian_algorithm import SeldonianAlgorithm"

If it worked, there will be nothing printed to the command line. If you get this error:

ModuleNotFoundError: No module named 'seldonian'

then make sure that the Python executable you are using to run this command is the same one you used to do the "pip install" command above. You can see the full path of your Python command by running:

$ which python 

on Unix systems or:

$ where python 

on Windows systems. The "gcm" command may work instead of "where" in Powershell.

Experiments installation

The Seldonian Engine library is a dependency of the Seldonian Experiments library. If you know you are planning to use the Experiments library, then you can skip the above steps of installing the Engine because it will be automatically installed when the Experiments library is installed. The Experiments library can be installed with a single line:

$ python -m pip install --upgrade seldonian-experiments 

This will make the "experiments" package available for you to import in Python. To test that it worked, run this command from the command line:

$ python -c "from experiments.generate_plots import SupervisedPlotGenerator"

If it worked, there will be nothing printed to the command line. If you get this error:

ModuleNotFoundError: No module named 'experiments'

then make sure that the Python executable you are using to run this command is the same one you used to do the "pip install" command above. You can see the full path of your Python command by running:

$ which python 

on Unix systems or:

$ where python 

on Windows systems. The "gcm" command may work instead of "where" in Powershell.

GUI installation

First, clone the GUI repo:

$ git clone https://github.com/seldonian-toolkit/GUI.git

This will create a folder called "GUI" wherever you ran the above command. Enter that folder, and run the following from the command line (after entering your virtual environment, if relevant):

$ pip install -r requirements.txt

The Engine library is one of the requirements of the GUI, so you may seem some output about it already being reinstalled. You can test that the installation worked by running the GUI:

$ python run.py

This will start a webserver running at localhost:5001 on your local machine. Go to that address in your browser, and you should see a page like the following:

GUI screenshot
Figure 1 - A screenshot of the top of the Seldonian Interface GUI webpage.