- Notifications
You must be signed in to change notification settings - Fork6.2k
cmake: fix unsatisfiable Python3 version requirement#66655
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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.
Already on GitHub?Sign in to your account
base:main
Are you sure you want to change the base?
Uh oh!
There was an error while loading.Please reload this page.
Conversation
Signed-off-by: VXTLS <187420201+vxtls@users.noreply.github.com>
The conflicting EXACT requirement was present both in the top-levelPython detection and in the distutils/pybind logic, so both were updatedconsistentlySigned-off-by: VXTLS <187420201+vxtls@users.noreply.github.com>
| # Please specify 3.x if you want to build with a certain version of python3. | ||
| set(WITH_PYTHON3"3"CACHESTRING"build with specified python3 version") | ||
| find_package(Python3${WITH_PYTHON3}EXACTREQUIRED | ||
| find_package(Python3${WITH_PYTHON3} REQUIRED |
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.
the commit message of this change is practically empty, so one can hardly tell why the Python3 version requirement cannot be satisfied when reading this commit without tracking back to the pull request bringing this commit in.
the cover letter of this pull request states:
The current CMake logic requires Python3 3 EXACT while later rejecting Python versions lower than 3.9. This creates an unsatisfiable requirement, no Python version can satisfy both constraints.
But all Python versions greater or equal to 3.9 satisfy the requirement. that's why our CI/CD is not broken.
Also, we have good reason why we need to useEXACT here. Considering a user which installs Python 3.14 using tools like uv in a distro which ships Python 3.13 where all the building dependencies are in place, but they could run into a build failure, because the Python 3.14 is picked in favor of Python 3.13 despite that they configure the building system usingcmake -DWITH_PYTHON3=3.13.
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.
I reviewed the entire process again.
I useddo_cmake.sh for the build. Within that script, it determines the Python version based on the major version of the distribution, not which Python version the user has installed.
I suspect this is why, during my test builds:
- When I initially used Python 3.6, CMake required 3.9(At least)
- When I switched to Python 3.9, CMake required 3.6
The 3.6 requirement likely originated fromdo_cmake.sh.
I'm still unclear why the required Python version is determined by the major version number indo_cmake.sh? may be we should fixdo_cmake.sh
Therefore, the current issue should have two possible solutions:
- Remove the
EXACTkeyword - Modify
do_cmake.sh
I believe you should lean more toward the second option. Once confirmed, I will close this PR and open a new one fordo_cmake.sh
Uh oh!
There was an error while loading.Please reload this page.
Summary
The current CMake logic requires
Python3 3 EXACTwhile later rejectingPython versions lower than 3.9. This creates an unsatisfiable requirement,
no Python version can satisfy both constraints.
This patch removes the
EXACTqualifier from the Python3 detection so thatany Python 3 interpreter can be found, while preserving the existing check
that enforces Python >= 3.9.
This fixes source builds on modern distributions where Python 3.9+ is the
default , without changing runtime behavior.
Checklist
Tracker
Component impact
Documentation
Tests