-
Notifications
You must be signed in to change notification settings - Fork 2.2k
Info about inconsistent detection of Python version between pybind11 … #1093
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
Conversation
docs/faq.rst
Outdated
are not consistent with detection of Python version in pybind11. If several versions of Python are installed | ||
in the Linux system (i.e. 2.7 and 3.5) the pybind11 defaults to 3.5, while CMake usually defaults to 2.7. | ||
The reason for this design decision is unreliable and buggy behavior of ``find_package(PythonInterp)`` and ``find_package(PythonLibs)`` | ||
which are among the worst-designed parts of CMake. We don't want to mimick this behavior in pybind11 in any way. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
While I don't disagree with this statement, I do find the language a little strong for putting in the main documentation. Here's a suggestion for these first two paragraphs (feel free to edit):
The functions ``find_package(PythonInterp)`` and ``find_package(PythonLibs)`` provided by CMake
for Python version detection are not used by pybind11 due to unreliability and limitations that make
them unsuitable for pybind11's needs. Instead pybind provides its own, more reliable Python detection
CMake code. Conflicts can arise, however, when using pybind11 in a project that *also* uses the CMake
Python detection.
Consider the following CMake code when run on a system with both Python 2.7 and 3.6 installed:
docs/faq.rst
Outdated
find_package(PythonLibs) | ||
find_package(pybind11) | ||
|
||
It will detect Python 2.7 and pybind11 will peek it as well. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Did you mean "peek" -> "pick"?
docs/faq.rst
Outdated
will detect Python 3.5 for pybind11 and may crash on ``find_package(PythonLibs)`` afterwards. | ||
|
||
It is advised to avoid using ``find_package(PythonInterp)`` and ``find_package(PythonLibs)`` from CMake and rely | ||
on pybind11 in detecting Python version. if this is not possible CMake machinery should be called *before* including pybind11. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
"... and rely on pybind11's more robust Python version detection instead."
Also the first "i" in "if this is not possible..." should be capitalized.
Too aggressive wording removed.
Merged, thanks! |
Info about inconsistent detection of Python version between pybind11 and CMake in FAQ