Compiling NEURON under UNIX/Linux

If you got development code from the git repository

Jump to step 2 below.

If you downloaded gzipped tar files

The following instructions are suitable for most users, who just want a complete installation of NEURON i.e. including its GUI. For installation with Python as an alternative interpreter, or installation that omits NEURON's GUI, see Other options below.

1. Create a neuron directory in your home directory, put the gzipped source files in it, and expand them.

Start by opening an rxvt window, then

cd $HOME
mkdir neuron
mv iv-mm.tar.gz neuron
mv nrn-nn.tar.gz neuron
cd neuron
tar xzf iv-mm.tar.gz
tar xzf nrn-nn.tar.gz
# renaming the new directories iv and nrn makes life simpler later on
mv iv-mm iv
mv nrn-nn nrn

2. configure, make, and install InterViews

In the rxvt window,

cd iv
./configure --prefix=`pwd`
make install

./configure fails
This is rare and generally means something is not quite right about the development environment on your machine. Take a look at the config.log file and see if you can diagnose why the last test gave a fatal error. Often it is because the c++ compiler/linker cannot find important libraries. Most errors can be worked around with environment variables such as LD_LIBRARY_PATH.
neurondemo fails
You may need the LD_LIBRARY_PATH environment variable. In general there should no longer be any requirement for CPU, NEURONHOME, or LD_LIBRARY_PATH environment variables. However, if you have trouble launching NEURON it may be because I am not using libtool generically in the configuration files and need an explicit LD_LIBRARY_PATH for InterViews or for the compiler libraries. Try adding a
setenv LD_LIBRARY_PATH "${HOME}/neuron/nrn/hostcpu/lib"

statement to your nrnenv file.


3. configure and make NEURON

cd ..
cd nrn
./configure --prefix=`pwd` --with-iv=$HOME/neuron/iv
make install


4. Test NEURON by running its "demonstration" program

./config.guess #your hostcpu is printed in the form hostcpu-vendor-osversion
# for this concrete example, we assume it is i686


5. Update your PATH environment variable. For Linux, add the following line to the .bashrc file

source $HOME/neuron/nrnenv

and create an nrnenv file in $HOME/neuron with the contents

export IV=$HOME/neuron/iv
export N=$HOME/neuron/nrn
# for this concrete example, we assume hostcpu is i686
export CPU=i686
export PATH="$IV/$CPU/bin:$N/$CPU/bin:$PATH"

Other options

Installation with Python as an alternative interpreter

Assuming that the path to the Python interpreter is /usr/bin/python, to install with Python as an alternative interpreter, change the NEURON configure command to

./configure --prefix=`pwd` --with-iv=$HOME/neuron/iv --with-nrnpython=/usr/bin/python

Adding --with-numpy to the end of this configure command will also include NumPy. Then run make and make install, and you will be able to start NEURON with Python as an alternative interpreter via the command line

nrniv -python


nrngui -python

If instead you want to import NEURON into Python, there is one more step after make install: build and install the NEURON shared library for Python by

cd src/nrnpython
python install

This installs the neuron package to the Python site-packages directory, so it usually requires root access. If you do not have root access, you may use --prefix to place the neuron package in your home directory tree, like so:

python install --prefix=$HOME/local

This will install the neuron package to $HOME/local/lib/python/site-packages (i.e. in a subtree of your home directory). You will then have to add this directory to the PYTHONPATH environment variable:

export PYTHONPATH=$PYTHONPATH:$HOME/local/lib/python/site-packages

For more information about installing NEURON and using it with Python, see Hines, M.L., Davison, A.P. and Muller, E. NEURON and Python. Frontiers in Neuroinformatics 3:, 1, 2009.

Installation without the GUI

  • Ignore the instructions about iv*gz, export IV=..., and don't bother to add $IV/$CPU/bin to the PATH.
  • Don't bother to configure, make, and install InterViews.
  • The "configure" command for NEURON becomes ./configure --prefix=`pwd`

Installation for distributed simulations of cells or networks

There is no need to use any special configure options in order to do multithreaded execution on multicore workstations.


In order to perform distributed simulations of cells or networks (i.e. simulations in which the model is distributed across multiple processors, ranging from multicore workstations to parallel supercomputers), MPI must be installed, and the "configure" command for NEURON should include the option


For more information about configuring and using NEURON with MPI see as well as

Hines ML, N Carnevale T 2008.  Translating network models to parallel hardware in NEURON. Journal of neuroscience methods. 169:425–455. (preprint available)

More explanations and complications

You may not ever need to know any of these things--but just in case  .  .  .

1. Where things are installed

The --prefix option in the configure statement controls where the installation will be placed. If you don't specify a prefix, a default installation directory is used. For InterViews this is /usr/local/iv, and for NEURON it is /usr/local/nrn

2. Where the NEURON installation looks for InterViews

This is controlled by the --with-iv option when you execute ./configure . . . in the nrn-n.n directory. If you don't specify a --with-iv, it looks first in prefix/.../iv and then in /usr/local/iv.

3. Putting things in other locations

Other configure options are also available. You can also build in a different directory than the sources, e.g. because you have different cpu's sharing the same sources, or because you desire several versions with different configure options (profiling, non-shared, code coverage, with and without Python).