Closed burgholzer closed 11 months ago
Some context, it is better to use find_package(Python3)
instead of find_package(Python)
Not really, if you set a minimum version (which you should), than they are the same (and I prefer the one without the 3, since IMO Python == Python 3, and I don't want to start using the 3 everywhere in case 4 ever comes.)
Oh right, I keep forgetting that FindPython
works with minimum set. I just remember that without setting it you would only be searching for python
and not python3
in PATH
.
Hmm, might be worth checking, but I think it's identical with the minimum, especially since this is common on Unix without venvs. But on Windows, you only have python
and not python3
(the opposite of Unix, where you might have python3
and not python
). IMO everyone should use venvs, but I can't force that. :)
Required prerequisites
What version (or hash if on master) of pybind11 are you using?
2.11.1 (also tested with latest master https://github.com/pybind/pybind11/commit/b9359ceadbf4d4b22509b684eea107d055b77901)
Problem description
Pybind11 cannot find Python on manylinux containers (such as within cibuidwheel) when running in new FindPython mode (
set(PYBIND11_FINDPYTHON ON)
) or under CMake>=3.27 (where that new mode is the default).Traces always have the following form:
Adding a
statement before the pybind11 import fixes the problem, but I fail to understand why that should be required and would consider this a bug.
Reproducible example code
The same error occurs with the even simpler
Running
instead, yields