Either nrngui or conda-forge neuron work, but not both?

Post Reply
ssp
Posts: 4
Joined: Thu Oct 04, 2018 11:20 am

Either nrngui or conda-forge neuron work, but not both?

Post by ssp »

I have installed neuron in an Ubuntu 18.04.1 machine and nrngui and nrniv work fine.
I can also run python code with

Code: Select all

nrniv -python foo.py
The code of foo.py is simply

Code: Select all

from neuron import h, gui
import math

# Create the graph
g = h.Graph()

# specify coordinate system for the canvas drawing area
# numbers are: xmin, xmax, ymin, ymax respectively
g.size(0, 10, -1, 1)

# the next g.line command will move the drawing pen to the
# indicated point without drawing anything
g.beginline()

# define a sine wave, 0 <= x <= 10
for i in range(101):
    x = i * 0.1
    g.line(x, math.sin(x))

# actually draw the plot on the graph in the window
g.flush()
and the code pops up an Iconify window and plots a graph.

However if I try

Code: Select all

python foo.py
then I get a ModuleNotFoundError: No module named 'neuron'


On the other hand, if I install the neuron package using

Code: Select all

$ conda install -c conda-forge neuron
then when runing

Code: Select all

$ python foo.py
ModuleNotFoundError' goes away but I do not get the Iconify window with the graph, and even worse, if I try now

Code: Select all

$ nrngui
I get back the usual message in the terminal

Code: Select all

NEURON -- VERSION 7.6.2-3-g9f36b13 master (9f36b13) 2018-08-28
Duke, Yale, and the BlueBrain Project -- Copyright 1984-2018
See http://neuron.yale.edu/neuron/credits

oc>
but the Neuron gui bar does not appear.

If I remove the package

Code: Select all

conda remove -c conda-forge neuron
now nrngui works normally again

Any ideas?

Thanks
ted
Site Admin
Posts: 6287
Joined: Wed May 18, 2005 4:50 pm
Location: Yale University School of Medicine
Contact:

Re: Either nrngui or conda-forge neuron work, but not both?

Post by ted »

However if I try

Code: Select all

python foo.py
then I get a ModuleNotFoundError: No module named 'neuron'
I'm assuming you installed NEURON from source code, but skipped the final step

Code: Select all

# as root
cd src/nrnpython
python setup.py install
ssp
Posts: 4
Joined: Thu Oct 04, 2018 11:20 am

Re: Either nrngui or conda-forge neuron work, but not both?

Post by ssp »

No, in fact I installed NEURON just by clicking Download 64 bit .deb and then accepting the default option in Ubuntu that was Open with Software Install
ted
Site Admin
Posts: 6287
Joined: Wed May 18, 2005 4:50 pm
Location: Yale University School of Medicine
Contact:

Re: Either nrngui or conda-forge neuron work, but not both?

Post by ted »

Well, look at NEURON's installation tree on your machine, and if you find a src/nrnpython/setup.py file, you know what to do. If you don't find such a file, but you want Python to use NEURON as a module, you'll have to do something else.
ssp
Posts: 4
Joined: Thu Oct 04, 2018 11:20 am

Re: Either nrngui or conda-forge neuron work, but not both?

Post by ssp »

Thanks for the response.

There is no src/nrnpython/setup.py file in the NEURON's installation tree.

Apparently NEURON is installed in /usr/local/nrn, and the folders inside nrn are:

Code: Select all

/usr/local/nrn$ ls
include  lib  share  x86_64
with no setup.py file inside

In any case, I know what to do to make Python use NEURON as a module, I just have to install the module via

Code: Select all

$ conda install -c conda-forge neuron
But, the problem is that when I do that, nrngui does not work any more.
For example, after installing the neuron module via conda, all the instructions in your tutorial https://www.neuron.yale.edu/neuron/stat ... tick1.html work fine, except

Code: Select all

shape_window = h.PlotShape()
and

Code: Select all

shape_window.exec_menu('Show Diam')
that do not produce any image.
ted
Site Admin
Posts: 6287
Joined: Wed May 18, 2005 4:50 pm
Location: Yale University School of Medicine
Contact:

Re: Either nrngui or conda-forge neuron work, but not both?

Post by ted »

I know what to do to make Python use NEURON as a module, I just have to install the module via

Code: Select all

$ conda install -c conda-forge neuron
But, the problem is that when I do that, nrngui does not work any more.
My suggestion would have been to install NEURON from source code*--specifically, source code downloaded from www.neuron.yale.edu, not software obtained from a repository set up by some third party. The internet is full of all kinds of stuff. Anyone on the planet can grab code from NEURON's official web site, do whatever they like to it, and post it online somewhere. Who is responsible for the "neuron" package at conda-forge? What are that person's qualifications, and how is he or she connected to the NEURON project? What is the status of the files in that repository, relative to the official NEURON repository at github? Maybe the answers to these questions are all good, and maybe that person can help you with your issue.

*--That source code comes with src/nrnpython/setup.py.
ssp
Posts: 4
Joined: Thu Oct 04, 2018 11:20 am

Re: Either nrngui or conda-forge neuron work, but not both?

Post by ssp »

OK, thanks

I first installed NEURON from the .deb precompiled installer in the official site https://neuron.yale.edu/ftp/neuron/vers ... -35-27.deb

with all the problems I reported

Finally, forgetting about the .deb precompiled installer and installing from the source code instead solved the problem
Post Reply