Compling Problem

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

Moderator: hines

neurite
Posts: 13
Joined: Fri Jun 22, 2007 2:06 pm
Location: Boston University

Compling Problem

Post by neurite » Thu Jun 28, 2007 5:04 pm

Hi, I've been trying to compile the lastest version of nrn with the --with-nrnpython option. I've used both the lastest code as well as those of the standard distribution, and I also have the lastest version of python. ./configure runs fine, but when I run make, I always get the same following error. It seems like a syntax error in the code. How do I get around this? I'm trying to compile this on BU Linux, which is based on fedora core. What are the linux distributions in which the compilation works?

nrnpy_hoc.cpp: In function 'PyObject* PyObj_FromNrnObj(Object*)':
nrnpy_hoc.cpp:1013: error: 'Vect' was not declared in this scope
nrnpy_hoc.cpp:1013: error: 'v' was not declared in this scope
nrnpy_hoc.cpp:1013: error: expected primary-expression before ')' token
nrnpy_hoc.cpp:1013: error: expected `;' before 'obj'
nrnpy_hoc.cpp: In function 'int hocobj_tonumpy(PyObject*, PyObject*)':
nrnpy_hoc.cpp:1041: warning: converting to non-pointer type 'int' from NULL
nrnpy_hoc.cpp:1047: error: 'struct _object' has no member named 'type_'
nrnpy_hoc.cpp:1047: error: 'struct _object' has no member named 'type_'
nrnpy_hoc.cpp:1049: error: 'struct _object' has no member named 'sym_'
nrnpy_hoc.cpp:1053: warning: converting to non-pointer type 'int' from NULL
nrnpy_hoc.cpp:1062: error: 'hoc_total_array' was not declared in this scope
nrnpy_hoc.cpp:1080: warning: converting to non-pointer type 'int' from NULL
nrnpy_hoc.cpp:1091: error: 'pObj' was not declared in this scope
nrnpy_hoc.cpp:1101: error: 'pObj' was not declared in this scope
nrnpy_hoc.cpp:1111: error: 'hoc_total_array' was not declared in this scope
nrnpy_hoc.cpp:1130: warning: converting to non-pointer type 'int' from NULL
nrnpy_hoc.cpp:1141: error: 'pObj' was not declared in this scope
nrnpy_hoc.cpp:1147: warning: converting to non-pointer type 'int' from NULL
nrnpy_hoc.cpp:1156: error: 'pObj' was not declared in this scope
nrnpy_hoc.cpp:1163: warning: converting to non-pointer type 'int' from NULL
nrnpy_hoc.cpp:1174: error: invalid conversion from 'int (*)(PyObject*, PyObject*)' to 'PyObject* (*)(PyObject*, PyObject*)'
nrnpy_hoc.cpp:1234: error: a function-definition is not allowed here before '{' token
nrnpy_hoc.cpp: At global scope:
nrnpy_hoc.cpp:1263: error: expected `}' at end of input
make[4]: *** [nrnpy_hoc.lo] Error 1
make[4]: Leaving directory `/home/paladin/neuron/nrn/src/nrnpython'
make[3]: *** [all] Error 2
make[3]: Leaving directory `/home/paladin/neuron/nrn/src/nrnpython'
make[2]: *** [all-recursive] Error 1
make[2]: Leaving directory `/home/paladin/neuron/nrn/src'
make[1]: *** [all-recursive] Error 1
make[1]: Leaving directory `/home/paladin/neuron/nrn'
make: *** [all] Error 2

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

Post by hines » Sun Jul 01, 2007 2:51 pm

I'm not using numpy and this problem is located in one of the fragments in a #ifdef WITH_NUMPY block that is being developed by others. I suppose one must add
#include <ivocvect.h>
which comes from nrn/src/ivoc near the top of the nrn/src/nrnpython/nrnpy_hoc.cpp file and hope that it does not conflict with anything else in the file. If this works for you let me know and I'll add it on the next commit I make to this file.

neurite
Posts: 13
Joined: Fri Jun 22, 2007 2:06 pm
Location: Boston University

Post by neurite » Mon Jul 02, 2007 11:41 am

Thanks, it worked, although the header file calls for other header files in the gnu folder, which I just copied over.

neurite
Posts: 13
Joined: Fri Jun 22, 2007 2:06 pm
Location: Boston University

Post by neurite » Mon Jul 02, 2007 3:29 pm

neurite wrote:Thanks, it worked, although the header file calls for other header files in the gnu folder, which I just copied over.
Hmm I started to install this on a different machine today with the same method above and I got some what of the same make error output. Please advise.

