Neuron + Python on Mac OS-X, Enthought Python distribution

When Python is the interpreter, what is a good
design for the interface to the basic NEURON

Moderator: hines

Post Reply
Posts: 3
Joined: Thu Jun 14, 2007 9:02 pm
Location: UNC Chapel Hill

Neuron + Python on Mac OS-X, Enthought Python distribution

Post by pbmanis »

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
PYLIBLINK=-u _PyMac_Error Python.framework/Versions/4.1.30101/Python

(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 install" fails:

lytle:nrnpython pbmanis$ python install
NEURON configure time python: /Library/Frameworks/Python.framework/Versions/Current/bin/python
Python presently executing /Library/Frameworks/Python.framework/Versions/4.1.30101/Resources/
These do not match, and the should!

(yes, there is a typo in (they should!")

So edit 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/"

(That line should point to whatever is "presently executing" - it could be different.)

It works!


***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.
Posts: 2
Joined: Fri Jan 01, 2010 5:43 pm

Re: Neuron + Python on Mac OS-X, Enthought Python distribution

Post by nsteinme »

Hi, just wanted to say thank you for posting this information - I needed it to complete the installation correctly, and can't even begin to wonder how much of my time I would have wasted trying to figure out the bit about editing "". You saved my day!

Re: Neuron + Python on Mac OS-X, Enthought Python distributi

Post by Prokopiou »


Im also trying to put together Enthought (Version 7.2) and Neuron on a Mac (Version 10.7.3). I tried using what is said in this post but it doesn't seem to work. Then I noticed the post is kind of old so is there a update of this procedure that must be followed with newer versions?

This is the output I get if it is of any help:

Code: Select all

yn1064-103:~ andreasprokopiou$ /Users/andreasprokopiou/Desktop/nrn-7.2/configure '--prefix=/Applications/NEURON-7.2/nrn' '--srcdir=/Users/andreasprokopiou/Desktop/nrn-7.2' '--with-iv=/Applications/NEURON-7.2/iv' '--enable-carbon' '--with-nrnpython' '--enable-UniversalMacBinary' PYLIBLINK='-framework Python' PYLIB='-framework Python'
configure: WARNING: unrecognized options: --enable-carbon
checking for a BSD-compatible install... /usr/bin/install -c
checking whether build environment is sane... yes
checking for a thread-safe mkdir -p... /Users/andreasprokopiou/Desktop/nrn-7.2/install-sh -c -d
checking for gawk... no
checking for mawk... no
checking for nawk... no
checking for awk... awk
checking whether make sets $(MAKE)... yes
checking build system type... x86_64-apple-darwin11.3.0
checking host system type... x86_64-apple-darwin11.3.0
checking for style of include used by make... GNU
checking for g++... g++
checking whether the C++ compiler works... no
configure: error: in `/Users/andreasprokopiou':
configure: error: C++ compiler cannot create executables
See `config.log' for more details

dyn1064-103:~ andreasprokopiou$ gcc -v
Using built-in specs.
Target: i686-apple-darwin11
Configured with: /private/var/tmp/llvmgcc42/llvmgcc42-2336.9~22/src/configure --disable-checking --enable-werror --prefix=/Applications/ --mandir=/share/man --enable-languages=c,objc,c++,obj-c++ --program-prefix=llvm- --program-transform-name=/^[cg][^.-]*$/s/$/-4.2/ --with-slibdir=/usr/lib --build=i686-apple-darwin11 --enable-llvm=/private/var/tmp/llvmgcc42/llvmgcc42-2336.9~22/dst-llvmCore/Developer/usr/local --program-prefix=i686-apple-darwin11- --host=x86_64-apple-darwin11 --target=i686-apple-darwin11 --with-gxx-include-dir=/usr/include/c++/4.2.1
Thread model: posix
gcc version 4.2.1 (Based on Apple Inc. build 5658) (LLVM build 2336.9.00)

Site Admin
Posts: 1602
Joined: Wed May 18, 2005 3:32 pm

Re: Neuron + Python on Mac OS-X, Enthought Python distributi

Post by hines »

The following are my latest notes about installing under Mac osx 10.7. Though not directly for enthought, they are probably relevant and I believe there is a good chance it would
work without change for enthought as long as the dynamic loader finds the enthought python library first. The intention of all this was to get a NEURON dmg that would be
generic for any Python and also for MPI whether or not Python or MPI was installed. I have not succeeded in this for MPI yet. ie. if MPI is desired, one needs to build from the
sources with openmpi already installed and in the PATH.

# assume InterViews sources in $HOME/neuron/iv
# assume NEURON sources in $HOME/neuron/nrn
# assume that you are using a Terminal window


# if configure does not exist in $SOFT/iv or $SOFT/nrn, then in those directories, execute
# sh

echo $nver
exit 0


#for Lion osx 10.7
# 64 bit, icons work, python available. If desire MPI then should install openmpi first.

# xcode command line tools must be installed. Two ways to do this.
#First way: From one can get a free version
# of Xcode 4.3.3 for Lion from the Mac App Store.
# After installing, launch Xcode 4 and menu navigate to Xcode Preferences and in the popup window
# install the "Command Line Tools".
#Second way: To avoid downloading the entire Xcode4 installer, which is about 4GB in size, one can
# install the much smaller (170 MB dmg) "Command Line Tools" separately from
# (search there for "Command Line Tools for Xcode"). You will have to login
# with your apple id.

cd $SOFT/iv
./configure --prefix=$IDIR/iv
make install

cd $SOFT/nrn
../nrn/configure --prefix=$IDIR/nrn --with-iv=$IDIR/iv --with-nrnpython=dynamic
make install
make after_install
make dmg
#is used to create a distributed version with neurondemo and (for small dmg) stripped executables.

# if mpi desired, install openmpi, make sure mpicc and mpicxx is in your PATH and add --with-paranrn
# to the ../nrn/configure line. e.g.
# from go to Download page and get the current stable release tar.gz
# after extracting, do the ./configure ; make; make install

#in order to get single click button action for x11 when entering a window,
# determine if you are using org.macosforge.xquartz.X11
# or org.x.X11 with
defaults read | grep X11
#depending on the result, then one or both of the following:
defaults write org.x.X11 wm_ffm -bool true
defaults write org.macosforge.xquartz.X11 wm_ffm -bool true
Post Reply