Neuron as python module in windows 7

Neuron as python module in windows 7

Postby selfdestructo » Wed Oct 14, 2009 11:45 am

Hi!

First, I am on Windows 7 32bit, Python 2.6.3, Cygwin 1.7 beta, and trying to use the Neuron 7- and iv 1.7 source code packages.

I have a problem building Neuron as a python module on this config, as described in another post here; viewtopic.php?f=5&t=1507&start=0, modified with current version numbers.

Does anybody have a clue of what can be done different? I don't know how to invoke a "mingw-targeted cross-compiler", which appear to be the issue.

Here is the sh-script describing exactly what I've tried.
Code: Select all
#!/bin/sh

#cd $HOME
mv neuron neuron_old
mkdir neuron
cp iv-17.tar.gz neuron
cp nrn-7.0.tar.gz neuron
cd neuron
tar xzf iv-17.tar.gz
tar xzf nrn-7.0.tar.gz
# renaming the new directories iv and nrn makes life simpler later on
mv iv-17 iv
mv nrn-7.0 nrn

#compiling iv
cd iv
./configure --prefix=`pwd`
make
make install

#compiling neuron
cd ..
cd nrn
#./configure --prefix=`pwd`
#make
## unlike the UNIX installation, we DO NOT do make install

./configure --prefix=`pwd` --with-nrnpython
make
./configure --prefix=`pwd` --with-nrnpython \
    --without-iv --without-memacs --with-readline=no --without-nmodl
    CFLAGS="-mno-cygwin" CXXFLAGS="-mno-cygwin" \
    PYLIBDIR=/cygdrive/c/Python26/libs \
    PYINCDIR=/cygdrive/c/Python26/Include \
    PYLIBLINK="-L/cygdrive/c/Python26/libs -lpython26" \
    PYLIB="-L/cygdrive/c/Python26/libs -lpython26" \

make
cd src/mswin
cp hocmodule.dll c:/Python26/hoc.dll

exit 0


The final 'make' fails, no hocmodule.dll is created;
Code: Select all
...
g++: The -mno-cygwin flag has been removed; use a mingw-targeted cross-compiler.

make[3]: *** [neuron.exe] Error 1
make[3]: Leaving directory `/home/neuron/nrn/src/nrniv´
make[2]: *** [all-recursive] Error 1
make[2]: Leaving directory `/home/neuron/nrn/src´
make[1]: *** [all-recursive] Error 1
make[1]: Leaving directory `/home/neuron/nrn´
make: *** [all] Error 2
cp: cannot stat `hocmodule.dll´: No such file or directory

EH@Espen-PC /Home
$


Here are the Ipython output from an example python-script, which ask for the module "neuron", if it helps;
Code: Select all
In [6]: execfile("ex1.py")
---------------------------------------------------------------------------
ImportError                               Traceback (most recent call last)

c:\Users\EH\Python\LFPy\examples\<ipython console> in <module>()

c:\Users\EH\Python\LFPy\examples\ex1.py in <module>()
      2 import numpy
----> 3 import LFPy
      4
      5 ioff()
      6 close('all')

C:\Python26\lib\site-packages\LFPy\__init__.py in <module>()
      2
----> 3 from cell import Cell
      4 from synapse import Synapse
      5 from lfpnm import LFPNM
      6 import tools

C:\Python26\lib\site-packages\LFPy\cell.py in <module>()
      2 import numpy
      3 import copy
      4 import cPickle
      5 import pylab #comment out if running on Stallo
      6 import os

ImportError: No module named neuron

In [7]:
selfdestructo
 
Posts: 8
Joined: Wed Oct 14, 2009 11:12 am

Re: Neuron as python module in windows 7

Postby hines » Thu Oct 15, 2009 11:59 am

I can give a few suggestions but I don't have a Windows 7 installation available to try a build myself so they may not be sufficient.

No need to build InterViews since you are using the --without-iv for NEURON.

The topic you mentioned recommended --disable-cygwin

You are using a python from /cygdrive/c/Python26 and this seems likely to be a cygwin version, not a windows version of python.

You should start from the alpha sources at
http://www.neuron.yale.edu/ftp/neuron/versions/alpha/

I have a very recent cygwin on my xp machine and will see if I can build the mingw version.
hines
Site Admin
 
Posts: 572
Joined: Wed May 18, 2005 3:32 pm

Re: Neuron as python module in windows 7

Postby hines » Thu Oct 15, 2009 2:11 pm

The topic you mentioned recommended --disable-cygwin

Turns out this is unnecessary. When Python is a windows program,
Configure will automatically add
--disable-cygwin --with-readline=no --without-iv --without-memacs

You are using a python from /cygdrive/c/Python26

I wasn't very observant. This is a windows version.

I just built a mingw version using the latest hg repository sources.
There was a bug in nrn/src/mswin/nrncygso.sh.in which you can fix by
adding three characters around the inithoc.o indicated in
http://www.neuron.yale.edu/hg/neuron/nr ... 1260a01792

mkdir nrnwinpy
cd nrnwinpy
../nrn/configure --prefix=`pwd` --with-nrnpython=/cygdrive/c/Python25/python
make
make mswin

I then tested in Command Prompt window with
cd c:\marshalnrn\nrn\bin
mv hocmodule.dll hoc.pyd
set PYTHONPATH=c:/marshalnrn/nrn/lib/python
set NEURONHOME=c:/marshalnrn/nrn
c:\Python25\python
from neuron import h
h.neuronhome() # returns c:/marshalnrn/nrn
h.load_file('stdrun.hoc') #returns 1

If you launch from somewhere else then you need to put hoc.pyd and nrniv.dll where they will be found.
hines
Site Admin
 