-DUSEBBS=1 -g -O2 -MT nrnpython.lo -MD -MP -MF ".deps/nrnpython.Tpo" -c -o nrnpython.lo nrnpython.cpp; \
then mv -f ".deps/nrnpython.Tpo" ".deps/nrnpython.Plo"; else rm -f ".deps/nrnpython.Tpo"; exit 1; fi
mkdir .libs
g++ -DHAVE_CONFIG_H -DWITH_NUMPY -I. -I. -I../.. -I../.. -I../.. -I../../src/oc -I../../src/oc -I../../src/parallel -I../../src/nrnjava -I../../src/nrncvode -I../../src/ivos -I../../src/sundials -I. -I. -I../../src/nrniv -I../../src/ivoc -I../../src/nrnoc -I../../src/oc -I/usr/include/python2.4 -I/usr/lib64/python2.4/site-packages/numpy/core/include -I/home/paladin/neuron/iv/include -I/usr/X11R6/include -DOOP=1 -DCABLE=1 -DUSECVODE=1 -DUSEMATRIX=1 -DUSEBBS=1 -g -O2 -MT nrnpython.lo -MD -MP -MF .deps/nrnpython.Tpo -c nrnpython.cpp -fPIC -DPIC -o .libs/nrnpython.o
if /bin/sh ../../libtool --mode=compile --tag=CXX g++ -DHAVE_CONFIG_H -DWITH_NUMPY -I. -I. -I../.. -I../.. -I../.. -I../../src/oc -I../../src/oc -I../../src/parallel -I../../src/nrnjava -I../../src/nrncvode -I../../src/ivos -I../../src/sundials -I. -I. -I../../src/nrniv -I../../src/ivoc -I../../src/nrnoc -I../../src/oc -I/usr/include/python2.4 -I/usr/lib64/python2.4/site-packages/numpy/core/include -I/home/paladin/neuron/iv/include -I/usr/X11R6/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; \
then mv -f ".deps/nrnpy_hoc.Tpo" ".deps/nrnpy_hoc.Plo"; else rm -f ".deps/nrnpy_hoc.Tpo"; exit 1; fi
g++ -DHAVE_CONFIG_H -DWITH_NUMPY -I. -I. -I../.. -I../.. -I../.. -I../../src/oc -I../../src/oc -I../../src/parallel -I../../src/nrnjava -I../../src/nrncvode -I../../src/ivos -I../../src/sundials -I. -I. -I../../src/nrniv -I../../src/ivoc -I../../src/nrnoc -I../../src/oc -I/usr/include/python2.4 -I/usr/lib64/python2.4/site-packages/numpy/core/include -I/home/paladin/neuron/iv/include -I/usr/X11R6/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:42: error: declaration of C function 'int vector_capacity(void*)' conflicts with
../../src/ivoc/ivocvect.h:45: error: previous declaration 'int vector_capacity(IvocVect*)' here
nrnpy_hoc.cpp: In function 'int hocobj_tonumpy(PyObject*, PyObject*)':
nrnpy_hoc.cpp:1041: warning: converting to non-pointer type 'int' from NULL
nrnpy_hoc.cpp:1047: error: 'struct _object' has no member named 'type_'
nrnpy_hoc.cpp:1047: error: 'struct _object' has no member named 'type_'
nrnpy_hoc.cpp:1049: error: 'struct _object' has no member named 'sym_'
nrnpy_hoc.cpp:1053: warning: converting to non-pointer type 'int' from NULL
nrnpy_hoc.cpp:1062: error: 'hoc_total_array' was not declared in this scope
nrnpy_hoc.cpp:1080: warning: converting to non-pointer type 'int' from NULL
nrnpy_hoc.cpp:1091: error: 'pObj' was not declared in this scope
nrnpy_hoc.cpp:1101: error: 'pObj' was not declared in this scope
nrnpy_hoc.cpp:1111: error: 'hoc_total_array' was not declared in this scope
nrnpy_hoc.cpp:1130: warning: converting to non-pointer type 'int' from NULL
nrnpy_hoc.cpp:1141: error: 'pObj' was not declared in this scope
nrnpy_hoc.cpp:1147: warning: converting to non-pointer type 'int' from NULL
nrnpy_hoc.cpp:1156: error: 'pObj' was not declared in this scope
nrnpy_hoc.cpp:1163: warning: converting to non-pointer type 'int' from NULL
nrnpy_hoc.cpp:1174: error: invalid conversion from 'int (*)(PyObject*, PyObject*)' to 'PyObject* (*)(PyObject*, PyObject*)'
nrnpy_hoc.cpp:1234: error: a function-definition is not allowed here before '{' token
nrnpy_hoc.cpp: At global scope:
nrnpy_hoc.cpp:1263: error: expected `}' at end of input
make[4]: *** [nrnpy_hoc.lo] Error 1
make[4]: Leaving directory `/home/paladin/neuron/nrn/src/nrnpython'
make[3]: *** [all] Error 2
make[3]: Leaving directory `/home/paladin/neuron/nrn/src/nrnpython'
make[2]: *** [all-recursive] Error 1
make[2]: Leaving directory `/home/paladin/neuron/nrn/src'
make[1]: *** [all-recursive] Error 1
make[1]: Leaving directory `/home/paladin/neuron/nrn'
make: *** [all] Error 2

I have numpy installed, so I'm not sure what the error is. Is it required? Can I compile without it?

arb
Posts: 19
Joined: Mon Jul 02, 2007 6:18 am
Location: Humboldt-University, Berlin

compiling neuron with nrnpython option

Post by arb » Tue Jul 03, 2007 11:10 am

I also tried to compile the new version with the option -nrnpython on different machines and I get exactly the same error messages as neurite. I can compile the old 5.9 version with -nrnpython option but there the python connection is still in its infancy.
if anyone succeeded compiling the new code, please help!

armin

neurite
Posts: 13
Joined: Fri Jun 22, 2007 2:06 pm
Location: Boston University

Post by neurite » Tue Jul 03, 2007 11:24 am

Also tried what Michael suggested on the alpha version and got the same error as above. I really don't think it's anything wrong with my system, but rather something in the code.

kalyan0000
Posts: 2
Joined: Sun Jun 12, 2005 3:14 am
Location: bangalore
Contact:

compiling with nrnpython option

Post by kalyan0000 » Sun Jul 08, 2007 2:13 am

hi
i think the problem is with numpy module. when i tried to compile nrn with --with-nrnpython option, i got similar error meaasage as mentioned by other users. but afetr uninstalling numpy module, compilation with --nrnpython option was successful. i could run neurondemo with python option. removing numpy is a temporary solution to the problem. numpy can be reinstalled after compilation is done. Michael should do something about this problem.

kalyan

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

Post by hines » Sat Jul 14, 2007 1:10 pm

I just merged my python4 branch with the main trunk and now http://www.neuron.yale.edu/svn/neuron/ should be working on linux with both the embedded and extended style. This should be more or less complete with respect to syntax for hoc+python interaction. A beginning document that illustrates most of the details is
http://www.neuron.yale.edu/neuron/stati ... ython.html

arb
Posts: 19
Joined: Mon Jul 02, 2007 6:18 am
Location: Humboldt-University, Berlin

new branch is still not working

Post by arb » Thu Jul 19, 2007 4:12 pm

did the new branch worked for someone?

I still get the same message with slightly different line numbers. I am running ubuntu 7.04 and python with numpy.

/bin/bash ../../libtool --tag=CXX --mode=compile g++ -DHAVE_CONFIG_H -DWITH_NUMPY -I. -I../.. -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/gnu -I/usr/include/python2.5 -I/usr/lib/python2.5/site-packages/numpy/core/include -I/home/armin/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
g++ -DHAVE_CONFIG_H -DWITH_NUMPY -I. -I../.. -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/gnu -I/usr/include/python2.5 -I/usr/lib/python2.5/site-packages/numpy/core/include -I/home/armin/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 'int hocobj_tonumpy(PyObject*, PyObject*)':
nrnpy_hoc.cpp:1045: warning: converting to non-pointer type 'int' from NULL
nrnpy_hoc.cpp:1051: error: 'struct _object' has no member named 'type_'
nrnpy_hoc.cpp:1051: error: 'struct _object' has no member named 'type_'
nrnpy_hoc.cpp:1053: error: 'struct _object' has no member named 'sym_'
nrnpy_hoc.cpp:1057: warning: converting to non-pointer type 'int' from NULL
nrnpy_hoc.cpp:1066: error: 'hoc_total_array' was not declared in this scope
nrnpy_hoc.cpp:1084: warning: converting to non-pointer type 'int' from NULL
nrnpy_hoc.cpp:1095: error: 'pObj' was not declared in this scope
nrnpy_hoc.cpp:1105: error: 'pObj' was not declared in this scope
nrnpy_hoc.cpp:1115: error: 'hoc_total_array' was not declared in this scope
nrnpy_hoc.cpp:1134: warning: converting to non-pointer type 'int' from NULL
nrnpy_hoc.cpp:1145: error: 'pObj' was not declared in this scope
nrnpy_hoc.cpp:1151: warning: converting to non-pointer type 'int' from NULL
nrnpy_hoc.cpp:1160: error: 'pObj' was not declared in this scope
nrnpy_hoc.cpp:1167: warning: converting to non-pointer type 'int' from NULL
nrnpy_hoc.cpp:1178: error: invalid conversion from 'int (*)(PyObject*, PyObject*)' to 'PyObject* (*)(PyObject*, PyObject*)'
nrnpy_hoc.cpp:1238: error: a function-definition is not allowed here before '{' token
nrnpy_hoc.cpp: At global scope:
nrnpy_hoc.cpp:1267: error: expected `}' at end of input




