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:
Optional dependencies are:
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 would prefer to install manually, download the latest source distribution, then run the setup script, e.g.:
$ tar xzf PyNN-0.11.0.tar.gz $ pip install ./PyNN-0.11.0
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
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. 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.
For NEURON, PyNN will compile PyNN-specific membrane mechanisms the first time you import the
>>> import pyNN.neuron as sim
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,
$ ./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.
Installing NEST and PyNEST¶
NEST 3.4 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', ...)
'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.
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.