Neuron + Python on Mac OS-X, Enthought Python distribution
Posted: Tue Feb 10, 2009 10:09 pm
I have been using the Enthought Python distribution - which includes matplotlib (pylab), numpy, scipy, and a lot of other stuff that makes it convenient. A free distribution is available for academic use.
However it didn't want to cooperate with the standard nrnpython install, so here are my notes for making it work - there were only 2 small changes, but this might help someone.
Installing nrn with python on mac os x (version 7.0 of NEURON).
1. compile from source... otherwise the python include library doesn't seem to get found***. The default ./configure yields:
get_config_var('LINKFORSHARED') '-u _PyMac_Error Python.framework/Versions/4.1.30101/Python'
checking if python include files and libraries work... configure: error: could not run a test that used the python library.
Examine config.log to see error details. Something wrong with
PYLIB=-u _PyMac_Error Python.framework/Versions/4.1.30101/Python
or
PYLIBDIR=
or
PYLIBLINK=-u _PyMac_Error Python.framework/Versions/4.1.30101/Python
or
PYINCDIR=/Library/Frameworks/Python.framework/Versions/4.1.30101/include/python2.5
(I have seen this on 2 different systems).
Per Hines on 4/12/08, at neuron bb with python, use the following to configure:
/Users/hines/neuron/nrn/configure '--prefix=/Applications/NEURON-6.2/nrn' '--srcdir=/Users/hines/neuron/nrn' '--with-iv=/Applications/NEURON-6.2/iv' '--enable-carbon' '--with-nrnpython' '--enable-UniversalMacBinary' PYLIBLINK='-framework Python' PYLIB='-framework Python'
except that I used (nrn is on the desktop; your directories might be different):
/Users/myhomedir/Desktop/nrn-7.0/configure '--prefix=/Applications/NEURON-7.0/nrn' '--srcdir=/Users/myhomedir/Desktop/nrn-7.0' '--with-iv=/Applications/NEURON-7.0/iv' '--enable-carbon' '--with-nrnpython' '--enable-UniversalMacBinary' PYLIBLINK='-framework Python' PYLIB='-framework Python'
Now configure completes without errors.
2. make and install as usual
3. Then we have to jump into src/nrnpython and do the setup, but "python setup.py install" fails:
lytle:nrnpython pbmanis$ python setup.py install
Error:
NEURON configure time python: /Library/Frameworks/Python.framework/Versions/Current/bin/python
Python presently executing setup.py: /Library/Frameworks/Python.framework/Versions/4.1.30101/Resources/Python.app/Contents/MacOS/Python
These do not match, and the should!
(yes, there is a typo in setup.py: (they should!")
So edit setup.py with the "presently executing" replacing nrnpython_exec as follows:
# nrnpython_exec = "/Library/Frameworks/Python.framework/Versions/Current/bin/python" # old
nrnpython_exec = "/Library/Frameworks/Python.framework/Versions/4.1.30101/Resources/Python.app/Contents/MacOS/Python"
(That line should point to whatever is "presently executing setup.py" - it could be different.)
It works!
--Paul
***Note: It may seem obvious, but make sure you compile Interviews and Neuron for the same platform (e.g., '--enable-UniversalMacBinary' ). I forgot to do this with Interviews on a clean install the other day, and spent a few hours trying to figure out where the build went wrong.
However it didn't want to cooperate with the standard nrnpython install, so here are my notes for making it work - there were only 2 small changes, but this might help someone.
Installing nrn with python on mac os x (version 7.0 of NEURON).
1. compile from source... otherwise the python include library doesn't seem to get found***. The default ./configure yields:
get_config_var('LINKFORSHARED') '-u _PyMac_Error Python.framework/Versions/4.1.30101/Python'
checking if python include files and libraries work... configure: error: could not run a test that used the python library.
Examine config.log to see error details. Something wrong with
PYLIB=-u _PyMac_Error Python.framework/Versions/4.1.30101/Python
or
PYLIBDIR=
or
PYLIBLINK=-u _PyMac_Error Python.framework/Versions/4.1.30101/Python
or
PYINCDIR=/Library/Frameworks/Python.framework/Versions/4.1.30101/include/python2.5
(I have seen this on 2 different systems).
Per Hines on 4/12/08, at neuron bb with python, use the following to configure:
/Users/hines/neuron/nrn/configure '--prefix=/Applications/NEURON-6.2/nrn' '--srcdir=/Users/hines/neuron/nrn' '--with-iv=/Applications/NEURON-6.2/iv' '--enable-carbon' '--with-nrnpython' '--enable-UniversalMacBinary' PYLIBLINK='-framework Python' PYLIB='-framework Python'
except that I used (nrn is on the desktop; your directories might be different):
/Users/myhomedir/Desktop/nrn-7.0/configure '--prefix=/Applications/NEURON-7.0/nrn' '--srcdir=/Users/myhomedir/Desktop/nrn-7.0' '--with-iv=/Applications/NEURON-7.0/iv' '--enable-carbon' '--with-nrnpython' '--enable-UniversalMacBinary' PYLIBLINK='-framework Python' PYLIB='-framework Python'
Now configure completes without errors.
2. make and install as usual
3. Then we have to jump into src/nrnpython and do the setup, but "python setup.py install" fails:
lytle:nrnpython pbmanis$ python setup.py install
Error:
NEURON configure time python: /Library/Frameworks/Python.framework/Versions/Current/bin/python
Python presently executing setup.py: /Library/Frameworks/Python.framework/Versions/4.1.30101/Resources/Python.app/Contents/MacOS/Python
These do not match, and the should!
(yes, there is a typo in setup.py: (they should!")
So edit setup.py with the "presently executing" replacing nrnpython_exec as follows:
# nrnpython_exec = "/Library/Frameworks/Python.framework/Versions/Current/bin/python" # old
nrnpython_exec = "/Library/Frameworks/Python.framework/Versions/4.1.30101/Resources/Python.app/Contents/MacOS/Python"
(That line should point to whatever is "presently executing setup.py" - it could be different.)
It works!
--Paul
***Note: It may seem obvious, but make sure you compile Interviews and Neuron for the same platform (e.g., '--enable-UniversalMacBinary' ). I forgot to do this with Interviews on a clean install the other day, and spent a few hours trying to figure out where the build went wrong.