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] Refactor finding Python #19592

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -641,7 +641,6 @@ if(IREE_BUILD_PYTHON_BINDINGS)
# seems to be robust generally.
# See: https://reviews.llvm.org/D118148
# If building Python packages, we have a hard requirement on 3.9+.
find_package(Python3 3.9 COMPONENTS Interpreter Development NumPy)
Copy link
Member

Choose a reason for hiding this comment

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

If this is truly safe to remove now, then also reword the comments above.

This in particular is explaining why there are two similar calls to find_package back to back:

  # Configuring the Development.Module is flaky in multi-project setups.
  # "Bootstrapping" by first looking for the optional Development component
  # seems to be robust generally.
  # See: https://reviews.llvm.org/D118148

Copy link
Member Author

Choose a reason for hiding this comment

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

I will update the PR accordingly after our next release.

Copy link
Member

Choose a reason for hiding this comment

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

We therefore skip searching for the latter as this might be the root for issue with the current macOS builds (see #19591).

I don't see how that could be related? One of the sample builds (https://github.com/iree-org/iree/actions/runs/12514308966/job/34910189766#step:8:77) already configures with explicit Python executables set ('-DPython3_EXECUTABLE=/Users/runner/hostedtoolcache/Python/3.11.9/x64/bin/python3' '-DPYTHON_EXECUTABLE=/Users/runner/hostedtoolcache/Python/3.11.9/x64/bin/python3'), so any number of find_package commands should be fine?

Copy link
Member Author

Choose a reason for hiding this comment

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

That comes from a discussion on Discord but it turned out this is not related.

find_package(Python3 3.9 COMPONENTS Interpreter Development.Module NumPy REQUIRED)
# Some parts of the build use FindPython instead of FindPython3. Why? No
# one knows, but they are different. So make sure to bootstrap this one too.
Expand Down
Loading