thanks for help
armin

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

Post by hines » Thu Jul 19, 2007 5:21 pm

There are two threads regarding this building with Python topic. Did you see my last message at
https://www.neuron.yale.edu/phpBB2/viewtopic.php?t=953
The current thread here is probably the best place to continue resolving remaining issues. So. Are you using the latest tar.gz i.e. http://www.neuron.yale.edu/ftp/neuron/v ... 909.tar.gz
, if not are you updated to the latest svn repository code, ie. changeset 1816?

Next. The errors you are seeing are in the
numpy interface. Avoid those for now by
editing your config.status file (where you typed the configure line) and manually replace the appropriate line in that file with

Code: Select all

s,@NRNPYTHON_DEFINES@,-UWITH_NUMPY,;t t
and then execute
./config.status
(cd src/nrnpython ; make clean)
make

arb
Posts: 19
Joined: Mon Jul 02, 2007 6:18 am
Location: Humboldt-University, Berlin

no module named hoc

Post by arb » Fri Jul 20, 2007 6:03 pm

installation works fine this way. ... but which problems do I get not compiling it with numpy?

after make install I switched to the src/nrnpython dir and
typed python setup.py install in super user mode:

..... sudo python setup.py install

getting:

Warning: NEURON was build without support for numpy.
A suitable installation for numpy was found, but cannot be used.
running install
running build
running build_py
running build_ext
running install_lib
running install_egg_info
Removing /usr/lib/python2.5/site-packages/NEURON-6.0.egg-info
Writing /usr/lib/python2.5/site-packages/NEURON-6.0.egg-info

