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

[cmake] Use new mode to find python for pybind11 #22012

Merged

Conversation

BetsyMcPhail
Copy link
Contributor

@BetsyMcPhail BetsyMcPhail commented Oct 9, 2024

Update pybind11-config.cmake to follow the same logic as upstream pybind11Common so that the new (not deprecated) method of finding Python is used.

Towards #22009


This change is Reviewable

Copy link
Contributor Author

@BetsyMcPhail BetsyMcPhail left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Experimental packaging (to use to test d-e-e): https://drake-jenkins.csail.mit.edu/view/Packaging/job/mac-arm-sonoma-unprovisioned-clang-cmake-experimental-packaging/3/

Reviewable status: needs platform reviewer assigned, needs at least two assigned reviewers, missing label for release notes (waiting on @BetsyMcPhail)

Update pybind11-config.cmake to follow the same logic as upstream
pybind11Common so that the new (not deprecated) method of finding
Python is used.
Copy link
Contributor Author

@BetsyMcPhail BetsyMcPhail left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In the output from the failing Mac d-e-e job (https://github.com/RobotLocomotion/drake-external-examples/actions/runs/11273554281/job/31350829452) we can see a deprecation warning:

CMake Warning (dev) at /opt/drake/lib/cmake/pybind11/FindPythonLibsNew.cmake:101 (message):
  Policy CMP0148 is not set: The FindPythonInterp and FindPythonLibs modules
  are removed.  Run "cmake --help-policy CMP0148" for policy details.  Use
  the cmake_policy command to set the policy and suppress this warning, or
  preferably upgrade to using FindPython, either by calling it explicitly
  before pybind11, or by setting PYBIND11_FINDPYTHON ON before pybind11.

Also, the python that pybind11 is finding using the old, deprecated method is Python 3.9 rather than 3.12, as expected:

-- Found PythonInterp: /usr/bin/python3 (found suitable version "3.9.6", minimum required is "3.6")
-- Found PythonLibs: /Applications/Xcode.app/Contents/Developer/Library/Frameworks/Python3.framework/Versions/3.9/lib/libpython3.9.dylib

With the changes in this PR, we should no longer see a warning and the mac d-e-e job should pass.

To test, I created an experimental package: https://drake-jenkins.csail.mit.edu/view/Packaging/job/mac-arm-sonoma-unprovisioned-clang-cmake-experimental-packaging/5/

And temporarily updated d-e-e to use that package: RobotLocomotion/drake-external-examples#324.

Reviewable status: needs platform reviewer assigned, needs at least two assigned reviewers, missing label for release notes (waiting on @BetsyMcPhail)

Copy link
Contributor Author

@BetsyMcPhail BetsyMcPhail left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

+@sammy-tri for platform review per schedule please. I'm not sure if we also need a feature reviewer for this one?

Reviewable status: LGTM missing from assignee sammy-tri(platform), needs at least two assigned reviewers, missing label for release notes (waiting on @BetsyMcPhail)

@jwnimmer-tri jwnimmer-tri added the release notes: fix This pull request contains fixes (no new features) label Oct 10, 2024
@jwnimmer-tri jwnimmer-tri added the status: single reviewer ok https://drake.mit.edu/reviewable.html label Oct 10, 2024
Copy link
Collaborator

@jwnimmer-tri jwnimmer-tri left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I can just take this one to unload -@sammy-tri.

:lgtm: both +(status: single reviewer ok) +(release notes: fix).

Reviewed 2 of 2 files at r1, all commit messages.
Reviewable status: needs platform reviewer assigned, needs at least one assigned reviewer (waiting on @BetsyMcPhail)

@jwnimmer-tri jwnimmer-tri self-assigned this Oct 10, 2024
@jwnimmer-tri jwnimmer-tri merged commit 64b5fdc into RobotLocomotion:master Oct 10, 2024
9 checks passed
@BetsyMcPhail BetsyMcPhail deleted the pybind11-findpython branch October 10, 2024 19:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
release notes: fix This pull request contains fixes (no new features) status: single reviewer ok https://drake.mit.edu/reviewable.html
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants