libnrnpython3 and libnrnpython2 on High Sierra

Post Reply
wpettine
Posts: 4
Joined: Fri Jan 05, 2018 11:12 am

libnrnpython3 and libnrnpython2 on High Sierra

Post by wpettine » Wed Jan 10, 2018 10:45 am

I am trying to install neuron on High Sierra and am running into an issue with libnrnpython3 and libnrnpython2. Specifically, it is showing the output below upon startup. It then cannot run neuron files.
NEURON -- VERSION 7.5 master (b14b5dd) 2017-12-21
Duke, Yale, and the BlueBrain Project -- Copyright 1984-2016
See http://neuron.yale.edu/neuron/credits

loading membrane mechanisms from /Applications/NEURON-7.5/nrn/share/nrn/demo/release/x86_64/.libs/libnrnmech.so
Additional mechanisms from files
cabpump.mod cachan1.mod camchan.mod capump.mod invlfire.mod khhchan.mod mcna.mod nacaex.mod nachan.mod release.mod
Could not load either libnrnpython3 or libnrnpython2
pyver10=0 pylib=/System/Library/Frameworks/CoreFoundation.framework/Versions/A/CoreFoundation
Prior to installation of neuron through the package, I installed the following dependencies
- Xquartz
- Command line tools
- open MPI
- Anaconda (I had a pre-existing full installation)

I tried installing from the package provided on the following link:
https://www.neuron.yale.edu/neuron/download

I also tried compiling based on the instructions given here:
https://www.neuron.yale.edu/neuron/down ... ilestd_osx

Furthermore, libnrnpython3 and libnrnpython2 both exist on my machine, and appear entirely intact.

Any suggestions?

hines
Site Admin
Posts: 1494
Joined: Wed May 18, 2005 3:32 pm

Re: libnrnpython3 and libnrnpython2 on High Sierra

Post by hines » Wed Jan 10, 2018 11:32 am

I'm a little confused by
NEURON -- VERSION 7.5 master (b14b5dd) 2017-12-21
because this change is later than the latest alpha distribution of
https://neuron.yale.edu/ftp/neuron/vers ... 64-osx.pkg
which is

Code: Select all

#define GIT_DATE "2017-12-07"
#define GIT_BRANCH "master"
#define GIT_CHANGESET "c693a84"
#define GIT_LOCAL "1670"
I don not recall distributing as a package...

Code: Select all

#define GIT_DATE "2017-12-21"
#define GIT_BRANCH "master"
#define GIT_CHANGESET "b14b5dd"
#define GIT_LOCAL "1673"
Anyway, perhaps the problem will go away if you download and install the above package since there was a fix to nrnpyenv.sh which is a bit
more robust. ie.
https://github.com/nrnhines/nrn/commit/ ... d678c72b4d
or download the nrnpyenv.sh from there and use it to replace your present version of that file (in /Applications/NEURON-7.5/nrn/x86_64/bin)

wpettine
Posts: 4
Joined: Fri Jan 05, 2018 11:12 am

Re: libnrnpython3 and libnrnpython2 on High Sierra

Post by wpettine » Tue Jan 16, 2018 3:34 pm

Thanks for the reply! I set it up to notify me with replies now, so will respond faster.

I think the line
NEURON -- VERSION 7.5 master (b14b5dd) 2017-12-21
probably had something to do with installing by compilation.

I tried replacing the file nrnpyenv.sh in the relevent folder and continued getting the error. I also deleted everything, and reinstalled from the package you recommended, and continue to get the error. Here's the output
-e
NEURON -- VERSION 7.5 master (c693a84) 2017-12-07
Duke, Yale, and the BlueBrain Project -- Copyright 1984-2016
See http://neuron.yale.edu/neuron/credits

