I am trying to install and run neuron 7.5 inside a virtual environment in Ubuntu18.04.3. I am not an experienced Linux user. Anaconda is already installed with python3, which I use for other projects, and I want to run neuron with python2. So, the general idea here is to create a virtual environment with python2 using Anaconda (e.g.: 'conda create -n my_env python=2.7'), install neuron in it and then run it. Some solutions to related problems found in this forum involved removing anaconda, but I cannot do that since I use it in other projects. It seems like a PATH problem to me, but I’m not sure.
Please let me number what I have done so far to facilitate any answer.
1. Downloading .deb file (with Anaconda previously installed)
I have downloaded Neuron7.5.deb (https://neuron.yale.edu/ftp/neuron/versions/v7.5/) and installed it following your quickguide (https://www.neuron.yale.edu/ftp/neuron/ ... kstart.pdf). It seems it was installed, but I cannot run neuron (‘from neuron import h, gui') either inside ‘my_env’ (which has python2) or outside it (both situations return ‘No module named neuron’). The quickguide mentions "If this doesn’t work, it’s probably a PATH or PYTHONPATH issue.", but it doesn’t give any direction on how to solve it.
I have tried to add neuron to PATH and PYTHONPATH by editing the bashrc file (last lines shown below), re-openning the terminal and trying to run neuron again, but it still doesn’t work. Did I do it right?
Code: Select all
# >>> conda initialize >>>
# !! Contents within this block are managed by 'conda init' !!
__conda_setup="$('/home/marcelo/anaconda3/bin/conda' 'shell.bash' 'hook' 2> /dev/null)"
if [ $? -eq 0 ]; then
eval "$__conda_setup"
else
if [ -f "/home/marcelo/anaconda3/etc/profile.d/conda.sh" ]; then
. "/home/marcelo/anaconda3/etc/profile.d/conda.sh"
else
export PATH="/home/marcelo/anaconda3/bin:$PATH"
fi
fi
unset __conda_setup
# <<< conda initialize <<<
export PATH=$PATH:/usr/local/nrn/x86_64/bin
export PYTHONPATH=/home/usr/local/nrn/lib/python
I have also tried to compile neuron from source following these instructions (https://www.neuron.yale.edu/neuron/down ... pile_linux). This is the only situation where it actually works, but it runs with python3 and without any virtual environment. As I said, I would like to run it inside a virtual environment. If I install anaconda after this, create a virtual environment and try to run neuron inside it, it stops working again.
3. Compiling neuron from source (with Anaconda previously installed and added to path)
If Anaconda is already installed and added to PATH, I get many errors after ‘make –j’ for neuron (but nor for iv). Last part of the errors is shown below:
Code: Select all
libtool: link: g++ -pthread -g -O2 -o .libs/nrniv nvkludge.o ../ivoc/nrnmain.o ../ivoc/ivocmain.o ../oc/modlreg.o ../oc/ockludge.o ../nrnoc/.libs/libnrnoc.so ./.libs/libnrniv.so ../ivoc/.libs/libivoc.so ../oc/.libs/liboc.so -lX11 ../nrnmpi/.libs/libnrnmpi.so ../gnu/.libs/libneuron_gnu.so ../scopmath/.libs/libscopmath.so ../sparse13/.libs/libsparse13.so ../sundials/.libs/libsundials.so ../memacs/.libs/libmemacs.so ../mesch/.libs/libmeschach.so /usr/local/iv/x86_64/lib/libIVhines.so ../nrnpython/.libs/libnrnpython.so -L/home/marcelo/anaconda3/envs/modals_env/lib -lpython2.7 -lpthread -lutil ../readline/.libs/libreadline.so -lncurses -ltinfo -lm -ldl -pthread -Wl,-rpath -Wl,/home/marcelo/neuron/nrn-7.7/x86_64/lib -Wl,-rpath -Wl,/usr/local/iv/x86_64/lib -Wl,-rpath -Wl,/home/marcelo/anaconda3/envs/modals_env/lib
/usr/bin/ld: ../sundials/.libs/libsundials.so: undefined reference to `ompi_mpi_op_sum'
/usr/bin/ld: ../sundials/.libs/libsundials.so: undefined reference to `ompi_mpi_op_min'
/usr/bin/ld: ../memacs/.libs/libmemacs.so: undefined reference to `tgoto@NCURSES6_TINFO_5.0.19991023'
/usr/bin/ld: ../sundials/.libs/libsundials.so: undefined reference to `ompi_mpi_op_max'
/usr/bin/ld: ../sundials/.libs/libsundials.so: undefined reference to `nrnmpi_comm'
/usr/bin/ld: ../sundials/.libs/libsundials.so: undefined reference to `ompi_mpi_double'
/usr/bin/ld: ../memacs/.libs/libmemacs.so: undefined reference to `tgetent@NCURSES6_TINFO_5.0.19991023'
/usr/bin/ld: ../sundials/.libs/libsundials.so: undefined reference to `ompi_mpi_long'
/usr/bin/ld: ../sundials/.libs/libsundials.so: undefined reference to `MPI_Comm_size'
/usr/bin/ld: ../sundials/.libs/libsundials.so: undefined reference to `MPI_Allreduce'
/usr/bin/ld: ../memacs/.libs/libmemacs.so: undefined reference to `tgetnum@NCURSES6_TINFO_5.0.19991023'
/usr/bin/ld: ../memacs/.libs/libmemacs.so: undefined reference to `tputs@NCURSES6_TINFO_5.0.19991023'
/usr/bin/ld: ../memacs/.libs/libmemacs.so: undefined reference to `tgetstr@NCURSES6_TINFO_5.0.19991023'
collect2: error: ld returned 1 exit status
make[3]: *** [Makefile:749: nrniv] Error 1
make[3]: Leaving directory '/home/marcelo/neuron/nrn-7.7/src/nrniv'
make[2]: *** [Makefile:520: all-recursive] Error 1
make[2]: Leaving directory '/home/marcelo/neuron/nrn-7.7/src'
make[1]: *** [Makefile:657: all-recursive] Error 1
make[1]: Leaving directory '/home/marcelo/neuron/nrn-7.7'
make: *** [Makefile:515: all] Error 2
I have also tried to use pyenv to create virtual environments instead of anaconda. Neuron runs OK outside environment, but it doesn’t work when inside ‘my_env’, giving the same error (‘No module named neuron’).
5. Compiling neuron from source (without Anaconda installed, but using virtualenv)
Same situation as number 4.
What am I missing? Any solutions? By the way, in Windows, I was able to run it inside a virtual environment created with Anaconda Navigator. Thanks in advance for your attention.