Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Issue with Anaconda Python on Mac (and Intel compiler on Mac, problem with PYTHONHOME) #618

Closed
nrnhines opened this issue Jun 28, 2020 · 3 comments
Labels
Milestone

Comments

@nrnhines
Copy link
Member

Pull request #608 left off with a comment about building with

cmake .. -DNRN_ENABLE_INTERVIEWS=OFF -DCMAKE_INSTALL_PREFIX=install -DPYTHON_EXECUTABLE=/opt/intel/intelpython3/bin/python3.7 -DCMAKE_C_COMPILER=icc -DCMAKE_CXX_COMPILER=icpc -DNRN_ENABLE_PYTHON_DYNAMIC=ON
make -j install

but I need to debug

unset PYTHONHOME
unset NRN_PYLIB
$ nrniv -python -pyexe /opt/intel/intelpython3/bin/python3.7
NEURON -- VERSION 8.0.dev-126-gdb89341a pramodk/osx-intel (db89341a) 2020-06-24
Duke, Yale, and the BlueBrain Project -- Copyright 1984-2019
See http://neuron.yale.edu/neuron/credits

Could not find platform independent libraries <prefix>
Could not find platform dependent libraries <exec_prefix>
Consider setting $PYTHONHOME to <prefix>[:<exec_prefix>]
Fatal Python error: initfsencoding: unable to load the file system codec
ModuleNotFoundError: No module named 'encodings'

For dynamic python loading this is resolved with pull request #617 but there remain two issues with
-DNRN_ENABLE_PYTHON_DYNAMIC=OFF

First, when launching nrniv one needs an explicit PYTHONHOME

export PYTHONHOME="/opt/intel/intelpython3"
$ nrniv -python
NEURON -- VERSION 8.0.dev-124-g2c0a97a8 nrnpy-pyhome (2c0a97a8) 2020-06-27
Duke, Yale, and the BlueBrain Project -- Copyright 1984-2019
See http://neuron.yale.edu/neuron/credits

>>> from neuron import h
>>> ^D
$unset PYTHONHOME
$ nrniv -python
NEURON -- VERSION 8.0.dev-124-g2c0a97a8 nrnpy-pyhome (2c0a97a8) 2020-06-27
Duke, Yale, and the BlueBrain Project -- Copyright 1984-2019
See http://neuron.yale.edu/neuron/credits

Could not find platform independent libraries <prefix>
Could not find platform dependent libraries <exec_prefix>
Consider setting $PYTHONHOME to <prefix>[:<exec_prefix>]
Fatal Python error: initfsencoding: unable to load the file system codec
ModuleNotFoundError: No module named 'encodings'

Current thread 0x000000010ee28dc0 (most recent call first):
Abort trap: 6

That is not a huge problem. Much worse is launching

$ /opt/intel/intelpython3/bin/python3.7
Python 3.7.7 (default, Mar 13 2020, 09:43:04) 
[Clang 4.0.1 (tags/RELEASE_401/final)] :: Intel(R) Corporation on darwin
Type "help", "copyright", "credits" or "license" for more information.
Intel(R) Distribution for Python is brought to you by Intel Corporation.
Please check out: https://software.intel.com/en-us/python-distibution
>>> from neuron import h
Fatal Python error: PyMUTEX_LOCK(_PyRuntime.ceval.gil.mutex) failed

Abort trap: 6

Perhaps some hints that can help are

$ otool -l install/bin/nrniv|grep -A 3 LC_RPATH | grep path
         path /Users/michaelhines/neuron/nrnicc/build/install/lib (offset 12)
         path /opt/intel/intelpython3/lib (offset 12)

$ otool -l /opt/intel/intelpython3/bin/python3.7 |grep -A 3 LC_RPATH | grep path
         path /localdisk/tc/agent2/work/77d6987f4a2d253e/conda-build/python_1584108639102/_h_env_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_pl/lib (offset 12)
         path /localdisk/tc/agent2/work/77d6987f4a2d253e/conda-build/python_1584108639102/_h_env_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_pl/lib (offset 12)
         path @loader_path/../lib/ (offset 12)

$ otool -l install/lib/python/neuron/hoc.cpython-37m-darwin.so |grep -A 3 LC_RPATH | grep path
         path @loader_path/../../ (offset 12)
         path /../lib (offset 12)
@nico-canta
Copy link

I would like to share the output I get. In my case I installed python through Anaconda.

Python 3.8.8 (default, Apr 13 2021, 12:59:45) 
[Clang 10.0.0 ] :: Anaconda, Inc. on darwin

>>> import neuron
Fatal Python error: PyMUTEX_LOCK(gil->mutex) failed
Python runtime state: unknown

Abort trap: 6

@pramodk
Copy link
Member

pramodk commented Aug 31, 2021

@alexsavulescu : I think this is worth adding to our next release milestone. I thought this is only with Intel Python but now reproducible with Anaconda python on MacOS as well.

@alexsavulescu alexsavulescu added this to the Release v8.1 milestone Aug 31, 2021
@pramodk pramodk modified the milestones: Release v8.2, Release v9.0 May 24, 2022
olupton pushed a commit that referenced this issue Dec 7, 2022
* Azure CI can be launched manually to upload wheels
   to nmodl-nightly or nmodl projects on pypi.org
 * Open Azure Web UI and set following variables:
   - `ReleaseWheelBuild = True` to build the wheels
     without nightly tag i.e. release wheel
   - `UploadWheel = False` to disable uploading wheels
     to pypi.org. This is useful for testing where
     wheels are built but they are not uploaded
   - `NMODL_WHEEL_VERSION = x.y` to override the version
     number created by `git describe --tags` command.
     This is helpful for testing/development purpose
     as pypi.org doesn't allow to upload same version
     wheels.
@pramodk pramodk changed the title Intel compiler on Mac, problem with PYTHONHOME Issue with Anaconda Python on Mac (and Intel compiler on Mac, problem with PYTHONHOME) Sep 6, 2024
@pramodk
Copy link
Member

pramodk commented Sep 23, 2024

import neuron
Fatal Python error: PyMUTEX_LOCK(gil->mutex) failed
Python runtime state: unknown

I tested this with the latest neuron (e.g. #3088) and Anaconda installation, I see that everything is working fine:

$ PYTHONPATH=/Users/kumbhar/workarena/repos/bbp/nrn/build_conda_native/install/lib/python:$PYTHONPATH  /opt/anaconda3/bin/python3
Python 3.12.4 | packaged by Anaconda, Inc. | (main, Jun 18 2024, 10:07:17) [Clang 14.0.6 ] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import neuron
>>>

I will close this as the Intel toolchain on Mac is not that relevant anymore.

@pramodk pramodk closed this as completed Sep 23, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

4 participants