import neuron crash in ipython console
Moderator: hines
import neuron crash in ipython console
Hi,
I'm experiencing a crash while trying to import neuron from within a ipython console session.
This also means that the very useful ipython notebook and ipython qtconsole also crashes.
This is what I get:
0026bb152c23:examples ehagen$ ipython console
Python 2.7.3 (default, Apr 14 2012, 15:31:44)
Type "copyright", "credits" or "license" for more information.
IPython 0.13 -- An enhanced Interactive Python.
? -> Introduction and overview of IPython's features.
%quickref -> Quick reference.
help -> Python's own help system.
object? -> Details about 'object', use 'object??' for extra details.
[IPKernelApp] To connect another client to this kernel, use:
[IPKernelApp] --existing kernel-91543.json
In [1]: import neuron
NEURON -- VERSION 7.3 (736:19ad148877ff) 19ad148877ff
Duke, Yale, and the BlueBrain Project -- Copyright 1984-2012
See http://www.neuron.yale.edu/credits.html
Additional mechanisms from files
ca.mod cad.mod kca.mod km.mod kv.mod na.mod
Assertion failed: file nrnpython.cpp, line 45
NEURON: PyRun_SimpleString("import sys") == 0
near line 0
objref hoc_obj_[2]
^
kernel died, restart ([y]/n)?
I'm experiencing a crash while trying to import neuron from within a ipython console session.
This also means that the very useful ipython notebook and ipython qtconsole also crashes.
This is what I get:
0026bb152c23:examples ehagen$ ipython console
Python 2.7.3 (default, Apr 14 2012, 15:31:44)
Type "copyright", "credits" or "license" for more information.
IPython 0.13 -- An enhanced Interactive Python.
? -> Introduction and overview of IPython's features.
%quickref -> Quick reference.
help -> Python's own help system.
object? -> Details about 'object', use 'object??' for extra details.
[IPKernelApp] To connect another client to this kernel, use:
[IPKernelApp] --existing kernel-91543.json
In [1]: import neuron
NEURON -- VERSION 7.3 (736:19ad148877ff) 19ad148877ff
Duke, Yale, and the BlueBrain Project -- Copyright 1984-2012
See http://www.neuron.yale.edu/credits.html
Additional mechanisms from files
ca.mod cad.mod kca.mod km.mod kv.mod na.mod
Assertion failed: file nrnpython.cpp, line 45
NEURON: PyRun_SimpleString("import sys") == 0
near line 0
objref hoc_obj_[2]
^
kernel died, restart ([y]/n)?
Re: import neuron crash in ipython console
I'd like to try to reproduce this. What machine and os are you using?
Were python and ipython part of the normal installation or did you install them
separately? How did you install NEURON?
Were python and ipython part of the normal installation or did you install them
separately? How did you install NEURON?
Re: import neuron crash in ipython console
Hello Michael,
I'm on mac OS X 10.7.4, where Python (v2.7.3) and IPython (v0.13) where installed via macports. I've installed NEURON from the developer branch (736:19ad148877ff). Actually all these version numbers are present in the crash log. My config flags where:
./configure --prefix=/Applications/NEURON-7.3/nrn \
--with-nrnpython=/opt/local/Library/Frameworks/Python.framework/Versions/2.7/Resources/Python.app/Contents/MacOS/Python \
--host=x86_64-apple-darwin11.4.0 --build=x86_64-apple-darwin11.4.0 \
--with-x --x-includes=/usr/X11/include/ --x-libraries=/usr/X11/lib/ \
--with-iv=/Applications/NEURON-7.3/iv
I'm doing some tests to see if this also fails on a Linux VM.
My understanding is that import neuron prepends some thing to the sys.path-list, but I don't know if this is necessary.
Best regards,
Espen
I'm on mac OS X 10.7.4, where Python (v2.7.3) and IPython (v0.13) where installed via macports. I've installed NEURON from the developer branch (736:19ad148877ff). Actually all these version numbers are present in the crash log. My config flags where:
./configure --prefix=/Applications/NEURON-7.3/nrn \
--with-nrnpython=/opt/local/Library/Frameworks/Python.framework/Versions/2.7/Resources/Python.app/Contents/MacOS/Python \
--host=x86_64-apple-darwin11.4.0 --build=x86_64-apple-darwin11.4.0 \
--with-x --x-includes=/usr/X11/include/ --x-libraries=/usr/X11/lib/ \
--with-iv=/Applications/NEURON-7.3/iv
I'm doing some tests to see if this also fails on a Linux VM.
My understanding is that import neuron prepends some thing to the sys.path-list, but I don't know if this is necessary.
Best regards,
Espen
Re: import neuron crash in ipython console
Btw, I get the exact same error on an older NEURON install on a Linux Mint 11 install, but upgraded to ipython 0.13:
Python 2.7.2+ (default, Oct 4 2011, 20:06:09)
Type "copyright", "credits" or "license" for more information.
IPython 0.13 -- An enhanced Interactive Python.
? -> Introduction and overview of IPython's features.
%quickref -> Quick reference.
help -> Python's own help system.
object? -> Details about 'object', use 'object??' for extra details.
In [1]: import neuron
NEURON -- VERSION 7.3 (580:2c91b36b8d58) 2012-01-26
Duke, Yale, and the BlueBrain Project -- Copyright 1984-2008
See http://www.neuron.yale.edu/credits.html
Assertion failed: file nrnpython.cpp, line 45
NEURON: PyRun_SimpleString("import sys") == 0
near line 0
objref hoc_obj_[2]
^
kernel died, restart ([y]/n)?
Python 2.7.2+ (default, Oct 4 2011, 20:06:09)
Type "copyright", "credits" or "license" for more information.
IPython 0.13 -- An enhanced Interactive Python.
? -> Introduction and overview of IPython's features.
%quickref -> Quick reference.
help -> Python's own help system.
object? -> Details about 'object', use 'object??' for extra details.
In [1]: import neuron
NEURON -- VERSION 7.3 (580:2c91b36b8d58) 2012-01-26
Duke, Yale, and the BlueBrain Project -- Copyright 1984-2008
See http://www.neuron.yale.edu/credits.html
Assertion failed: file nrnpython.cpp, line 45
NEURON: PyRun_SimpleString("import sys") == 0
near line 0
objref hoc_obj_[2]
^
kernel died, restart ([y]/n)?
Re: import neuron crash in ipython console
Hi,
A fix for me that apparently hasn't broken anything was simply to comment out a few lines from withing that function:
imt-iw23013124:nrn aehagen$ hg diff
diff -r 19ad148877ff src/nrnpython/nrnpython.cpp
--- a/src/nrnpython/nrnpython.cpp Mon Sep 10 13:28:14 2012 +0000
+++ b/src/nrnpython/nrnpython.cpp Mon Sep 17 11:26:17 2012 +0200
@@ -42,10 +42,10 @@
//printf("augment_path\n");
augmented = 1;
sprintf(buf, "sys.path.append('%s/lib/python')", neuronhome_forward());
- assert(PyRun_SimpleString("import sys") == 0);
- assert(PyRun_SimpleString(buf) == 0);
- sprintf(buf, "sys.path.prepend('')");
- assert(PyRun_SimpleString("sys.path.insert(0, '')") == 0);
+ //assert(PyRun_SimpleString("import sys") == 0);
+ //assert(PyRun_SimpleString(buf) == 0);
+ //sprintf(buf, "sys.path.prepend('')");
+ //assert(PyRun_SimpleString("sys.path.insert(0, '')") == 0);
}
}
A fix for me that apparently hasn't broken anything was simply to comment out a few lines from withing that function:
imt-iw23013124:nrn aehagen$ hg diff
diff -r 19ad148877ff src/nrnpython/nrnpython.cpp
--- a/src/nrnpython/nrnpython.cpp Mon Sep 10 13:28:14 2012 +0000
+++ b/src/nrnpython/nrnpython.cpp Mon Sep 17 11:26:17 2012 +0200
@@ -42,10 +42,10 @@
//printf("augment_path\n");
augmented = 1;
sprintf(buf, "sys.path.append('%s/lib/python')", neuronhome_forward());
- assert(PyRun_SimpleString("import sys") == 0);
- assert(PyRun_SimpleString(buf) == 0);
- sprintf(buf, "sys.path.prepend('')");
- assert(PyRun_SimpleString("sys.path.insert(0, '')") == 0);
+ //assert(PyRun_SimpleString("import sys") == 0);
+ //assert(PyRun_SimpleString(buf) == 0);
+ //sprintf(buf, "sys.path.prepend('')");
+ //assert(PyRun_SimpleString("sys.path.insert(0, '')") == 0);
}
}
Re: import neuron crash in ipython console
I will continue to look into this. It is a mystery to me why "import sys" would fail when
"import neuron" is executed from ipython on a mac. The nrn_augment_path certainly
does not seem needed in this particular context since "import neuron" cannot itself
succeed unless the path is already sufficient.
"import neuron" is executed from ipython on a mac. The nrn_augment_path certainly
does not seem needed in this particular context since "import neuron" cannot itself
succeed unless the path is already sufficient.
Re: import neuron crash in ipython console
Note that this happens only with any of the consoles in ipython 0.13, i.e.
ipython console
ipython notebook
ipython qtconsole
Regular ipython imports neuron just fine.
Espen.
ipython console
ipython notebook
ipython qtconsole
Regular ipython imports neuron just fine.
Espen.
Re: import neuron crash in ipython console
Hi,
I just updated the ipython to 0.13 and bumped into exact same thing in the notebook (error in notebook, but works fine in "pure" ipython). This was not an issue in ipython 0.12. Any news on this? I will try the proposed hack here. Thanks!
I just updated the ipython to 0.13 and bumped into exact same thing in the notebook (error in notebook, but works fine in "pure" ipython). This was not an issue in ipython 0.12. Any news on this? I will try the proposed hack here. Thanks!
Re: import neuron crash in ipython console
At present I have ipython on my mac but not console or notebook. But there have been a few changes recently in regard to installing the neuron module so
if you have not built from the latest hg repository sources, perhaps you might try
http://www.neuron.yale.edu/ftp/neuron/v ... 10.7.5.dmg
if you have not built from the latest hg repository sources, perhaps you might try
http://www.neuron.yale.edu/ftp/neuron/v ... 10.7.5.dmg
Re: import neuron crash in ipython console
forgot to mention that you would need an
export PYTHONPATH=/Applications/NEURON-7.3/nrn/lib/python
export PYTHONPATH=/Applications/NEURON-7.3/nrn/lib/python
Re: import neuron crash in ipython console
Just to reconfirm the originally proposed solution seem to do the job (OS Lion, Python 2.7.2., ipython 0.13). Haven't looked at the new suggestion yet (and I haven't really expected such a fast reply either!).
Re: import neuron crash in ipython console
by proposed solution, do you mean commenting out four lines in the 17 Sep 2012 09:28 am message?
Instead, I would have to surround with an if statement that was false when launching with python. The
lines are needed when launching nrniv.
Instead, I would have to surround with an if statement that was false when launching with python. The
lines are needed when launching nrniv.
-
- Posts: 41
- Joined: Thu May 03, 2007 4:04 pm
- Location: Institute of Science and Technology (IST Austria)
- Contact:
Re: import neuron crash in ipython console
The same happens when I updated to IPython 0.13 in GNU/Linux (Debian and Ubuntu) :
NEURON -- VERSION 7.3 (726:af0c90e31572) 2012-08-12
Python version 2.6 or 2.7
IPython version 0.13
But only when the notebook is called (e.g ipython notebook) but not on a standard IPython sesion:
However, in notebook mode:
I would appreciate some hint to resolve this issue. I use NEURON a lot with the IPython notebook for demonstrations.
NEURON -- VERSION 7.3 (726:af0c90e31572) 2012-08-12
Python version 2.6 or 2.7
IPython version 0.13
But only when the notebook is called (e.g ipython notebook) but not on a standard IPython sesion:
Code: Select all
Python 2.6.6 (r266:84292, Dec 26 2010, 22:31:48)
Type "copyright", "credits" or "license" for more information.
IPython 0.13.1 -- An enhanced Interactive Python.
? -> Introduction and overview of IPython's features.
%quickref -> Quick reference.
help -> Python's own help system.
object? -> Details about 'object', use 'object??' for extra details.
In [1]: import neuron as h
MPI_Initialized==false, disabling MPI functionality.
NEURON -- VERSION 7.3 (726:af0c90e31572) 2012-08-12
Duke, Yale, and the BlueBrain Project -- Copyright 1984-2012
See http://www.neuron.yale.edu/credits.html
In [2]:
Code: Select all
MPI_Initialized==false, disabling MPI functionality.
NEURON -- VERSION 7.3 (726:af0c90e31572) 2012-08-12
Duke, Yale, and the BlueBrain Project -- Copyright 1984-2012
See http://www.neuron.yale.edu/credits.html
Assertion failed: file nrnpython.cpp, line 45
NEURON: PyRun_SimpleString("import sys") == 0
near line 0
objref hoc_obj_[2]
^
Re: import neuron crash in ipython console
For now I suppose the easiest thing to do is to edit nrn/src/nrnpython/nrnpython.cpp and put a
return
at the beginning of
void nrnpy_augment_path() {
Then if you do ever launch nrniv instead of python and are having trouble with 'import neuron', just have a PYTHONPATH in your environment such as
export PYTHONPATH=<prefix>/share/nrn/lib/python
where <prefix> is where you installed NEURON.
return
at the beginning of
void nrnpy_augment_path() {
Then if you do ever launch nrniv instead of python and are having trouble with 'import neuron', just have a PYTHONPATH in your environment such as
export PYTHONPATH=<prefix>/share/nrn/lib/python
where <prefix> is where you installed NEURON.
-
- Posts: 41
- Joined: Thu May 03, 2007 4:04 pm
- Location: Institute of Science and Technology (IST Austria)
- Contact:
Re: import neuron crash in ipython console
Thanks a lot! This did it!
Would you tell us when a patch to solve this issue would be available in the repository?
Would you tell us when a patch to solve this issue would be available in the repository?