Skip to content

Instantly share code, notes, and snippets.

@clbarnes
Last active February 29, 2024 13:11
Show Gist options
  • Save clbarnes/d6ca94e793d3130c7d0d5596e593ad11 to your computer and use it in GitHub Desktop.
Save clbarnes/d6ca94e793d3130c7d0d5596e593ad11 to your computer and use it in GitHub Desktop.
These instructions are for installing NEURON and NetPyNE with linux and a conda environment.

Install instructions

These instructions are for installing NEURON and NetPyNE with linux and a conda environment.

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

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

configure, make, and install InterViews

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

Set up your python environment

conda create -n neuron ipython pip numpy
source activate neuron

configure and make NEURON

cd ..
cd nrn
sudo apt-get install libopenmpi-dev openmpi-doc openmpi-bin  # install MPI libraries
./configure --prefix=`pwd` --with-iv=$HOME/neuron/iv --with-nrnpython=$HOME/anaconda3/envs/neuron/bin/python --with-paranrn
make
make install

Test NEURON by running its "demonstration" program

x86_64/bin/neurondemo

Replace x86_64 with your CPU type (e.g. i686 if necessary)

Update your PATH environment variable.

Create an nrnenv file in $HOME/neuron with the contents

export IV=$HOME/neuron/iv
export N=$HOME/neuron/nrn
# replace with hostcpu, e.g. i686, if necessary
export CPU=x86_64
export PATH="$IV/$CPU/bin:$N/$CPU/bin:$PATH"

Add the following line to the .bashrc file

source $HOME/neuron/nrnenv

Restart your terminal, or log out and log in again

Install the NEURON module for python

source activate neuron
cd ~/neuron/nrn/src/nrnpython
python setup.py install

Install NetPyNE

pip install netpyne

or if that doesn't work

cd ~/neuron
git clone git@github.com:Neurosim-lab/netpyne.git
cd netpyne
python setup.py install

Make sure everything works!

neurondemo
oc> quit()
nrngui
oc> quit()
nrniv
oc> quit()

Clone the existing environment if required

conda create -n neuron2 --clone neuron
source activate neuron2
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment