Python crashes when loading nrnmech.dll
Moderator: hines
Python crashes when loading nrnmech.dll
I have NEURON compiled from sources on WinXP machine and can use it to successfully compile mod files into nrnmech.dll.
However, when loading nrnmech.dll the process crashes (that is, exits without any visible error).
Opening the same nrnmech.dll from NEURON works well, so it seems like some python issue.
Have anyone seen a similar issue? Thanks!
However, when loading nrnmech.dll the process crashes (that is, exits without any visible error).
Opening the same nrnmech.dll from NEURON works well, so it seems like some python issue.
Have anyone seen a similar issue? Thanks!
-
- Site Admin
- Posts: 6299
- Joined: Wed May 18, 2005 4:50 pm
- Location: Yale University School of Medicine
- Contact:
Re: Python crashes when loading nrnmech.dll
What python statement are you usign to load the nrnmech.dll file, or are you referring to the "automatic load" that occurs upon starting NEURON when the working directory contains a nrnmech.dll file?uri.cohen wrote:when loading nrnmech.dll the process crashes (that is, exits without any visible error).
Opening the same nrnmech.dll from NEURON works well, so it seems like some python issue
Re: Python crashes when loading nrnmech.dll
The crash happen both under automatic load using from the directory where the dll reside and when using .
Code: Select all
import neuron
Code: Select all
h.nrn_load_dll()
-
- Site Admin
- Posts: 6299
- Joined: Wed May 18, 2005 4:50 pm
- Location: Yale University School of Medicine
- Contact:
Re: Python crashes when loading nrnmech.dll
What version of NEURON are you using--what exactly does NEURON print to its xterm when it first starts up?
Re: Python crashes when loading nrnmech.dll
For the python integration I need to compile it from sources. Here's the printout:
Also it should be noted I use python 2.7.
Code: Select all
NEURON -- VERSION 7.2 (527+:a38b8d137de6+) 2011-07-26
Duke, Yale, and the BlueBrain Project -- Copyright 1984-2008
See http://www.neuron.yale.edu/credits.html
Re: Python crashes when loading nrnmech.dll
I'll try to reproduce this on my xp machine.
What configure command did you use?
Are you using the latest cygwin updates?
I see that the code is modified (the '+' after revision 527).
Can you email me the patch?
Another test is for you to navigate to c:/nrn72/demo/release, launch python
and see if "import neuron" loads the nrnmech.dll of the demo. If that works
please email the mod files you used to create the nrnmech.dll
What configure command did you use?
Are you using the latest cygwin updates?
I see that the code is modified (the '+' after revision 527).
Can you email me the patch?
Another test is for you to navigate to c:/nrn72/demo/release, launch python
and see if "import neuron" loads the nrnmech.dll of the demo. If that works
please email the mod files you used to create the nrnmech.dll
Re: Python crashes when loading nrnmech.dll
I get the failure in half a dozen models, all with consistent behavior. For example with http://senselab.med.yale.edu/modeldb/sh ... del=139654. Now regarding your questions.
The popup title is "python.exe - Entry Point Not Found" and the error reads "The procedure entry point _nmodlmutex could not be located in the dynamic link library nrniv.dll." The output is as below:
I was using the following:What configure command did you use?
Code: Select all
$ export PYHOME=/cygdrive/c/Python27
$ export PYLIB=”-L$PYHOME/libs -lpython27”
$ export PYLIBDIR=$PYHOME/libs
$ export PYLIBLINK=”-L$PYHOME/libs -lpython27”
$ export PYINCDIR=$PYHOME/include
$
$ ./configure --prefix=`pwd` --with-nrnpython=$PYHOME/python CC=gcc-3 CXX=g++-3 use_pthread=no
YesAre you using the latest cygwin updates?
Those were the changes I've done so that it will compile correctly on Windows. I believe you've merged this patch to the tip at revision 536.I see that the code is modified (the '+' after revision 527).
Can you email me the patch?
Very nice, it fails with a popup window and an error message (unlike loading my dlls, not sure what's the difference):Another test is for you to navigate to c:/nrn72/demo/release, launch python
and see if "import neuron" loads the nrnmech.dll of the demo. If that works
please email the mod files you used to create the nrnmech.dll
The popup title is "python.exe - Entry Point Not Found" and the error reads "The procedure entry point _nmodlmutex could not be located in the dynamic link library nrniv.dll." The output is as below:
Code: Select all
>>> import neuron
NEURON -- VERSION 7.2 (527+:a38b8d137de6+) 2011-07-26
Duke, Yale, and the BlueBrain Project -- Copyright 1984-2008
See http://www.neuron.yale.edu/credits.html
loading membrane mechanisms from nrnmech.dll
LoadLibrary("nrnmech.dll") failed with error 127
dlopen failed -
Re: Python crashes when loading nrnmech.dll
Is that a cygwin version of python or pure windows enthought distribution?
I presume the latter.
allowing a reference to threads to creep into the mknrndll process of constructing
nrnmech.dll
I'm guessing this is a problem on either cygwin/enthought, and perhaps on all other os's as well. I must admit it has been
a long time since I tried to build NEURON without posix threads.
Will get back to you when I know more or have fixed the problem.
I presume the latter.
I should be able to reproduce the problem. It must be that use_pthread=no is./configure ... use_pthread=no
...
_nmodlmutex could not be located in the dynamic link library nrniv.dll
allowing a reference to threads to creep into the mknrndll process of constructing
nrnmech.dll
I'm guessing this is a problem on either cygwin/enthought, and perhaps on all other os's as well. I must admit it has been
a long time since I tried to build NEURON without posix threads.
Will get back to you when I know more or have fixed the problem.
Re: Python crashes when loading nrnmech.dll
The reason I've chosen to add to configure the flag "use_pthread=no" is that when using pthread I run type into conflicts: one of the Windows header files included in MinGW (/usr/i686-pc-mingw32/sys-root/mingw/include/rpcndr.h) contained a conflicting definition of boolean.
You can reproduce the issue by removing the "use_pthread=no":
You can reproduce the issue by removing the "use_pthread=no":
Code: Select all
$ export PTHREAD_LIBS="-lpthreadGC2 -L/usr/i686-pc-mingw32/sys-root/mingw/bin/"
$ ./configure --prefix=`pwd` --with-nrnpython=$PYHOME/python CC=gcc-3 CXX=g++-3
...
$ make
...
/usr/i686-pc-mingw32/sys-root/mingw/include/rpcndr.h:52: error: conflicting declaration 'typedef unsigned char osboolean'
../../src/ivos/OS/enter-scope.h:43: error: 'osboolean' has a previous declaration as `typedef unsigned int osboolean'
/usr/i686-pc-mingw32/sys-root/mingw/include/rpcndr.h:52: error: declaration of `typedef unsigned char osboolean'
../../src/ivos/OS/enter-scope.h:43: error: conflicts with previous declaration `typedef unsigned int osboolean'
/usr/i686-pc-mingw32/sys-root/mingw/include/rpcndr.h:52: error: declaration of `typedef unsigned char osboolean'
../../src/ivos/OS/enter-scope.h:43: error: conflicts with previous declaration `typedef unsigned int osboolean'
Re: Python crashes when loading nrnmech.dll
With win7 32 bit and epd-7.1-2 i was able to successfully build a loadable nrnmech.dll
after building the latest repository sources with:
The dos command box environment I used is
However, to use mknrndll in an rxvt terminal, i did have to set
export N=/cygdrive/c/marshalnrn/nrn
and also edit $N/lib/mknrndll.mak
to change all the gcc to $(CC) and set the latter to
CC=gcc-3
In other words, I did not have a problem with 'use_pthread=no'.
If you do not invoke 'use_pthread=no' and wish to use the mingw compilers supplied by cygwin
it turns out that most of the nrnwin7-64-epd.patch I sent to you has the changes needed to avoid the
boolean conflict. See nrntypes.h. I'll experiment with factoring the patch into two pieces. the first
would fix the 32 bit problems and the second would do the minor additional changes to fix the remaining
64 bit problems.
after building the latest repository sources with:
Code: Select all
../nrn/configure '--prefix=/home/hines/neuron/uri' \
'--with-nrnpython=/cygdrive/c/Python27/python' \
'CC=gcc-3' 'CXX=g++-3' 'use_pthread=no' \
'PYLIB=-L/cygdrive/c/Python27/libs -lpython27' \
'PYLIBDIR=/cygdrive/c/Python27/libs' \
'PYLIBLINK=-L/cygdrive/c/Python27/libs -lpython27' \
'PYINCDIR=/cygdrive/c/Python27/include'
make
make mswin
Code: Select all
set PYTHONPATH=c:/marshalnrn/nrn/lib/python;c:/marshalnrn/nrn/bin
set NEURONHOME=c:/marshalnrn/nrn
set PATH=%PATH%;c:\marshalnrn\nrn\bin
export N=/cygdrive/c/marshalnrn/nrn
and also edit $N/lib/mknrndll.mak
to change all the gcc to $(CC) and set the latter to
CC=gcc-3
In other words, I did not have a problem with 'use_pthread=no'.
If you do not invoke 'use_pthread=no' and wish to use the mingw compilers supplied by cygwin
it turns out that most of the nrnwin7-64-epd.patch I sent to you has the changes needed to avoid the
boolean conflict. See nrntypes.h. I'll experiment with factoring the patch into two pieces. the first
would fix the 32 bit problems and the second would do the minor additional changes to fix the remaining
64 bit problems.