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

Python bindings not working on MacOS when using anaconda #209

Open
Jean1995 opened this issue Oct 4, 2021 · 4 comments
Open

Python bindings not working on MacOS when using anaconda #209

Jean1995 opened this issue Oct 4, 2021 · 4 comments

Comments

@Jean1995
Copy link
Member

Jean1995 commented Oct 4, 2021

There is an issue on MacOS machines using anaconda when trying to import proposal in Python.

The installation (either using pip or manually) is working fine, however, import proposal leads to the error

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

or

zsh: segmentation fault  python3

Apparently, this is an issue with pybind11 (see here or here or here). The discussions say that this might have to do with conda python and the python package being built with different Clang versions. However, the issue does not seem to be resolved, and I couldn't find any viable solutions for this issue yet.

There is a github actions run where the issue has been reproduced, although I am not entirely sure whether this is the same problem (see here)

@maxnoe
Copy link
Member

maxnoe commented Oct 5, 2021

Does compiling proposal with the conda compiler work?

This also might be a reason to do a conda forge package.

@Jean1995
Copy link
Member Author

Jean1995 commented Oct 6, 2021

@pascalgutjahr and I tried using the conda compiler by using conda install -c conda-forge compilers without success.

Looking at the pybind11 issue there seems to be a lively discussion on the problem now, but I did not find the time to work through all the ideas that were brought up. But it looks like the problem is also connected to conan and the way pybind11 is packaged there.

So for now, the easiest solution is probably to try installing PROPOSAL without conan, i.e. installing all dependencies manually.

@pascalgutjahr
Copy link
Collaborator

pascalgutjahr commented Oct 13, 2021

The installation still does not work with conda, but it works in a virtual environment for both OS X 11.6 and 10.15.7. For the installation you can use the way via conan. I have done it in the following way:

conda deactivate
python3 - m venv proposal_env
export PYTHONPATH=/Users/pgutjahr/Documents/PROPOSAL/build/package/lib:$PYTHONPATH

It's import to add the path of the PROPOSAL library to the PYTHONPATH, otherwise python can not find the module.
Since I usually activate the conda environment in my .bash_profile, I added the deactivation of conda and the export of the PYTHONPATH to the activation script of my virtual environment. So you just have to source the virtual environment and you are able to run PROPOSAL.

@Jean1995
Copy link
Member Author

As the problem is still not fixed, the simplest workaround to install proposal via pip is still:

conda deactivate #in case you are still in your conda base environment
python3 - m venv proposal_env
pip install proposal

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants