Download and Install

Use of PyNN requires that you have Python (version 2.5, 2.6 or 2.7) and a recent version of the numpy package installed, plus at least one of the supported simulators: NEURON, NEST, PCSIM or Brian.

Installing PyNN

The easiest way to get PyNN is to download the latest source distribution from the PyNN download page, then run the setup script, e.g.:

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

This will install it to your python site-packages directory, and may require root privileges. If you wish to install it elsewhere use the --prefix or --home option, and set the PYTHONPATH environment variable accordingly (see above). 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:

>>> from pyNN.nest import *
>>> setup()
>>> end()

(This assumes you have NEST installed).

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:

>>> from pyNN.neuron import *
NEURON -- Release 7.1 (359:7f113b76a94b) 2009-10-26
Duke, Yale, and the BlueBrain Project -- Copyright 1984-2008
See http://www.neuron.yale.edu/credits.html

loading membrane mechanisms from /home/andrew/dev/pyNN/neuron/nmodl/i686/.libs/libnrnmech.so
Additional mechanisms from files
 adexp.mod alphaisyn.mod alphasyn.mod expisyn.mod gsfa_grr.mod hh_traub.mod netstim2.mod
 refrac.mod reset.mod stdwa_guetig.mod stdwa_softlimits.mod stdwa_songabbott.mod stdwa_symm.mod
 tmgsyn.mod tmisyn.mod vecstim.mod

If your model relies on other NMODL mechanisms, call the load_mechanisms() function with the path to the directory containing the .mod files.

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-mpi, i.e.:

$ ./configure --prefix=`pwd` --with-nrnpython --with-mpi
$ 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.1 (359:7f113b76a94b) 2009-10-26
Duke, Yale, and the BlueBrain Project -- Copyright 1984-2008
See http://www.neuron.yale.edu/credits.html

>>> import hoc
>>> import nrn

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

$ cd src/nrnpython
# python setup.py install

Note that the latter step requires running as root and will install to your global python site-packages directory. If you would prefer to install it locally, replace the last step with:

$ python setup.py install --prefix=~

which will install into ~/lib/python2.5/site-packages/ (or the equivalent for other Python versions; for more fine-grained control over where the package is installed, see the distutils documentation), then add this directory to your PYTHONPATH:

$ export PYTHONPATH=$PYTHONPATH:~/lib/python2.5/site-packages

Now test everything worked:

$ python
>>> import neuron
NEURON -- Release 7.1 (359:7f113b76a94b) 2009-10-26
Duke, Yale, and the BlueBrain Project -- Copyright 1984-2008
See http://www.neuron.yale.edu/credits.html

>>>

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

Installing NEST and PyNEST

NEST can be downloaded from http://www.nest-initiative.org/index.php/Software:Download. Installation instructions are available in the file INSTALL, which you can find in the source package, or at http://www.nest-initiative.org/index.php/Installation.

On Linux, most Unix variants and Mac OS X, installation is usually as simple as:

$ ./configure --with-mpi
$ make
# make install

This will install PyNEST to your Python site-packages directory, and may require root privileges. If you wish to install it elsewhere, see the full installation instructions. Make sure you have the GNU Scientific Library (GSL) installed, otherwise some PyNN standard models (e.g. IF_cond_exp) will not be available.

Now try it out:

$ cd ~
$ python
>>> import nest

              -- N E S T --

  Copyright (C) 2004 The NEST Initiative
  Version 2.2.1 Jan 30 2013 10:22:11

...
>>> nest.Models()
['ac_generator', 'aeif_cond_alpha', 'aeif_cond_exp', 'cont_delay_synapse',
'correlation_detector', 'dc_generator', 'gamma_sup_generator',
'ginzburg_neuron', 'hh_cond_exp_traub', 'hh_psc_alpha', 'ht_neuron',
'ht_synapse', 'iaf_cond_alpha', 'iaf_cond_alpha_mc', 'iaf_cond_exp',
'iaf_cond_exp_sfa_rr', 'iaf_neuron', 'iaf_psc_alpha', 'iaf_psc_alpha_canon',
'iaf_psc_alpha_presc', 'iaf_psc_delta', 'iaf_psc_delta_canon',
'iaf_psc_exp', 'iaf_psc_exp_ps', 'iaf_tum_2000', 'izhikevich',
'mat2_psc_exp', 'mip_generator', 'multimeter', 'noise_generator',
'parrot_neuron', 'parrot_neuron_ps', 'poisson_generator',
'poisson_generator_ps', 'pp_psc_delta', 'ppd_sup_generator',
'pulsepacket_generator', 'sli_neuron', 'smp_generator', 'spike_detector',
'spike_generator', 'static_synapse', 'static_synapse_hom_wd',
'stdp_dopamine_synapse', 'stdp_facetshw_synapse_hom', 'stdp_pl_synapse_hom',
'stdp_synapse', 'stdp_synapse_hom', 'step_current_generator', 'subnet',
'topology_layer_free', 'topology_layer_free_3d', 'topology_layer_grid',
'topology_layer_grid_3d', 'tsodyks2_synapse', 'tsodyks_synapse',
'voltmeter', 'volume_transmitter']

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 PCSIM

PCSIM is available to download from http://sourceforge.net/projects/pcsim/:

For compilation instructions, see the files in the HowTos directory.

Installing Brian

Instructions for downloading and installing Brian are available from http://www.briansimulator.org/download/.