import neuron crash in ipython console

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

Moderator: hines

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

Re: import neuron crash in ipython console

Post by hines »

I'd like to reproduce the problem and experiment a bit with it. However, when I installed ipython and the notebook on my ubuntu 12.04 desktop with
sudo apt-get install ipython-notebook
I only got ipython 0.12.1 .
What would I have to do to get ipython 0.13?
jditte
Posts: 5
Joined: Wed Mar 20, 2013 3:40 pm

Re: import neuron crash in ipython console

Post by jditte »

This is apparently not only a Mac issue. The same just happened to me on a Windows 7 64bit machine while testing the current beta version of Enthought's new Canopy IDE. It uses an IPython (0.13.1) QTconsole. Typing "import neuron" at the editor's interactive prompt causes a kernel crash. (Typing "import neuron" at a regular Python prompt is fine.) I have tried it with both PyNEURON 7.2.536.7 from the package manager as well as with a manually installed PyNEURON 7.2.536.16. Canopy uses Python 2.7.3.
lneisenman
Posts: 20
Joined: Wed Dec 16, 2009 10:26 am

Re: import neuron crash in ipython console

Post by lneisenman »

I'm seeing the same issue using python3 in ubuntu 12.04 64 bit.

to install in ubuntu for python2 (probably should 'sudo apt-get remove ipython' first if apt-get was used to install ipython):

sudo apt-get install build-essential
sudo apt-get install python-dev
sudo apt-get install libqt4-dev # Qt needed for qtconsole in Ipython
sudo apt-get install pyqt4-dev-tools
sudo apt-get install libzmq-dev # ZMQ library needed for Ipython
sudo apt-get install python-setuptools # allow use of easy_install
sudo easy_install pyzmq # Python bindings to ZMQ library
sudo easy_install -U tornado # tornado webserver for ipython notebooks
sudo easy_install -U ipython

for python3:

sudo apt-get install build-essential
sudo apt-get install python3-dev
sudo apt-get install libqt4-dev # Qt needed for qtconsole in Ipython
sudo apt-get install python3-pyqt4
sudo apt-get install libzmq-dev # ZMQ library needed for Ipython
sudo apt-get install python3-setuptools # allow use of easy_install
sudo easy_install3 -U pyzmq # Python bindings to ZMQ library
sudo easy_install3 -U tornado # tornado webserver for ipython notebooks
sudo easy_install3 -U ipython

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

Re: import neuron crash in ipython console

Post by hines »

I believe the problem is fixed now both in the repository and in the standard distribution tar.gz and installers.
lneisenman
Posts: 20
Joined: Wed Dec 16, 2009 10:26 am

Re: import neuron crash in ipython console

Post by lneisenman »

Thanks for the fix. It works for me with python3 on Ubuntu 12.04 64 bit.

One interesting behavior I noted is that when using neuron from a qtconsole or notebook, the message about neuron that prints when executing 'from neuron import h' does not display in the qtconsole or notebook, but rather in the terminal from which I started the program. Similarly h.psection() returns the value 1.0 in the qtconsole or notebook and the usual text prints in the terminal.

For example, if I run ipython in a terminal I get the following:

In [1]: from neuron import h
NEURON -- Release 7.3 (849:5be3d097b917) 2013-04-11
Duke, Yale, and the BlueBrain Project -- Copyright 1984-2013
See http://www.neuron.yale.edu/neuron/credits


In [2]: soma = h.Section(name='soma')

In [3]: h.psection()
soma { nseg=1 L=100 Ra=35.4
/*location 0 attached to cell 0*/
/* First segment only */
insert morphology { diam=500}
insert capacitance { cm=1}
}
Out[3]: 1.0


If I do the same thing in a qtconsole, I get:

In [1]: from neuron import h

In [2]: soma = h.Section(name='soma')

In [3]: h.psection()
Out[3]: 1.0

and the remaining text is printed in the terminal where I called ipython

larry@larry-VirtualBox:~$ ipython3 qtconsole
[IPKernelApp] To connect another client to this kernel, use:
[IPKernelApp] --existing kernel-28507.json
NEURON -- Release 7.3 (849:5be3d097b917) 2013-04-11
Duke, Yale, and the BlueBrain Project -- Copyright 1984-2013
See http://www.neuron.yale.edu/neuron/credits

soma { nseg=1 L=100 Ra=35.4
/*location 0 attached to cell 0*/
/* First segment only */
insert morphology { diam=500}
insert capacitance { cm=1}
}

I'm not sure this is really a significant problem (It's not for me). I'm just pointing it out because it wasn't what I expected.

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

Re: import neuron crash in ipython console

Post by hines »

Yes, it is unexpected to me that everything that NEURON prints to stdout goes to the terminal that launched 'ipython notebook'.
I don't have a solution at present. Perhaps there is a way for every run action to temporarily redirect stdout (and stderr) to the socket that expects to receive the print result of that action.
vellamike

Re: import neuron crash in ipython console

Post by vellamike »

I can confirm that upgrading to NEURON -- Release 7.3 (849:5be3d097b917) 2013-04-11 has solved this issue for me.

I previously tended to run 7.1 because of Elif Muller's convenient deb packages:

http://neuralensemble.org/people/eilifm ... tware.html
hines
Site Admin
Posts: 1682
Joined: Wed May 18, 2005 3:32 pm

Re: import neuron crash in ipython console

Post by hines »

http://www.neuron.yale.edu/hg/neuron/nr ... e3d097b917
takes care of the problem. When python is launched there was no need to augment the path when neuron is imported since it couldn't be imported without already being in the path.
I admit to not understanding why ipython cannot import sys when importing neuron, though.
Post Reply