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 2.6, 2.7, 3.3-3.6)
  • a recent version of the NumPy package
  • the lazyarray package
  • the Neo package (>= 0.5.0)
  • at least one of the supported simulators: e.g. NEURON, NEST, or Brian.

Optional dependencies are:

  • mpi4py (if you wish to run distributed simulations using MPI)
  • either Jinja2 or Cheetah (templating engines)
  • the CSA library

Installing PyNN

Note

if using NEURON or NEST, it is easiest if you install NEURON/NEST before you install PyNN (see below).

The easiest way to get PyNN is to use pip:

$ pip install pyNN

If you are running Debian or Ubuntu, there are binary packages available. If you would prefer to install manually, download the latest source distribution, then run the setup script, e.g.:

$ tar xzf PyNN-0.9.1.tar.gz
$ cd PyNN-0.9.1
$ python setup.py install

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.

Test it using something like the following:

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

(This assumes you have NEST installed). 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.

With NEURON as the simulator, make sure you install NEURON before you install PyNN. The PyNN installation will then compile PyNN-specific membrane mechanisms, which are loaded when importing the neuron module:

>>> import pyNN.neuron as sim
NEURON -- Release 7.4 (1370:16a7055d4a86) 2015-11-09
Duke, Yale, and the BlueBrain Project -- Copyright 1984-2015
See http://www.neuron.yale.edu/neuron/credits

loading membrane mechanisms from /home/docker/dev/PyNN/pyNN/neuron/nmodl/x86_64/.libs/libnrnmech.so
Additional mechanisms from files
 adexp.mod alphaisyn.mod alphasyn.mod expisyn.mod gap.mod gsfa_grr.mod hh_traub.mod
 izhikevich.mod netstim2.mod refrac.mod reset.mod stdwa_guetig.mod stdwa_softlimits.mod
 stdwa_songabbott.mod stdwa_symm.mod stdwa_vogels2011.mod tmgsyn.mod tmisyn.mod
 tsodyksmarkram.mod vecstim.mod

If you installed PyNN before installing NEURON, or if you update your PyNN installation, you will need to manually run nrnivmodl in the pyNN/neuron/nmodl directory.

Installing NEURON

Download the sources for the latest release of NEURON, 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 -- Release 7.4 (1370:16a7055d4a86) 2015-11-09
Duke, Yale, and the BlueBrain Project -- Copyright 1984-2015
See http://www.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
NEURON -- Release 7.4 (1370:16a7055d4a86) 2015-11-09
Duke, Yale, and the BlueBrain Project -- Copyright 1984-2015
See http://www.neuron.yale.edu/neuron/credits

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

Installing NEST and PyNEST

NEST 2.12 can be downloaded from http://www.nest-simulator.org/download/. Earlier versions of NEST will not work with this version of PyNN. The full installation instructions are available in the file INSTALL, which you can find in the NEST source package, or at http://www.nest-simulator.org/installation/.

Now try it out:

$ cd ~
$ python
>>> import nest
              -- N E S T --

  Copyright (C) 2004 The NEST Initiative
  Version 2.12.0 Mar 21 2016 21:29:37
...
>>> nest.Models()
(u'ac_generator', u'aeif_cond_alpha', u'aeif_cond_alpha_RK5', u'aeif_cond_alpha_multisynapse',
...

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.

Installing Brian

Instructions for downloading and installing Brian are available from http://briansimulator.org/download/. Note that this version of PyNN works with Brian 1.4, but not with Brian 2.