Installation

The following instructions are for Linux and Mac OS X. It should be possible to install and run PyNN on Windows, but this has not been tested.

Installing PyNN requires:

  • Python (version 3.8+)

  • a recent version of the NumPy package

  • the lazyarray package

  • the Neo package (>= 0.11.0)

  • at least one of the supported simulators: e.g. NEURON, NEST, Brian 2 or Arbor.

Optional dependencies are:

  • mpi4py (if you wish to run distributed simulations using MPI)

  • either Jinja2 or Cheetah (templating engines)

  • the CSA library

  • h5py (to use the SONATA format)

Installing PyNN

The easiest way to get PyNN is to use pip:

$ pip install PyNN

If you would prefer to install manually, download the latest source distribution, then run the setup script, e.g.:

$ tar xzf PyNN-0.12.1.tar.gz
$ pip install ./PyNN-0.12.1

This will install it to your Python site-packages directory, and may require root privileges. We strongly recommend, however, that you use a virtualenv or a Conda environment. We assume you have already installed the simulator(s) you wish to use it with. If this is not the case, see below for installation instructions.

Installing NEURON

For recent versions of NEURON,

$ pip install neuron

may be all you need. If you have more complex needs, try the following.

Download the sources for NEURON 8.0 or later, in .tar.gz format, from http://www.neuron.yale.edu/neuron/download/getstd. Also download Interviews from the same location.

Compile Interviews and NEURON according to the instructions given at http://www.neuron.yale.edu/neuron/static/download/compilestd_unix.html, except that when you run configure, add the options --with-nrnpython and, optionally, --with-paranrn, i.e.:

$ ./configure --prefix=`pwd` --with-nrnpython --with-paranrn
$ make
$ make install

Make sure that you add the Interviews and NEURON bin directories to your path. Test that the Python support has been enabled by running:

$ nrniv -python
NEURON -- VERSION 8.2.2 release/8.2 (93d41fafd) 2022-12-15
Duke, Yale, and the BlueBrain Project -- Copyright 1984-2022
See http://neuron.yale.edu/neuron/credits

>>> import hoc
>>> import nrn

Now you can compile and install NEURON as a Python package:

$ cd src/nrnpython
$ python setup.py install

Now test everything worked:

$ python
>>> import neuron

If you run into problems, check out the NEURON Forum.

Now test that NEURON works with PyNN:

>>> import pyNN.neuron as sim

(The first time you do this, PyNN will compile some PyNN-specific membrane mechanisms).

Installing NEST and PyNEST

NEST 3.4-3.6 can be downloaded from http://www.nest-simulator.org/download/. Earlier versions of NEST may not work with this version of PyNN. The full installation instructions are available at https://nest-simulator.readthedocs.io/en/v3.4/installation/index.html/.

Now try it out:

$ cd ~
$ python
>>> import nest

            -- N E S T --
Copyright (C) 2004 The NEST Initiative

Version: 3.4
...

>>> nest.node_models
('weight_recorder', 'gauss_rate_ipn', 'lin_rate_ipn', 'sigmoid_rate_ipn', 'sigmoid_rate_gg_1998_ipn', 'tanh_rate_ipn', ...)

Check that 'aeif_cond_alpha' is in the list of models. If it is not, you may need to install a newer version of the GNU Scientific Library and then recompile NEST.

Now test NEST together with PyNN using something like the following:

>>> import pyNN.nest as sim
>>> sim.setup()
>>> sim.end()

Warning

If you get a warning “Unable to install NEST extensions. Certain models may not be available” then ensure the program nest-config is on your system PATH. If you still get this message even after adding the directory containing nest-config to the PATH, then you will still be able to use pyNN.nest, just a small number of models will not be available.

Installing Brian2

Instructions for downloading and installing Brian 2 are available from https://briansimulator.org/install/. Note that this version of PyNN works with Brian 2. If you need to use Brian 1, try PyNN 0.9.6.

Installing Arbor

Instructions for installing Arbor are available from https://docs.arbor-sim.org/en/latest/install.

Warning

At present, Arbor only works with the experimental multi-compartment neuron models; support for point neuron models is planned for the next release.