Install dependencies
Compiling and running NEURON requires several tools; how they are installed depends on the Linux distribution.
For Ubuntu 18.04, 20.04:
sudo apt install libx11-dev git bison flex automake libtool libxext-dev libncurses-dev python3-dev xfonts-100dpi cython3 libopenmpi-dev python3-scipy make zlib1g-dev
For CentOS 7
sudo yum -y install epel-release
sudo yum -y install python34-devel.x86_64
sudo yum -y install libX11-devel
sudo yum -y group install "Development Tools"
sudo yum -y install xorg-x11-fonts-100dpi
sudo yum -y install python34-Cython
sudo yum -y install python34-pip
# have to upgrade pip because the version provided by python34-pip
# does not check the installed Python version and will attempt to
# install modules that require newer versions of Python
sudo pip3 install --upgrade pip
sudo pip3 install scipy
sudo yum -y install ncurses-devel
sudo yum -y install openmpi openmpi-devel
sudo yum -y install libXext libXext-devel
export PATH=$PATH:/usr/lib64/openmpi/bin
sudo PATH=$PATH:/usr/lib64/openmpi/bin pip3 install mpi4py
Download code if you haven't already
Development version:
git clone https://github.com/neuronsimulator/nrn
git clone https://github.com/neuronsimulator/iv
If you're going this route, you must use autotools to build configure scripts:
cd nrn
./build.sh
cd ../iv
./build.sh
cd ..
Standard release
Download NEURON: https://neuron.yale.edu/ftp/neuron/versions/v7.7/nrn-7.7.tar.gz
Download InterViews: https://neuron.yale.edu/ftp/neuron/versions/v7.7/iv-19.tar.gz
Note that InterViews is NEURON's graphical library; you will not be able to use NEURON's GUI without it, and compiling without it requires modifications to the instructions below.
Uncompress (use tar -zxvf nrn-7.7.tar.gz
etc) both NEURON and InterViews; rename the folders to nrn and iv, respectively.
Setup InterViews (NEURON graphics)
This must be done before NEURON can be compiled.
cd iv ./configure make -j sudo make install -j cd ..
Setup NEURON
cd nrn ./configure --with-iv --with-paranrn --with-nrnpython=python3 make -j sudo make install -j cd src/nrnpython sudo python3 setup.py install
(python3
may be replaced with python2
in the above, if desired.)
Add NEURON to your PATH
Add the following line to ~/.bashrc
:
export PATH=$PATH:/usr/local/nrn/x86_64/bin
Test NEURON
In a new terminal window, or after otherwise updating your paths, you should be able to get a NEURON prompt and GUI controls via:
python3
and then from inside Python:
from neuron import h, gui
Other options
Installation without the GUI
- Don't bother to download, configure, make, or install InterViews.
- The "configure" command for NEURON becomes ./configure --with-nrnpython --with-paranrn --without-iv
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).