loading membrane mechanisms from /Applications/NEURON-7.5/nrn/share/nrn/demo/release/x86_64/.libs/libnrnmech.so
Additional mechanisms from files
cabpump.mod cachan1.mod camchan.mod capump.mod invlfire.mod khhchan.mod mcna.mod nacaex.mod nachan.mod release.mod
Could not load either libnrnpython3 or libnrnpython2
pyver10=0 pylib=/System/Library/Frameworks/CoreFoundation.framework/Versions/A/CoreFoundation
oc>

hines
Site Admin
Posts: 1494
Joined: Wed May 18, 2005 3:32 pm

Re: libnrnpython3 and libnrnpython2 on High Sierra

Post by hines » Wed Jan 17, 2018 5:34 pm

running into an issue with libnrnpython3 and libnrnpython2
This caused me to leap to the conclusion that you had installed a package. I.e very few people use options like
--with-nrnpython=dynamic --with-pyexe=python3 --with-nrnpython-only
which are useful for making a python independent distribution
VERSION 7.5 master (b14b5dd) 2017-12-21
But this invalidated my conclusion since there was no such package distributed.
probably had something to do with installing by compilation.
So my advice about updating nrnpyenv.sh was flawed as you already had the most recent version.

Now that I'm on the same page as you, I need to ask how you configured the neuron build.
Also, what is the result if you
export PYTHONPATH=/Applications/NEURON-7.5/nrn/lib/python
python
from neuron import h.
Also, what is the result of
unset PYTHONHOME
unset NRN_PYLIB
nrnpyenv.sh

wpettine
Posts: 4
Joined: Fri Jan 05, 2018 11:12 am

Re: libnrnpython3 and libnrnpython2 on High Sierra

Post by wpettine » Thu Jan 18, 2018 9:08 am

