Starting Neuron GUI in python

Post Reply
nevo

Starting Neuron GUI in python

Post by nevo »

Hello everybody,

I am having difficulties in starting the GUI of NEURON in python.

I am using Enthought Python 6.2 on a WINDOWS XP machine and NEURON as a python module which I compiled myself as described in post viewtopic.php?f=5&t=1970.

This is what I did:
  • Install CYGWIN
  • Extract the two packages in $HOME/nrn and $HOME/iv-17
  • In the directory $HOME/iv-17:

Code: Select all

./configure --prefix=`pwd`
make
make install
  • In the directory $HOME/nrn:

Code: Select all

./configure --prefix=`pwd` --with-iv=$HOME/iv-17 --with-nmodl-only
make
export PATH=$HOME/bin:/cygdrive/c/Python26/Scripts:$PATH
cp /bin/make $HOME/bin/make
./configure --prefix=`pwd` --without-iv --without-memacs --without-nmodl \
--disable-cygwin --with-nrnpython=/cygdrive/c/Python26/python \
PYINCDIR=c:/Python26/include PYLIB='-Lc:/Python26/libs -lpython26' \
PYLIBDIR=c:/Python26/libs PYLIBLINK='-Lc:/Python26/libs -lpython26' \
use_pthreads=no
make
make mswin
The last command gives the error message:

Code: Select all

Error in script "nrnsetup.nsi on line 192 -- aborting creation process
Nevertheless I tried to import the module in python with:

Code: Select all

cd /cygdrive/c/marshalnrn/nrn/bin
cp hocmodule.dll hoc.pyd
and in a DOS-promt:

Code: Select all

set NEURONHOME=c:/marshalnrn/nrn
set PYTHONPATH=c:/marshalnrn/nrn/lib/python;c:/marshalnrn/nrn/bin
c:\Python26\python
from neuron import h
and it works.

But when I try to start the GUI with

Code: Select all

from neuron import gui
nothing happens. Either there is an error message nor the GUI appears.

Can anybody help?
ted
Site Admin
Posts: 5788
Joined: Wed May 18, 2005 4:50 pm
Location: Yale University School of Medicine
Contact:

Re: Starting Neuron GUI in python

Post by ted »

Either there is an error message nor the GUI appears
I need some help parsing this. Do you mean to say that
{sometimes an error message appears}
AND
{the NEURON Main Menu toolbar never appears}
?

If
{sometimes an error message appears}
then
what is the error message?

On those occasions when an error message does not appear, what happens if you type
h.nrnmainmenu()
nevo

Re: Starting Neuron GUI in python

Post by nevo »

ted wrote:
Either there is an error message nor the GUI appears
I need some help parsing this.
Sorry, I wanted to write: Neither there is an error message nor the GUI appears.

When I type
from neuron import gui

I get a "1" but the GUI does not appear.

When I then type
h.nrnmainmenu()

I get "0.0" but the GUI still does not appear.

Thanks for your help.
hines
Site Admin
Posts: 1600
Joined: Wed May 18, 2005 3:32 pm

Re: Starting Neuron GUI in python

Post by hines »

I'm afraid I have not been able to construct a non-cygwin version of InterViews and therefore it is not
possible to extend the mswin enthought distribution of python with a a gui version of NEURON.
The underlying problem is that InterViews makes use of the unix 'select' system call which has an
implementation in cygwin but not in mingw. If one goes far enough back into the past, there was a time,
before I switched to cygwin, where I had an mswin version of InterViews. But I hesitate to try to resurect
that old code since it was integrated with special window terminal code. Enthought supplies many useful
python modules so the situation is not very satisfying.
hines
Site Admin
Posts: 1600
Joined: Wed May 18, 2005 3:32 pm

Re: Starting Neuron GUI in python

Post by hines »

I just googled 'cygwin' 'enthought' and perhaps there is a way of running them both together. e.g.
http://bytes.com/topic/python/answers/3 ... hon-cygwin

I'll have to experiment with this. Unfortunately I no longer have a decent mswin development machine
and am limited to a VirtualBox on my linux desktop that can run xp. So it may be a substantial
interval before I have anything to report. At any rate, if you want to try your hand at this, the thing to do
is to build NEURON as a normal cygwin program and point the --with-nrnpython to the enthought python.
hines
Site Admin
Posts: 1600
Joined: Wed May 18, 2005 3:32 pm

Re: Starting Neuron GUI in python

Post by hines »

Tried the
set CYGWIN=NOTTY
but when I did a
import sys
sys.path.append('c:\\marshalnrn\\nrn\\bin')
import hoc
the dos command prompt window where I ran c:\Python25\python stopped responding.

