NEURON does not compile with python3.3

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

Moderator: hines

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

NEURON does not compile with python3.3

Post by lneisenman » Wed May 08, 2013 2:39 pm

When trying to compile NEURON with python3.3.1 on Ubuntu 13.04 64 bit I get the following error:
(./configure --prefix=`pwd` --with-iv --with-nrnpython=python3)

make[4]: Entering directory `/home/larry/neuron/nrn/src/nrnpython'
/bin/bash ../../libtool --tag=CXX --mode=compile g++ -DHAVE_CONFIG_H -I. -I../.. -I../../src/nrnoc -I../../src/oc -I../../src/parallel -I../../src/nrnjava -I../../src/nrncvode -I../../src/ivos -I../../src/sundials -I. -I../../src/nrniv -I../../src/ivoc -I../../src/nrnoc -I../../src/oc -I../../src/nrnmpi -I../../src/gnu -I/usr/include/python3.3m -I/home/larry/neuron/iv/include -DOOP=1 -DCABLE=1 -DUSECVODE=1 -DUSEMATRIX=1 -DUSEBBS=1 -g -O2 -MT nrnpy_hoc.lo -MD -MP -MF .deps/nrnpy_hoc.Tpo -c -o nrnpy_hoc.lo nrnpy_hoc.cpp
libtool: compile: g++ -DHAVE_CONFIG_H -I. -I../.. -I../../src/nrnoc -I../../src/oc -I../../src/parallel -I../../src/nrnjava -I../../src/nrncvode -I../../src/ivos -I../../src/sundials -I. -I../../src/nrniv -I../../src/ivoc -I../../src/nrnoc -I../../src/oc -I../../src/nrnmpi -I../../src/gnu -I/usr/include/python3.3m -I/home/larry/neuron/iv/include -DOOP=1 -DCABLE=1 -DUSECVODE=1 -DUSEMATRIX=1 -DUSEBBS=1 -g -O2 -MT nrnpy_hoc.lo -MD -MP -MF .deps/nrnpy_hoc.Tpo -c nrnpy_hoc.cpp -fPIC -DPIC -o .libs/nrnpy_hoc.o
nrnpy_hoc.cpp: In function 'char* nrnpy_PyString_AsString(PyObject*)':
nrnpy_hoc.cpp:1836:44: error: 'struct PyUnicodeObject' has no member named 'str'
nrnpy_hoc.cpp:1837:32: error: 'struct PyUnicodeObject' has no member named 'length'
nrnpy_hoc.cpp:1838:24: error: 'struct PyUnicodeObject' has no member named 'length'
nrnpy_hoc.cpp:1842:10: error: 'struct PyUnicodeObject' has no member named 'length'
make[4]: *** [nrnpy_hoc.lo] Error 1
make[4]: Leaving directory `/home/larry/neuron/nrn/src/nrnpython'
make[3]: *** [all] Error 2
make[3]: Leaving directory `/home/larry/neuron/nrn/src/nrnpython'
make[2]: *** [all-recursive] Error 1
make[2]: Leaving directory `/home/larry/neuron/nrn/src'
make[1]: *** [all-recursive] Error 1
make[1]: Leaving directory `/home/larry/neuron/nrn'
make: *** [all] Error 2


Larry

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

Re: NEURON does not compile with python3.3

Post by hines » Fri May 10, 2013 9:02 pm

This is fixed in http://www.neuron.yale.edu/hg/neuron/nr ... 41cf0aff14
Note that this changeset was applied to the 'Release 7.3' branch. You can switch from trunk to this branch with
hg update 'Release 7.3'
The experimental trunk may have problems with Python 3 due the addition of some files requiring cython.
Also, note that communication of Python 3 strings (unicode) into the hoc world is almost always a memory leak as the string must be converted to
an ascii c null terminated string. I will need to properly free these strings in the future.

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

Re: NEURON does not compile with python3.3

Post by lneisenman » Wed May 15, 2013 9:32 am

That did the trick. Thanks for the heads up on the potential memory leak.

Larry

Post Reply