nrniv -python (uses wrong python version)

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

Moderator: hines

Post Reply
davidlmorton
Posts: 10
Joined: Fri Apr 11, 2008 11:07 pm

nrniv -python (uses wrong python version)

Post by davidlmorton » Fri Apr 11, 2008 11:17 pm

When I run nrniv -python it uses python 2.3 instead of the 2.4 where I have numpy installed. I've been working on getting neuron and python working together for a while now on mac osx 10.4 ppc.

I build with:
./configure --prefix=`pwd` --with-iv=$N/iv-17 --with-nrnpython=/Library/Frameworks/Python.framework/Versions/2.4/Resources/Python.app/Contents/MacOS/python --enable-carbon --enable-numpy PYLIB=-lpython PYLIBLINK=-lpython

Everything builds and installs fine. I had a silly problem with one of the dylibs being looked for in the wrong place and I fixed that with a symbolic link (probably a better way but it worked.)

When I run python it runs the 2.4 version, and all the output in the /.configure seems to be indicating that the 2.4 version would be used, but when I run nrniv -python it can't find numpy and when I import sys and check sys.version it is the 2.3 version.

Any help would be greatly appreciated,

David Morton

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

Post by hines » Sat Apr 12, 2008 11:00 am

The goal is to have --with-nrnpython=... figure out everything needed (by asking python) for all versions of linux, mswin, mac, and python. I haven't been able to meet it yet... You can work around the problem by being explicit for everything just like I do for the BlueGene. e.g on that machine I use the options

Code: Select all

'--with-nrnpython' 'PYLIBDIR=/home/hines/python/pyobj' 'PYINCDIR=/home/hines/python/python/include/python2.5' 'PYVER=python2.5.1' 'EXTRAPYLIBS=-lm -lc -lnss_files -lnss_dns -lresolv' 'PYLIB=-L/home/hines/python/pyobj -lpython2.5 -lm -lc -lnss_files -lnss_dns -lresolv'

davidlmorton
Posts: 10
Joined: Fri Apr 11, 2008 11:07 pm

I don't understand all the options

Post by davidlmorton » Sat Apr 12, 2008 4:28 pm

I'm not terribly familiar with these configure options and I couldn't figure out what -L</some/path> and -l<something> were supposed to be doing. I've tried a number of feeble combinations with no success. Here is what I've tried:

./configure --prefix=`pwd` --with-iv=$N/iv-17 '--with-nrnpython' 'PYLIBDIR=/Library/Frameworks/Python.framework/Versions/2.4/lib' 'PYINCDIR=/Library/Frameworks/Python.framework/Versions/2.4/include/python2.4' 'PYVER=python2.4.4' --enable-carbon --enable-numpy 'PYLIB=-L/Library/Frameworks/Python.framework/Versions/2.4/lib -lpython2.4 -lm -lc -lnss_files -lnss_dns -lresolv' 'EXTRAPYLIBS=-lm -lc -lnss_files -lnss_dns -lresolv'


./configure --prefix=`pwd` --with-iv=$N/iv-17 '--with-nrnpython' 'PYLIBDIR=/Library/Frameworks/Python.framework/Versions/2.4/lib' 'PYINCDIR=-lpython2.4' 'PYVER=python2.4.4' --enable-carbon --enable-numpy 'PYLIB=-lpython2.4'


./configure --prefix=`pwd` --with-iv=$N/iv-17 '--with-nrnpython' 'PYLIBDIR=/Library/Frameworks/Python.framework/Versions/2.4/lib' 'PYINCDIR=/Library/Frameworks/Python.framework/Versions/2.4/include/python2.4' 'PYVER=python2.4.4' --enable-carbon --enable-numpy 'PYLIB=/Library/Frameworks/Python.framework/Versions/2.4/lib'


Always with the result:

Python binary found (/Library/Frameworks/Python.framework/Versions/2.4/Resources/Python.app/Contents/MacOS/python)
checking nrnpython configuration... 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=-L/Library/Frameworks/Python.framework/Versions/2.4/lib
or
PYINCDIR=/Library/Frameworks/Python.framework/Versions/2.4/include/python2.4

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

Post by hines » Sat Apr 12, 2008 5:10 pm

Your first case was close except for
the bluegene specific libraries. Try

Code: Select all

./configure --prefix=`pwd` --with-iv=$N/iv-17 '--with-nrnpython' 'PYLIBDIR=/Library/Frameworks/Python.framework/Versions/2.4/lib' 'PYINCDIR=/Library/Frameworks/Python.framework/Versions/2.4/include/python2.4' 'PYVER=python2.4.4' --enable-carbon --enable-numpy PYLIB='-L/Library/Frameworks/Python.framework/Versions/2.4/lib -lpython2.4'
If you continue to have problems, let me know how you installed python2.4 and I'll do the same and figure out a configuration that links against it. In fact, let me know anyway and I'll see if I can figure out an improvement to the nrn/m4/nrnpython.m4 macros so that --with-nrnpython=<working python> does everything automatically.[/quote]

davidlmorton
Posts: 10
Joined: Fri Apr 11, 2008 11:07 pm

Same ole

Post by davidlmorton » Sat Apr 12, 2008 5:50 pm

I tried the configure as you stated last and no luck. I installed python from python.org following these links. I used 2.4 because it had precompiled binaries for numpy, scipy and matplotlib which I want to use.

http://www.pythonmac.org/packages/py24-fat/index.html


After installing I ran:

"/Applications/MacPython 2.4/Update Shell Profile.command"

to add the directory to the beginning of my path. Other than that I've got the latest svn copy of nrnpy (revision 45) and I've got iv-17 as you can see.


Thanks a bunch for helping me out,

David

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

Post by hines » Sat Apr 12, 2008 9:03 pm

I experienced the same problem you did. The following configuration
built with 2.4.4

Code: Select all

"/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'

After I installed python, 2.4.2 was the default version that runs from
a terminal.

davidlmorton
Posts: 10
Joined: Fri Apr 11, 2008 11:07 pm

Thanks

Post by davidlmorton » Sat Apr 12, 2008 11:22 pm

Beautiful, thanks. Built and runs okay as far as I can tell.

David

Post Reply