Here's the output. Thanks again!
$ export PYTHONPATH=/Applications/NEURON-7.5/nrn/lib/python
$ python
Python 3.6.3 |Anaconda, Inc.| (default, Oct 6 2017, 12:04:38)
[GCC 4.2.1 Compatible Clang 4.0.1 (tags/RELEASE_401/final)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> from neuron import h
NEURON -- VERSION 7.5 master (c693a84) 2017-12-07
Duke, Yale, and the BlueBrain Project -- Copyright 1984-2016
See http://neuron.yale.edu/neuron/credits

>>>
$ unset PYTHONHOME
$ unset NRN_PYLIP
$ nrnpyenv.sh
# nrn_pylib from PYLIB_DARWIN /System/Library/Frameworks/CoreFoundation.framework/Versions/A/CoreFoundation
# items in sys.path = 7
# beginning with sys.prefix = 5
# site-3 same as sys.prefix
# in neither location ['.', '/Applications/NEURON-7.5/nrn/lib/python']
# sys.prefix = /anaconda3
# site-3 = /anaconda3

# if launch python, then need:
export PYTHONPATH="/Applications/NEURON-7.5/nrn/lib/python"

# if launch nrniv, then likely need:
export PYTHONHOME="/anaconda3"
export NRN_PYLIB="/System/Library/Frameworks/CoreFoundation.framework/Versions/A/CoreFoundation"

hines
Site Admin
Posts: 1494
Joined: Wed May 18, 2005 3:32 pm

Re: libnrnpython3 and libnrnpython2 on High Sierra

Post by hines » Thu Jan 18, 2018 11:08 am

Ok. Thinks look right now as though it all should work. But you did not tell me what configure statement you used .
Also what do you get with
export PYTHONHOME="/anaconda3"
export NRN_PYLIB="/System/Library/Frameworks/CoreFoundation.framework/Versions/A/CoreFoundation"
nrniv -python
from neuron import h


it may be that you problem was merely that the above variables did not make it into your environment. Note that instead of copying/pasting the
output of nrnpyenv.sh into your terminal you can also
source nrnpyenv.sh

Depending on the configure statement, you may not need NRN_PYLIB. The latter is generally needed only when --with-nrnpython=dynamic
is used.

wpettine
Posts: 4
Joined: Fri Jan 05, 2018 11:12 am

Re: libnrnpython3 and libnrnpython2 on High Sierra

Post by wpettine » Thu Jan 18, 2018 4:00 pm

Regarding the configure statement, for this install I just used the package you linked. Do you mean something else?
$ export PYTHONHOME="/anaconda3"
$ export NRN_PYLIB="/System/Library/Frameworks/CoreFoundation.framework/Versions/A/CoreFoundation"
$ nrniv -python
NEURON -- VERSION 7.5 master (c693a84) 2017-12-07
Duke, Yale, and the BlueBrain Project -- Copyright 1984-2016
See http://neuron.yale.edu/neuron/credits

Could not load either libnrnpython3 or libnrnpython2
pyver10=0 pylib=/System/Library/Frameworks/CoreFoundation.framework/Versions/A/CoreFoundation
Python not available
As python didn't start, I was unable to run "from neuron import h"

hines
Site Admin
Posts: 1494
Joined: Wed May 18, 2005 3:32 pm

Re: libnrnpython3 and libnrnpython2 on High Sierra

Post by hines » Thu Jan 18, 2018 5:00 pm

Please send me the output from a terminal window of

Code: Select all

python
import os, subprocess
pid = os.getpid()
cmd = "lsof -p %d"%pid
f = subprocess.Popen(cmd.split(), stdout=subprocess.PIPE, stderr=subprocess.STDOUT).stdout
for bline in f:
    fields = bline.decode().split()
    if len(fields) > 8:
      print (fields[8])

email the output to michael.hines@yale.edu.

HoodyE90
Posts: 3
Joined: Thu Feb 01, 2018 8:55 pm

Re: libnrnpython3 and libnrnpython2 on High Sierra

Post by HoodyE90 » Fri Feb 02, 2018 3:21 pm

I'm not the OP, but am having the same issue (see my thread regarding MacOS High Sierra). Here's the output (I have omitted my user account)

Code: Select all

/System/Library/Frameworks/Python.framework/Versions/2.7/Resources/Python.app/Contents/MacOS/Python
/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/lib-dynload/_locale.so
/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/lib-dynload/readline.so
/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/lib-dynload/time.so
/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/lib-dynload/select.so
/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/lib-dynload/fcntl.so
/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/lib-dynload/_struct.so
/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/lib-dynload/binascii.so
/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/lib-dynload/cStringIO.so
/usr/lib/dyld
/private/var/db/dyld/dyld_shared_cache_x86_64h
/dev/ttys000
/dev/ttys000
/dev/ttys000
>>> 

hines
Site Admin
Posts: 1494
Joined: Wed May 18, 2005 3:32 pm

Re: libnrnpython3 and libnrnpython2 on High Sierra

Post by hines » Fri Feb 02, 2018 3:47 pm

In an earlier message, it was stated:
$ export NRN_PYLIB="/System/Library/Frameworks/CoreFoundation.framework/Versions/A/CoreFoundation"
And I see that you have a first line output of
/System/Library/Frameworks/Python.framework/Versions/2.7/Resources/Python.app/Contents/MacOS/Python
In you case it seems that nrnpyenv.sh might work correctly. What do you get in response to
unset PYTHONHOME
nrnpyenv.sh

Perhaps if you use the resulting PYTHONHOME and NRN_PYLIB, you will be able to
nrniv -python
without an error.

HoodyE90
Posts: 3
Joined: Thu Feb 01, 2018 8:55 pm

Re: libnrnpython3 and libnrnpython2 on High Sierra

Post by HoodyE90 » Fri Feb 02, 2018 4:32 pm

Here's the output:

Code: Select all

# nrn_pylib from PYLIB_DARWIN /Library/Frameworks/Python.framework/Versions/2.7/Python
# items in sys.path = 11
# beginning with sys.prefix = 9
# site-3 same as sys.prefix
# in neither location ['.', '/Applications/NEURON-7.5/nrn/lib/python']
# sys.prefix = /Library/Frameworks/Python.framework/Versions/2.7
# site-3 = /Library/Frameworks/Python.framework/Versions/2.7

# if launch python, then need:
export PYTHONPATH="/Applications/NEURON-7.5/nrn/lib/python"

# if launch nrniv, then likely need:
export PYTHONHOME="/Library/Frameworks/Python.framework/Versions/2.7"
export NRN_PYLIB="/Library/Frameworks/Python.framework/Versions/2.7/Python"

However, I encounter the same error when executing nrniv -python :

Code: Select all

NEURON -- VERSION 7.5 master (4e5aee6) 2018-01-31
Duke, Yale, and the BlueBrain Project -- Copyright 1984-2016
See http://neuron.yale.edu/neuron/credits

Could not dlopen NRN_PYLIB: /System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/lib-dynload/_locale.so
When I attempt to launch the GUI, here's the output:

Code: Select all

-e 
# PYTHONHOME exists. Do nothing
Attempt to fix nrniv failure using: eval "`mk_nrnpyenv.sh`" failed.
NEURON -- VERSION 7.5 master (4e5aee6) 2018-01-31
Duke, Yale, and the BlueBrain Project -- Copyright 1984-2016
See http://neuron.yale.edu/neuron/credits

Could not dlopen NRN_PYLIB: /System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/lib-dynload/_locale.so
nrngui exit status was 1
Press return key to exit

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

Re: libnrnpython3 and libnrnpython2 on High Sierra

Post by ted » Fri Feb 02, 2018 11:46 pm

Moderator's note:
The Forum's entropy is high enough already without the kind of thread fragmentation that results when users make multiple posts about the same problem. HoodyE90's post from earlier today, entitled
Neuron 7.5 on MacOS High Sierra Problems
has now been deleted. Here is the unique content from that post in case it provides further clues or is of interest to others:
I am attempting to run Neuron 7.5 on the latest release of MacOS High Sierra, 10.13.3. I have both tried compiling Neuron manually, as well as installing Neuron from the main "downloads" page, and in both cases, Neuron is unable to communicate with the Python 2.7 library. I have gcc, X11, and open MPI installed. I have tried running it both with and without an install of both Anaconda 2 and 3, and have tried updating the nrnpynev.sh file linked in another post. In all cases the error is the same
(after which followed the "Could not dlopen NRN_PYLIB..." error message)

hines
Site Admin
Posts: 1494
Joined: Wed May 18, 2005 3:32 pm

Re: libnrnpython3 and libnrnpython2 on High Sierra

Post by hines » Sat Feb 03, 2018 9:20 am

My guess is that the attempt to launch the gui failed because a bad NRN_PYLIB is already specified in your $HOME/.bash_profile
and nrnpyenv.sh did not d o anything because PYTHONHOME already exists in your environment (set in $HOME/.bash_profile as well)

Code: Select all

# PYTHONHOME exists. Do nothing
Thus the experiment at your terminal resulted in ( am presuming you executed "unset PYTHONHOME" in the terminal previously

Code: Select all

# if launch nrniv, then likely need:
export PYTHONHOME="/Library/Frameworks/Python.framework/Versions/2.7"
export NRN_PYLIB="/Library/Frameworks/Python.framework/Versions/2.7/Python"
wheras the automatic launch got the variables from.bash_profile and

Code: Select all

# PYTHONHOME exists. Do nothing
Attempt to fix nrniv failure using: eval "`mk_nrnpyenv.sh`" failed.
There is a good chance your problem will be fixed by editing .bash_profile and replacing the PYTHONHOME and NRN_PYLIB lines with the above.

HoodyE90
Posts: 3
Joined: Thu Feb 01, 2018 8:55 pm

Re: libnrnpython3 and libnrnpython2 on High Sierra

Post by HoodyE90 » Sat Feb 03, 2018 10:28 am

Thanks! This worked!

ImageScreen Shot 2018-02-03 at 10.25.24 AM by farhanhoodbhoy, on Flickr

Post Reply