How to import neuron in Jupyter Notebook?


#1

Hi,

I tried to install NEURON in order to import it in Jupyter Notebook and I get
error: could not create ‘/usr/lib64’: Permission denied

How should I install NEURON in order to be able to import in in Jupyter Notebook?


#2

Hi,

Yes, unfortunately now it is not possible to install NEURON in the notebook as soon as it requires root privileges.
We will try to fix it somehow in the next release which should be in about two weeks from now.

Regards,
Yury


#3

Hi,

does this also hold for NEST?
Is it possible to import NEST in a Notebook?

Best,
Johanna


#4

Hi,

NEST is not installed by default in jupyter notebook environment as well.
Usually python packages can be installed from the notebook with !pip2 install command. Example
https://collab.humanbrainproject.eu/#/collab/509/nav/4946

But in case of NEST I don’t know how it is supposed to be installed. Is it a python package or something else.
I found this page
http://www.nest-simulator.org/installation/
If it is the installation process you can try to do the same from the notebook using !.

Another note. Don’t forget that at the moment notebooks are running on quite small VM and it is not supposed to be used to run code which require a lot of CPU/memory resources.

Yury


#5

When pip installing Neuron one indeed needs root access (to install in /usr/)
But Neuron can also be installed as user, when compiled from source.
I’ve been trying to create a script for it yesterday, was almost there, but unfortunately half of it was lost when my iPython notebook was not saving itself when I guess the token expired (and didn’t tell me about it).

Since Neuron and NEST are such common tools used in the HBP, I think it should be part of the default install on these VMs. And yes, indeed, we shouldn’t use too much CPU, but this would just be for quick testing to see if the code works.


#6

NEURON is installed by default since latest release.
You can find more details here
https://collab.humanbrainproject.eu/#/collab/509/nav/6058

Yury


#7

Hi Yury,

we are currently able to use NEST within the task framework by listing “bbp-hpc-2015.R2==0.0.0” among the task requirements, meaning that there is already a NEST version installed. I do not know if we can access this version from a notebook, can we?

In order to access PyNEST from within the notebooks by “import nest”, it is necessary to link NEST during installation to the available Python version. I guess that this should be done globally as described at the NEST installation page that you mentioned above:
When configuring NEST, one can use the flag --with-python and set the path to where PyNEST shall be put with --with-pynest-prefix=… to a location accessible in the search path PYTHONPATH.

Best,
Johanna


#8

Hi Johanna,

Tasks and jupyter notebooks are running independently. So when you put “bbp-hpc-2015.R2==0.0.0” to task requirements it is a “hint” to task framework to load proper module before running a task in our cluster. Jupyter notebooks are running in another separate server which doesn’t have anything in common with the cluster. And the current situation is the NEST is not provided from the box in the jupyter notebook.

I created an example showing how you can install it for yourself here:
https://collab.humanbrainproject.eu/#/collab/509/nav/6516

We will think about providing NEST from the box in the future.

Yury


#9

Hi Yury,

thanks for your answers and for creating the example notebook.
We would definitely appreciate it a lot if NEST could be installed by default. Thank you!

Best,
Johanna


#10

Hi Yury,

now I can import neuron in my jupyter notebook. What about compiling mod files? How can I do this from jupyter notebook? Any suggestions?

Best,
Carmen


#11

Hi,

There is nrnivmodl in /usr/local/nrn/x86_64/bin/nrnivmodl. So you can try to download your mod files and call it either with suprocess or like !cd ; /usr/local/nrn/x86_64/bin/nrnivmodl

Yury


#12

Hi Yuri (and other NEST users),

I have installed NEST with your example, but if I want to use some kinds of neurons (e.g. iaf_cond_exp) NEST throws an error:

> NESTError: UnknownModelName in Create_l_i: /iaf_cond_exp is not a known model name. Please check the modeldict for a list of available models. A frequent cause for this error is that NEST was compiled without the GNU Scientific Library, which is required for the conductance-based neuron models.

How can I install the GSL libraries?
I have tried the same approach as used for NEST, installing gsl-2.1, but it throws another error when I try to “make install” it.

/bin/mkdir -p ‘/usr/local/include/gsl’
/bin/mkdir: cannot create directory ‘/usr/local/include/gsl’: Permission denied
make[2]: *** [install-pkgincludeHEADERS] Error 1
make[2]: Leaving directory /home/jupyter/gsl-build/sys'* *make[1]: *** [install-am] Error 2* *make[1]: Leaving directory/home/jupyter/gsl-build/sys’
make: *** [install-recursive] Error 1

Thank you for your help!

Best,
Alberto


#13

Hi Alberto,

you can use the same value for prefix when run configure for gsl
like ./configure --prefix=$HOME/.local

and then after gsl will be installed you can set the GSL_CONFIG environment variable to the
full path to gsl-config for NEST to know where GSL is located (it will $HOME/.local/bin)

Yury


#14

Thank you Yury!

Alberto