Note that in c:/marshalnrn/nrn/bin I copied hocmodule.dll to hoc.pyd .
nevo

Re: Starting Neuron GUI in python

Post by nevo »

I put this
hines wrote: set CYGWIN=NOTTY
in the windows command prompt and then ran python.
These commands
import sys
sys.path.append('c:\\marshalnrn\\nrn\\bin')
import hoc
all worked. But I am still not able to bring up the GUI.
the thing to do
is to build NEURON as a normal cygwin program and point the --with-nrnpython to the enthought python.
If I understand correctly I did that with the commands In the $HOME/nrn directory:

Code: Select all

./configure --prefix=`pwd` --without-iv --without-memacs --without-nmodl \
--disable-cygwin --with-nrnpython=/cygdrive/c/Python26/python \
PYINCDIR=c:/Python26/include PYLIB='-Lc:/Python26/libs -lpython26' \
PYLIBDIR=c:/Python26/libs PYLIBLINK='-Lc:/Python26/libs -lpython26' \
use_pthreads=no
make
make mswin
hines
Site Admin
Posts: 1600
Joined: Wed May 18, 2005 3:32 pm

Re: Starting Neuron GUI in python

Post by hines »

The whole point of my post was that I was completely UNSUCCESSFUL.

Your configure arguments contain two reasons why you cannot have an InterViews gui.
They are
--disable-cygwin --without-iv
nevo

Re: Starting Neuron GUI in python

Post by nevo »

Thanks for your reply!
hines wrote: Your configure arguments contain two reasons why you cannot have an InterViews gui.
They are
--disable-cygwin --without-iv
I tried it again with your advice but unfortunately I still don’t get the GUI with the Enthought Python to work.

So now I tried to compile the NEURON module with the cygwin version of python.

Code: Select all

./configure --prefix=`pwd` --with-iv=$HOME/iv-17 --with-nmodl-only --without-memacs --with-nrnpython=/bin/python use_pthreads=no
make
make mswin
Everything went fine so I copied hocmodule.dll to hoc.pyd in /marshalnrn/nrn/bin
I set both $NEURONHOME=/cygdrive/c/marshalnrn/nrn and $PYTHONPATH=/cygdrive/c/marshalnrn/nrn/bin:/cygdrive/c/marshalnrn/nrn/lib/python

Now if I do
from neuron import h
I get the following Error:

Code: Select all

File "/cygdrive/c/marshalnrn/nrn/lib/python/neuron/__init__.py", line 81, in 
<module> import neuron.hoc
ImportError: No module named hoc
Do you have any suggestions?

Kind regards
hines
Site Admin
Posts: 1600
Joined: Wed May 18, 2005 3:32 pm

Re: Starting Neuron GUI in python

Post by hines »

The whole point of my post was that I was completely UNSUCCESSFUL.
I'm trying to say that I cannot get a cygwin version of NEURON to import into an
enthought distribution of python.

Your configure option '--with-nmodl-only' does NOT build neuron libraries or an executable. That option is
for a first stage build during cross compiling and only creates nocmodl and a few other executables which
need to be run on the build machine in order to build a neuron executable on a different processor architecture.

I am looking at
posting.php?mode=reply&f=5&t=2032
and indeed was able to run enthought python from a bash shell. I will
experiment with this and let you know if I get any further.
hines
Site Admin
Posts: 1600
Joined: Wed May 18, 2005 3:32 pm

Re: Starting Neuron GUI in python

Post by hines »

Sorry, I forgot that I cannot copy from a virtualbox and paste here. The link is
http://bytes.com/topic/python/answers/3 ... hon-cygwin
nevo

Re: Starting Neuron GUI in python

Post by nevo »

Ok, thank you
hines
Site Admin
Posts: 1600
Joined: Wed May 18, 2005 3:32 pm

Re: Starting Neuron GUI in python

Post by hines »

I have not been successful in running the enthought distribution of python with a cygwin version of neuron.
I can run the enthought python in a bash terminal (not rxvt terminal).
I can run the idemo from a bash terminal (but no output to the terminal though ./idemo > temp will put the
output in temp.
I can run a non-iv version of neuron in a bash terminal with stdin/stdout.
I cannot run nrniv in a bash terminal. It hangs unless given a filename as input with a final quit() statement.
Again, no stdout to terminal, only to a file.
So it looks like it will not be possible to combine the neuron gui with the enthought distribution of python
on a mswin machine without building a non-cygwin version of interviews.
nevo

Re: Starting Neuron GUI in python

Post by nevo »

Ok, thank you for your help!
Post Reply