There are two different ways to install and use PySB:

  1. Install PySB natively on your computer (recommended).


  2. Download a Docker container with PySB and Jupyter Notebook. If you are familiar with Docker, PySB can be installed from the Docker Hub by typing docker pull pysb/pysb. Further details are below.


Need Help? If you run into any problems with installation, please visit our chat room:

Option 1: Install PySB natively on your computer

  1. Install Anaconda

    Our recommended approach is to use Anaconda, which is a distribution of Python containing most of the numeric and scientific software needed to get started. If you are a Mac or Linux user, have used Python before and are comfortable using pip to install software, you may want to skip this step and use your existing Python installation.

    Anaconda has a simple graphical installer which can be downloaded from - select your operating system and download the Python 2.7 version. The default installer options are usually appropriate.


    Windows users: If you are unsure whether to use the 32-bit or 64-bit installer, press the Windows Start button, search for “About your PC”, and under “System type” it will specify 32-bit operating system or 64-bit operating system

  2. (Windows only) Install perl

    Press the Windows Start button, search for “command prompt”, and select it/press enter. Then enter the following at the prompt:

    conda install --yes perl

    Use the command prompt when you need to type commands in a terminal.

  3. Install BioNetGen

    Download BioNetGen from here:

    Extract the download, rename the unzipped BioNetGen-x.y.z folder to just BioNetGen and move it into /usr/local/share (Mac or Linux) or C:\Program Files (Windows). If you would like to put it somewhere else, set the BNGPATH environment variable to the full path to the BioNetGen-x.y.z folder.

  4. Install PySB

    The installation is very straightforward with pip - type the following in a terminal:

    pip install pysb


    Mac users: To open a terminal on a Mac, open Spotlight search (press command key and space), type terminal and press enter.

  5. Start Python and PySB

    If you installed Python using Anaconda on Windows, search for and select IPython from your Start Menu (Windows). Otherwise, open a terminal and type python to get started (or ipython, if installed).

    You will then be at the Python prompt. Type import pysb to try loading PySB. If no error messages appear and the next Python prompt appears, you have succeeded in installing PySB! You can now proceed to the Tutorial.

Option 2: Docker container with PySB and Jupyter Notebook


Docker is a virtualization platform which encapsulates software within a container. It can be thought of like a virtual machine, only it contains just the application software (and supporting dependencies) and not a full operating system stack.

Install Docker and the PySB software stack

  1. Install Docker

    To use PySB with Docker, first you’ll need to install Docker, which can be obtained from

  2. Download the PySB software stack from the Docker Hub

    On the command line, this requires a single command:

    docker pull pysb/pysb

    This only needs to be done once, or when software updates are required.

  3. Start the container

    Start the Docker container with the following command (on Linux, the command may need to be prefixed with sudo):

    docker run -d -p 8888:8888 pysb/pysb

    This starts the PySB Docker container with Jupyter notebook and connects it to port 8888.

  4. Open Jupyter Notebook in a web browser

    Open a web browser of your choice and enter the address http://localhost:8888 in the address bar. You should see a web page with the Jupyter notebook logo. Several example and tutorial notebooks are included to get you started.

Important notes

To see graphics from matplotlib within the Jupyter Notebook, you’ll need to set the following option in your notebooks before calling any plot commands:

%matplotlib inline

Any Jupyter notebooks created will be saved in the container itself, rather than on the host computer. Notebooks can be downloaded using the Jupyter interface, or a directory on the host computer can be shared with the container.

The PySB container builds on the Jupyter SciPy notebook, which contains further information on the options available for the container (such as sharing a directory with the host computer to preserve notebooks, setting a password and more). Documentation from the Jupyter project is available at