Installation

BrainPy is designed to run on across-platforms, including Windows, GNU/Linux and OSX. It only relies on Python libraries.

Installation with pip

You can install BrainPy from the pypi. To do so, use:

pip install -U brain-py

If you want to install the pre-release version (the latest development version) of BrainPy, you can use:

pip install --pre brain-py

Installation from source

If you decide not to use conda or pip, you can install BrainPy from GitHub, or OpenI.

To do so, use:

pip install git+https://github.com/PKU-NIP-Lab/BrainPy

# or

pip install git+https://git.openi.org.cn/OpenI/BrainPy

Package Dependency

In order to make BrainPy work normally, users should install several dependent Python packages.

NumPy & Matplotlib

The basic function of BrainPy only relies on NumPy and Matplotlib. Install these two packages is very easy, just using pip or conda:

pip install numpy matplotlib
# or
conda install numpy matplotlib

JAX

We highly recommend you to install JAX. JAX is a high-performance JIT compiler which enables users run Python code on CPU, GPU, or TPU devices. Most functionalities of BrainPy is based on JAX.

Currently, JAX supports Linux (Ubuntu 16.04 or later) and macOS (10.12 or later) platforms. The provided binary releases of JAX for Linux and macOS systems are available at https://storage.googleapis.com/jax-releases/jax_releases.html . Users can download the preferred release “.whl” file, and install it via pip:

pip install xxxx.whl

For Windows users, JAX can be installed by the following methods:

More details of JAX installation can be found in https://github.com/google/jax#installation .

Numba

Numba is also an excellent JIT compiler, which can accelerate your Python codes to approach the speeds of C or FORTRAN. Numba works best with NumPy. Many BrainPy modules rely on Numba for speed acceleration, such like connectivity, simulation, analysis, measurements, etc. Numba is also a suitable framework for the computation of sparse synaptic connections commonly used in the computational neuroscience project.

Numba is a cross-platform package which can be installed on Windows, Linux, and macOS. Install Numba is a piece of cake. You just need type the following commands in you terminal:

pip install numba
# or
conda install numba

SymPy

In BrainPy, several modules need the symbolic inference by SymPy. For example, Exponential Euler numerical solver needs SymPy to compute the linear part of your defined Python codes, phase plane and bifurcation analysis in dynamics analysis module needs symbolic computation from SymPy. Therefore, we highly recommend you to install sympy, just typing

pip install sympy
# or
conda install sympy