Installation¶
There are various ways to install Brian, and we recommend that you chose the installation method that
they are most familiar with and use for other Python packages. If you do not yet have Python installed on
your system (in particular on Windows machines), you can install Python and all of Brian’s dependencies
via the Anaconda distribution. You can then install
Brian with the conda
package manager as detailed below.
Note
You need to have access to Python >=3.7 (see Brian’s support policy). In particular, Brian no longer supports Python 2 (the last version to support Python 2 was Brian 2.3). All provided Python packages also require a 64 bit system, but every desktop or laptop machine built in the last 10 years (and even most older machines) is 64 bit compatible.
If you are relying on Python packages for several, independent projects, we recommend that you make use
of separate environments for each project. In this way, you can safely update and install packages for
one of your projects without affecting the others. Both, conda
and pip
support installation in
environments – for more explanations see the respective instructions below.
Standard install¶
Updating an existing installation¶
How to update Brian to a new version depends on the installation method you used previously. Typically, you can run the same command that you used for installation (sometimes with an additional option to enforce an upgrade, if available):
Requirements for C++ code generation¶
C++ code generation is highly recommended since it can drastically increase the speed of simulations (see Computational methods and efficiency for details). To use it, you need a C++ compiler and Cython (automatically installed as a dependency of Brian).
Try running the test suite (see Installing other useful packages below) after the installation to make sure everything is working as expected.
Development install¶
When you encounter a problem in Brian, we will sometimes ask you to install Brian’s latest development version, which includes changes that were included after its last release.
We regularly upload the latest development version of Brian to PyPI’s test server. You can install it via:
python -m pip install --upgrade --pre -i https://test.pypi.org/simple/ Brian2
Note that this requires that you already have all of Brian’s dependencies installed.
If you have git
installed, you can also install directly from github:
python -m pip install git+https://github.com/brian-team/brian2.git
Finally, in particular if you want to either contribute to Brian’s development or regularly test
its latest development version, you can directly clone the git repository at github
(https://github.com/brian-team/brian2) and then run pip install -e .
, to install
Brian in “development mode”. With this installation, updating the git repository is in
general enough to keep up with changes in the code, i.e. it is not necessary to install
it again.
Installing other useful packages¶
There are various packages that are useful but not necessary for working with Brian. These include: matplotlib (for plotting), pytest (for running the test suite), ipython and jupyter-notebook (for an interactive console).
You should also have a look at the brian2tools package, which contains several useful functions to visualize Brian 2 simulations and recordings.
Testing Brian¶
If you have the pytest testing utility installed, you can run Brian’s test suite:
import brian2
brian2.test()
It should end with “OK”, showing a number of skipped tests but no errors or failures. For more control about the tests that are run see the developer documentation on testing.