Brian2 is available on the Python package index:

It can therefore be installed using easy_install or pip (in newer versions, this needs the --pre flag to allow for the installation of a prelease):

easy_install brian2
pip install --pre brian2  # newer versions of pip
pip install brian2  # older versions of pip


In principle, the above commands also install Brian’s dependencies. Unfortunately, however, there are two circumstances where this doesn’t work:

  1. If numpy isn’t installed yet, it has to be installed in a separate step before any other dependencies (easy_install numpy or pip install numpy)
  2. On Python 2.x, installing sympy via easy_install does not work because it tries to install the Python 3 version (see this issue), use pip instead.

Alternatively, you can download the source package directly and uncompress it. You can then either run python install to install it, or simply add the source directory to your PYTHONPATH. Note that if you are using Python 3, directly running from the source directory is not possible, you have to install the package first.

To run the latest development code, clone the git repository at github:

C extensions

During installation, Brian2 will try to compile a C++ version of the SpikeQueue, which increases the speed of synaptic propagation. If compilation fails, the pure Python version is used instead. Note that if you use the source package directly without an install, you have to trigger this compilation explicitly using python build_ext --inplace. When you are using the sources from github, this process additionally needs a working installation of Cython.

Testing Brian

If you have the nose testing utility installed, you can run Brian2’s test suite:

import brian2

It should end with “OK”, possibly showing a number of skipped tests but no warnings or errors.