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
get_include returns incorrect directory for custom prefixes #1425
Comments
I have this issue on my HPC system, which uses |
Note that right now my fix to find out the path to pybind11's include directory from another Python package is the following:
Surely this trick could be used directly inside |
It seems as the `pybind11` build code returns the Python headers directory (where the `pybind11` headers are stored as well on traditional setups) rather than returning the dedicated prefix[1]. An exemplary fallout is the broken build of `pyopencl`[2]. [1] pybind/pybind11#1425 [2] NixOS#56082
It seems as the `pybind11` build code returns the Python headers directory (where the `pybind11` headers are stored as well on traditional setups) rather than returning the dedicated prefix[1]. An exemplary fallout is the broken build of `pyopencl`[2]. [1] pybind/pybind11#1425 [2] #56082 (cherry picked from commit 94c3ac2)
I think this has been fixed in #2116 and 2.5.0, from what I can tell. I'll be working on something related soon, so please reopen if this is still a problem! |
Cool, a simple MWE (used to fail before) pip3 install --prefix /tmp/issue2116 .
cd /
PYTHON_VERSION=$(python3 -c 'import sysconfig; print(sysconfig.get_python_version(), end="")')
export PYTHONPATH="/tmp/issue2116/lib/python$PYTHON_VERSION/site-packages:$PYTHONPATH"
PYBIND11_INCLUDE_PATH=$(python3 -c 'import pybind11; print(pybind11.get_include(), end="")')
ls $PYBIND11_INCLUDE_PATH/pybind11
now working fine. |
Issue description
Custom installations of python, which don't install python modules to the usual single global
site-packages
directory, but rather use a separate directory for every python-module (making use of PYTHONPATH to glue everything together) don't work with the current installation method.This affects me, because I want to package pybind11 for NixOS, which uses this exact concept. Users of HPC installations, which use
module load
-type systems should also be affected.This leads to the following error when trying to compile the python_example
Reproducible example code:
While it is pretty specific to the toolchain I'm using, I still want to include the Code that produces my error.
Invoking
nix-build
outputs the following error:Diagnosis
The function
get_include
yields the location of the CPython headers:Whereas the headers of pybind11 are actually installed relative to the pybind11 python-module:
(Note that the prefixes differ:
/nix/store/nx3jw...
vs/nix/store/6y6s8...
)The text was updated successfully, but these errors were encountered: