pgleeson / neurotune

BSD 3-Clause "New" or "Revised" License
1 stars 0 forks source link

Running into errors trying to run examples/example_2/optimization.py #1

Open travs opened 9 years ago

travs commented 9 years ago

I think this may be a problem with the neuron dependency on my end. I'm using Ubuntu 14.04, python 2.7.6, and I am installing neuron just with pip install neuron.

From this page, it looks like pypi's neuron just redirects to pyneuron, which is windows only, from what I can tell.

I have also tried using neuronpy as listed in the "soft dependencies" for this package, but it doesn't seem to have neuronpy.h, which is what this file needs to run.

@pgleeson Is this file meant to be run on windows, or is there a better way to install neuron that I'm not taking advantage of?

Dump of the error I received:

$ python optimization.py 
Traceback (most recent call last):
  File "optimization.py", line 9, in <module>
    from neuron import h
  File "/home/travis/worm/neurotune/venv/local/lib/python2.7/site-packages/neuron/__init__.py", line 81, in <module>
    import neuron.hoc
ImportError: libnrnpython.so.0: cannot open shared object file: No such file or directory
VahidGh commented 9 years ago

@travs, I also had some problems during running this example, but finally could run this, using these steps:

1) Perform a clean installation of Neuron 7.3 with python and mpi support. you can follow installing Neuron section of this installation guide. If you do not have mpi package installed, you can follow this guide in order to install Openmpi 1.8. (make sure there is no error while compiling Neuron package and installing python package from nrnpython directory)

2) Change directory to example_2, and run nrnpyenv.sh command, and do the exports suggested as the result of this script (if needed).

3) Then run nrnivmodl command. All *.mod files will be compiled under x86_64 directory.

4) Now run this command in the same directory:

nrniv -python optimization.py
travs commented 9 years ago

Thanks Vahid!

I finally got Neuron installed, though it was a really bumpy road.

In (2), where are you getting nrnpyenv.sh? I couldn't find that file anywhere.

I tried running (3), then (4), and everything seemed to be going fine but I got an error when matplotlib tried to output a png. Maybe it's something I'm missing from (2)?

VahidGh commented 9 years ago

nrnpyenv.sh is a file from Neuron+python package for checking environment variables. This file is automatically added to /usr/local/bin/nrnpyenv.sh at the installation time. You just need to type it in your shell and press enter and then check if your environment variables are set correctly.

But I don't think the error for matplotlib is related to this file! Can you post the error message you are getting?

travs commented 9 years ago

Hmm, I don't have that file for some reason...

The error I got was

libpng error: zlib error
Traceback (most recent call last):
  File "optimization.py", line 413, in <module>
    plt.savefig("surrogate_vs_candidates.png",bbox_inches='tight',format='png')
  File "/home/travis/worm/neurotune/venv/local/lib/python2.7/site-packages/matplotlib-1.4.3-py2.7-linux-x86_64.egg/matplotlib/pyplot.py", line 577, in savefig
    res = fig.savefig(*args, **kwargs)
  File "/home/travis/worm/neurotune/venv/local/lib/python2.7/site-packages/matplotlib-1.4.3-py2.7-linux-x86_64.egg/matplotlib/figure.py", line 1476, in savefig
    self.canvas.print_figure(*args, **kwargs)
  File "/home/travis/worm/neurotune/venv/local/lib/python2.7/site-packages/matplotlib-1.4.3-py2.7-linux-x86_64.egg/matplotlib/backend_bases.py", line 2158, in print_figure
    **kwargs)
  File "/home/travis/worm/neurotune/venv/local/lib/python2.7/site-packages/matplotlib-1.4.3-py2.7-linux-x86_64.egg/matplotlib/backends/backend_agg.py", line 533, in print_png
    filename_or_obj, self.figure.dpi)
RuntimeError: Error building image
VahidGh commented 9 years ago

Maybe trying to update/re-installation of matplotlib, and/or libpng , zlib packages would be helpful!

travs commented 9 years ago

Still have not gotten the NEURON examples (example_1 and example_2) to run, but example_3 is working fine for me.

pgleeson commented 9 years ago

@travs, this does seem like a problem with Neuron/nenivmodl and/or matplotlib on your machine. Try: https://github.com/OpenSourceBrain/GranCellSolinasEtAl10/blob/master/NEURON/test.py. Until you can get a model like that running you won't get examples 1/2 running successfully.