NEURON 7.5 + Python 3 installation on OSX 10.12.5
Posted: Tue Oct 17, 2017 11:36 am
Since the instructions on the webpage didn't work for me, I want to document here commands that allowed me to install NEURON 7.5 from source with Python 3 support on OSX 10.12.5. I hope this will be useful to someone.
For simplicity, this installation excludes Interviews, MPI support, and everything else you don't really need if you just want to use NEURON to compile and run serial simulations. I may edit this in the future should the need arise.
1) Put this in your ~/.bash_profile and then start a new shell
2) Cleanup stuff
3) Use Python 2 to install mercurial since it is one of the 1% of things that still doesn't work in Python 3
4) Download and install NEURON
5) Test your installation
Note: You are likely to get a segmentation fault (this has happened on 3 Macs with various installations of NEURON) if you try importing NEURON anywhere other than the very top of your python program. For example, if you are in an interpreter, let "import neuron" be your *very first* command. Then other "import neuron" commands in your scripts will just be ignored as the module will already be loaded.
For simplicity, this installation excludes Interviews, MPI support, and everything else you don't really need if you just want to use NEURON to compile and run serial simulations. I may edit this in the future should the need arise.
1) Put this in your ~/.bash_profile and then start a new shell
Code: Select all
export PYTHONHOME=/path/to/your/python3 # For me it was /Users/rgerkin/miniconda3
export NEURON_HOME=/Applications/NEURON-7.5
export LD_LIBRARY_PATH=$PYTHONHOME/lib
export PATH=$PATH:$NEURON_HOME/nrn/x86_64/bin
export PYTHONPATH=$PYTHONPATH:$NEURON_HOME/nrn/lib/python/
Code: Select all
rm -rf $NEURON_HOME # Get rid of old NEURON installations
rm -rf $PYTHONHOME/lib/site-packages/neuron # Get rid old old NEURON code installations
Code: Select all
export PYTHON2 = /path/to/your/python2
$PYTHON2/bin/pip install mercurial
Code: Select all
$PYTHON2/bin/hg clone http://www.neuron.yale.edu/hg/neuron/nrn
cd nrn
sh build.sh
./configure --prefix=$NEURON_HOME/nrn --with-nrnpython=python3 # don't use "dynamic" since it doesn't actually work
make
sudo make install
Code: Select all
nrniv
python -c "import neuron"