Posts: 572
Joined: Wed May 18, 2005 3:32 pm

Re: Neuron as python module in windows 7

Postby selfdestructo » Fri Oct 16, 2009 11:30 am

Thanks for looking into it, but your suggested method give me some new problem with the configure-script unfortunately.
Running configure as below with your suggested flags, from latest hg sources and the corrected nrncygso.sh.in;
...
../neuron/nrn/configure --prefix=`pwd` --with-nrnpython=/cygdrive/c/Python26/python

will not complete configure correctly, ending with;
could not run a test that used the python library.
Examine config.log to see error details. Something wrong with
PYLIB=-L/cygdrive/c/Python26/libs -lpython26
or
PYLIBDIR=/cygdrive/c/Python26/libs
or
PYLIBLINK=-L/cygdrive/c/Python26/libs -lpython26
or
PYINCDIR=/cygdrive/c/Python26/include

which looks correct to me.

I don't think I will spend much more time on this, I'm getting a Mac next week anyway. But if anyone have some suggestions, I will gladly it another try.

Thanks
selfdestructo
 
Posts: 8
Joined: Wed Oct 14, 2009 11:12 am

Re: Neuron as python module in windows 7

Postby hines » Fri Oct 16, 2009 11:43 am

One difference appears to be that I used the Enthought Python distribution
epd-5.1.1-win32-x86.msi from download.enthought.com
which installs Python25. When I get a chance I'll install Python26 and
see if I can reproduce the problem. If not, perhaps the issue is a difference between
windows 7 and xp
hines
Site Admin
 
Posts: 572
Joined: Wed May 18, 2005 3:32 pm

Re: Neuron as python module in windows 7

Postby hines » Fri Oct 16, 2009 12:16 pm

I installed the windows version of python-2.6.3 and don't see a problem with configure.
You might look at your config.log file to see precisely why it failed.
hines
Site Admin
 
Posts: 572
Joined: Wed May 18, 2005 3:32 pm

Re: Neuron as python module in windows 7

Postby selfdestructo » Mon Oct 19, 2009 4:00 am

hines wrote:I installed the windows version of python-2.6.3 and don't see a problem with configure.
You might look at your config.log file to see precisely why it failed.


Yes, I did, didn't get any wiser, and concluded that my Cygwin-installation was to blame :) Thank you for your help!
selfdestructo
 
Posts: 8
Joined: Wed Oct 14, 2009 11:12 am

Re: Neuron as python module in windows 7

Postby Keivan » Fri Oct 23, 2009 2:45 am

Could you share your win 7 experience with us. I want to know is there any performance improvement (running a neuron model) compared to win XP using win 7? win 7 32 bit or 64 bit?
Keivan
 
Posts: 62
Joined: Sat Apr 22, 2006 4:28 am

Re: Neuron as python module in windows 7

Postby selfdestructo » Sat Oct 24, 2009 6:30 am

Keivan wrote:Could you share your win 7 experience with us. I want to know is there any performance improvement (running a neuron model) compared to win XP using win 7? win 7 32 bit or 64 bit?


Can´t say much about NEURON performance in 7 vs XP in 32b vs 64b mode, as I´ve only used the OS´s on my old Dell Inspiron 9300 with 1.7GHz Centrino and 2GB RAM, and have not done serious simulations on neither. The precompiled windows installation of NEURON 7.0 seems to work just fine.

But as far as Windows 7 itself is concerned, it is a pretty nice experience. It looks nice, is pretty snappy in terms of performance, appear to be very stable, I haven´t had problems getting programs to run (except neuron as python module :) ) not as annoying as Vista, I like how personal files and folder can be put into libraries, it works just fine in other words.
selfdestructo
 
Posts: 8
Joined: Wed Oct 14, 2009 11:12 am

Re: Neuron as python module in windows 7

Postby ted » Sat Oct 24, 2009 4:47 pm

Just this last week an article appeared in InfoWorld that compared performance of XP, Vista and 7. Its principal focus was on tasks that involved multithreaded execution. Vista and 7 were both faster than XP, but pretty similar to each other i.e. Vista did better than 7 on some tasks, and vice versa.
ted
Site Admin
 
Posts: 1959
Joined: Wed May 18, 2005 4:50 pm
Location: Yale University School of Medicine

Re: Neuron as python module in windows 7

Postby Keivan » Mon Oct 26, 2009 3:29 am

Then, I should buy win 7 if neuron runs faster on it. I think win 7 32 bit should be the choice for neuron; because cygwin does not have a 64 bit version yet.
Keivan
 
Posts: 62
Joined: Sat Apr 22, 2006 4:28 am

Re: Neuron as python module in windows 7

Postby ted » Mon Oct 26, 2009 11:49 am

Keivan wrote:Then, I should buy win 7 if neuron runs faster on it.

Save your $$ until you read the article. Its title was
Windows 7 on multicore: How much faster?
but the subtitle really sums it up:
Microsoft has been touting its superior handling of threads in Windows 7. InfoWorld's tests show that speed isn't the only benefit, or necessarily the main one
You can read it here
http://www.infoworld.com/d/windows/wind ... 2009-10-21
but frankly the differences were quite underwhelming. Here's a telling quote:
The Cinebench benchmark is a ratio that measures how much faster the multiple threads are than running the benchmark with one thread; it's a true measure of how the threading scales when measured by rendering performance. Cinebench showed negligible differences in performance across the three operating systems
ted
Site Admin
 
Posts: 1959
Joined: Wed May 18, 2005 4:50 pm
Location: Yale University School of Medicine


Return to MSWin

Who is online

Users browsing this forum: No registered users and 1 guest

cron