NEURON - hasselmonians/knowledge-base GitHub Wiki

NEURON is an extensive framework for simulating neuronal models. It is especially useful for modeling complex branching morphologies. Though not the easiest software to use, nor the fastest, it is flexible to handle almost any use-case, provided the user knows what they're doing.

Installing

NEURON can be difficult to install. These instructions will work for any operating system.

Say you want to put your installation in the folder $HOME/code/NEURON. If you want to put it somewhere else, replace this absolute path in the following commands with some other absolute path. If you don't specify a --prefix when configuring, things end up in /usr/local

  1. Acquire the InterViews and NEURON source code.
mkdir $HOME/code/NEURON
cd $HOME/code/NEURON
git clone https://github.com/neuronsimulator/iv
git clone https://github.com/neuronsimulator/nrn
  1. Follow these commands. The NEURON installation is incorrect and the README directs you to (different) incorrect instructions.

For InterViews:

cd $HOME/code/NEURON/iv
./build.sh
./configure --prefix=$HOME/code/NEURON/iv
make
make install

For NEURON:

If you want to use Python as an alternative interpreter, you will need the --with-nrnpython option. The argument is the soft-link to the Python program (i.e. type which python to find it).

./build.sh # alternatively you can try sh build.sh
./configure --prefix=$HOME/code/NEURON/nrn --with-iv=$HOME/code/NEURON/iv --with-nrnpython=/usr/bin/python
make
make install
  1. You can test NEURON by running its demonstration program
./config.guess
  1. You will need to update your PATH environment variable. For Linux, add the following line to the .bashrc file (if you are using bash). Obviously, the absolute path will be different if it was different above.
source $HOME/code/NEURON/nrnenv

You will also need a nrnenv file.

touch $HOME/code/NEURON/nrnenv
# open file and add
export IV=$HOME/code/NEURON/iv
export N=$HOME/code/NEURON/nrn
# for this concrete example, we assume hostcpu is i686
export CPU=i686
export PATH="$IV/$CPU/bin:$N/$CPU/bin:$PATH"

Importing NEURON into Python

To install NEURON package to the Python site-packages directory (usually requires root access).

cd $HOME/code/NEURON/nrn/src/nrnpython
python setup.py install

If you do not have root access, you can --prefix``. This will install the NEURON package to $HOME/local/lib/python/site-packages`.

python setup.py install --prefix=$HOME/local

You will then need to add this directory to the PYTHONPATH environment variable.

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