Page 2 of 2

Re: import neuron crash in ipython console

Posted: Wed Apr 03, 2013 10:33 am
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?

Re: import neuron crash in ipython console

Posted: Mon Apr 08, 2013 6:34 pm
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.

Re: import neuron crash in ipython console

Posted: Tue Apr 09, 2013 9:58 am
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

Re: import neuron crash in ipython console

Posted: Thu Apr 11, 2013 8:36 pm
by hines
I believe the problem is fixed now both in the repository and in the standard distribution tar.gz and installers.

Re: import neuron crash in ipython console

Posted: Fri Apr 12, 2013 10:40 am
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

Re: import neuron crash in ipython console

Posted: Fri Apr 12, 2013 11:14 am
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.

Re: import neuron crash in ipython console

Posted: Thu May 09, 2013 10:54 am
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

Re: import neuron crash in ipython console

Posted: Thu May 09, 2013 11:08 am
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.