I ran into a problem while using Python+NEURON, and it makes me confused a lot, could you please give me any suggestions?
I installed NEURON -- Release 7.4 (1370:16a7055d4a86) 2015-11-09 on Ubuntu 14.04, which is a virtual machine, and the version of my Python is
Python 2.7.6 (default, Oct 26 2016, 20:30:19) [GCC 4.8.4] on linux2.
I can use nrnivmodl+nrngui to launch my hoc file successfully, but I can not launch the python file using a hoc file, which applys a mod file.
When I use nrnivmodl to compile my .mod file, it shows:
and I can use nrngui to launch my .hoc file successfully.Creating x86_64 directory for .o files.
/home/xiaoyao/code
stdwa_songabbott.mod
stdwa_songabbott.mod
"/usr/local/nrn/x86_64/bin/nocmodl" stdwa_songabbott
Translating stdwa_songabbott.mod into stdwa_songabbott.c
Notice: Use of POINTER is not thread safe.
"/usr/local/nrn/share/nrn/libtool" --tag=CC --mode=compile gcc -DHAVE_CONFIG_H -I. -I.. -I"/usr/local/nrn/include/nrn" -I"/usr/local/nrn/x86_64/lib" -g -O2 -c -o stdwa_songabbott.lo stdwa_songabbott.c
libtool: compile: gcc -DHAVE_CONFIG_H -I. -I.. -I/usr/local/nrn/include/nrn -I/usr/local/nrn/x86_64/lib -g -O2 -c stdwa_songabbott.c -fPIC -DPIC -o .libs/stdwa_songabbott.o
"/usr/local/nrn/share/nrn/libtool" --tag=CC --mode=compile gcc -DHAVE_CONFIG_H -I. -I.. -I"/usr/local/nrn/include/nrn" -I"/usr/local/nrn/x86_64/lib" -g -O2 -c -o mod_func.lo mod_func.c
libtool: compile: gcc -DHAVE_CONFIG_H -I. -I.. -I/usr/local/nrn/include/nrn -I/usr/local/nrn/x86_64/lib -g -O2 -c mod_func.c -fPIC -DPIC -o .libs/mod_func.o
"/usr/local/nrn/share/nrn/libtool" --tag=CC --mode=link gcc -module -g -O2 -o libnrnmech.la -rpath "/usr/local/nrn/x86_64/lib" stdwa_songabbott.lo mod_func.lo -L"/usr/local/nrn/x86_64/lib" -lnrnoc -loc -lmemacs -lscopmath -lsparse13 -lreadline -lncurses -L"/usr/local/nrn/x86_64/lib" "/usr/local/nrn/x86_64/lib/libnrniv.la" -livoc -lneuron_gnu -lmeschach -lsundials -lm -ldl
libtool: link: gcc -shared -fPIC -DPIC .libs/stdwa_songabbott.o .libs/mod_func.o -Wl,-rpath -Wl,/usr/local/nrn/x86_64/lib -Wl,-rpath -Wl,/usr/local/nrn/x86_64/lib -L/usr/local/nrn/x86_64/lib /usr/local/nrn/x86_64/lib/libnrnoc.so /usr/local/nrn/x86_64/lib/liboc.so /usr/local/nrn/x86_64/lib/libmemacs.so /usr/local/nrn/x86_64/lib/libscopmath.so /usr/local/nrn/x86_64/lib/libsparse13.so /usr/local/nrn/x86_64/lib/libreadline.so -lncurses /usr/local/nrn/x86_64/lib/libnrniv.so /usr/local/nrn/x86_64/lib/libivoc.so /usr/local/nrn/x86_64/lib/libneuron_gnu.so /usr/local/nrn/x86_64/lib/libmeschach.so /usr/local/nrn/x86_64/lib/libsundials.so -lm -ldl -O2 -pthread -Wl,-soname -Wl,libnrnmech.so.0 -o .libs/libnrnmech.so.0.0.0
libtool: link: (cd ".libs" && rm -f "libnrnmech.so.0" && ln -s "libnrnmech.so.0.0.0" "libnrnmech.so.0")
libtool: link: (cd ".libs" && rm -f "libnrnmech.so" && ln -s "libnrnmech.so.0.0.0" "libnrnmech.so")
libtool: link: ( cd ".libs" && rm -f "libnrnmech.la" && ln -s "../libnrnmech.la" "libnrnmech.la" )
Successfully created x86_64/special
This is the right result, isn't it?xiaoyao@xiaoyao-VirtualBox:~/Yaocode$ nrngui stdp.hoc
NEURON -- Release 7.4 (1370:16a7055d4a86) 2015-11-09
Duke, Yale, and the BlueBrain Project -- Copyright 1984-2015
See http://www.neuron.yale.edu/neuron/credits
loading membrane mechanisms from /home/xiaoyao/Yaocode/x86_64/.libs/libnrnmech.so
Additional mechanisms from files
stdwa_songabbott.mod
1
oc>
But when I use hoc file in my Python code, it occurs an error, says:
xiaoyao@xiaoyao-VirtualBox:~/Yaocode$ python ntest.py
NEURON -- Release 7.4 (1370:16a7055d4a86) 2015-11-09
Duke, Yale, and the BlueBrain Project -- Copyright 1984-2015
See http://www.neuron.yale.edu/neuron/credits
loading membrane mechanisms from x86_64/.libs/libnrnmech.so
dlopen failed -
x86_64/.libs/libnrnmech.so: undefined symbol: nrnmpi_myid
1
NEURON: StdwaSA is not a template
in stdp.hoc near line 19
wa = new StdwaSA(1)
^
xopen("stdp.hoc")
execute1("{xopen("st...")
load_file("stdp.hoc")
0
What's more, if I apply a hoc file in my python code, where mod file is not used, there is no error.
It really confuses me. And I tried almost every way in the forum to fix the problem these days, but it just doesn't work.
Could you please help with this problem?
Thank you so much for your time.