problem building NEURON 7.3 with python3 on Ubuntu 12.04

Post Reply
lneisenman
Posts: 20
Joined: Wed Dec 16, 2009 10:26 am

problem building NEURON 7.3 with python3 on Ubuntu 12.04

Post by lneisenman » Wed Apr 03, 2013 10:27 am

I ran into an issue trying to build NEURON 7.3 on Ubuntu 12.04 64bit with python3 using the following configure command

./configure --prefix=`pwd` --with-iv --with-nrnpython=python3

I got the following error:

Python binary found (/usr/bin/python3)
checking nrnpython configuration... get_python_version() '3.2'
sys.version_info[0] '3'
get_python_inc(1) '/usr/include/python3.2mu'
get_config_var('LIBS') '-lpthread -ldl -lutil'
get_config_var('LINKFORSHARED') '-Xlinker -export-dynamic -Wl,-O1 -Wl,-Bsymbolic-functions'
get_config_var('LIBDIR') '/usr/lib'
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/usr/lib -lpython3.2 -lpthread -ldl -lutil -Xlinker -export-dynamic -Wl,-O1 -Wl,-Bsymbolic-functions -R/usr/lib
or
PYLIBDIR=/usr/lib
or
PYLIBLINK=-L/usr/lib -lpython3.2 -lpthread -ldl -lutil
or
PYINCDIR=/usr/include/python3.2mu

It turns out that the problem is with the '-lpython3.2'. On my system it needs to be '-lpython3.2mu'. Using a configure statement that explicitly defines PYLIB, PYLIBDIR, PYLIBLINK, and PYINCDIR solves the problem.

./configure --prefix=`pwd` --with-iv --with-nrnpython=python3 PYLIB='-L/usr/lib -lpython3.2mu' PYLIBDIR='/usr/lib' PYLIBLINK='-L/usr/lib -lpython3.2mu' PYINCDIR='/usr/include/python3.2mu'

I'm not sure if I inadvertently did something to my system or if this is an issue for anyone trying to use py3 on Ubuntu 12.04.

Configuring for python2 using

./configure --prefix=`pwd` --with-iv --with-nrnpython=python

works without having to specify library locations.

Larry

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

Re: problem building NEURON 7.3 with python3 on Ubuntu 12.04

Post by hines » Fri Apr 05, 2013 10:01 am

I'm a little fearful about breaking things and making the wrong choice. I see from
from distutils.sysconfig import *
for i in get_config_vars():
a = get_config_var(i)
if '2mu' in str(a):
print (i, get_config_var(i))

LIBPL /usr/lib/python3.2/config-3.2mu
LDVERSION 3.2mu
SO .cpython-32mu.so
INCLDIRSTOMAKE /usr/include /usr/include /usr/include/python3.2mu /usr/include/python3.2mu
INCLUDEPY /usr/include/python3.2mu
LIBRARY libpython3.2mu.a
SOABI cpython-32mu
CONFINCLUDEPY /usr/include/python3.2mu
LDLIBRARY libpython3.2mu.so
INSTSONAME libpython3.2mu.so.1.0
BLDLIBRARY -L. -lpython3.2mu

Clearly '-lpython3.2.mu' is derivable from several of these. But which is the one, if any, which will work for all (most) python on all machines?

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

Re: problem building NEURON 7.3 with python3 on Ubuntu 12.04

Post by hines » Fri Apr 05, 2013 1:12 pm

I looked on several machines and it seems that get_config_var('LIBRARY') is quite consistent configure now derives pylib from that, LIBS and LIBDIR.
http://www.neuron.yale.edu/hg/neuron/nr ... 8be04f9655
Hopefully this succeeds in more cases and does not fail where the old configure succeeded.

lneisenman
Posts: 20
Joined: Wed Dec 16, 2009 10:26 am

Re: problem building NEURON 7.3 with python3 on Ubuntu 12.04

Post by lneisenman » Tue Apr 09, 2013 9:39 am

That did the trick. Thanks.

Larry

Post Reply