.....python

Python 2.5.1 (r251:54863, May 2 2007, 16:56:35)
[GCC 4.1.2 (Ubuntu 4.1.2-0ubuntu4)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import neuron
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "neuron/__init__.py", line 9, in <module>
import hoc
ImportError: No module named hoc



it find the neuron file, but not the hoc one .
it installed only three files to /usr/lib/python2.5/site-packages/neuron:

__init__.py
__init__.pyc
hoc.so


installation of the setup.py with --prefix=/home/....
and adding the python-path gives the same results

what is still wrong?
armin

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

Post by hines » Sat Jul 21, 2007 10:47 am

There is certainly a hoc.so file there so see if one of the following works
import hoc
import neuron.hoc

import sys
sys.path
#anything you can append to the path so that
import hoc
# works.

schmuker
Posts: 11
Joined: Wed Aug 22, 2007 8:18 am
Location: Brighton, UK
Contact:

Post by schmuker » Wed Aug 22, 2007 8:29 am

The line to change in the config.status file given above did nod work for me.

In detail, I had to change the line

Code: Select all

s,@NRNPYTHON_DEFINES@,|#_!!_#|-DWITH_NUMPY,g
to this:

Code: Select all

s,@NRNPYTHON_DEFINES@,|#_!!_#|-UWITH_NUMPY,g
With this change, neuron compiled smoothly and nrniv -python works.

Cheers,

Michael

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

Post by hines » Mon Sep 17, 2007 7:32 am

To avoid the numpy issues til that portion of the code is safe, I've added a configure
option '--enable-numpy' and numpy is now disabled by default.

emuller
Posts: 15
Joined: Thu Mar 02, 2006 5:26 am
Location: Lausanne

Re: no module named hoc

Post by emuller » Mon Mar 17, 2008 12:10 pm

arb wrote: after make install I switched to the src/nrnpython dir and
typed python setup.py install in super user mode:
...

Python 2.5.1 (r251:54863, May 2 2007, 16:56:35)
[GCC 4.1.2 (Ubuntu 4.1.2-0ubuntu4)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import neuron
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "neuron/__init__.py", line 9, in <module>
import hoc
ImportError: No module named hoc

what is still wrong?
armin
This occurs if the current directory is src/nrnpython

Move up one directory, try again and it should work.

I will add a warning message that informs the user of this error case, and submit it to Michael.

Eilif.

Post Reply