Skip to content

Raise the CMake minimum Python to 3.11 - #202290

Closed
atalman wants to merge 1 commit into
pytorch:mainfrom
atalman:cmake_min_py311
Closed

atalman wants to merge 1 commit into
pytorch:mainfrom
atalman:cmake_min_py311

Conversation

@atalman

@atalman atalman commented Oct 27, 2026

Copy link
Copy Markdown
Collaborator

Follow-up to #202271, from its review comment.

Summary

Raise the Python floor that CMake enforces from 3.10 to 3.11, so CMake agrees with pyproject.toml and the README after #202271.

cmake/Dependencies.cmake:

if(${Python_VERSION} VERSION_LESS 3.11)
  message(FATAL_ERROR
    "Found Python libraries version ${Python_VERSION}. Python < 3.11 is no longer supported by PyTorch.")
endif()

Why

#202271 sets requires-python = ">=3.11" and the README prerequisite to "Python 3.11 or later". pip install . on 3.10 is then stopped by requires-python, but builds that skip that check (python setup.py develop, pip install --ignore-requires-python, calling CMake directly) rely on this guard. With the floor still at 3.10 those builds get past configure and fail much later, or produce an unsupported build, instead of stopping with a clear message.

No CI job builds PyTorch from source on Python 3.10: the only remaining 3.10 string in .github/workflows is a description comment, and the binary matrix starts at 3.11. It is the only 3.10 floor I found in cmake/, CMakeLists.txt, setup.py, tools/ or torch/__init__.py.

Testing

Ran the same if/message block with cmake -P (CMake 4.4.4) and Python_VERSION set to three values: 3.10.12 stops with the new message and exit 1; 3.11.0 and 3.15.1 are accepted. I did not run a full PyTorch configure.

Independent of #202271 (a different file), so the two can land in either order. release/2.15 has the same guard; this PR does not change that branch.

Follow-up to pytorch#202271. The package metadata and README now say Python 3.11 or later, but cmake/Dependencies.cmake still lets a 3.10 interpreter through. Builds that skip the requires-python check (python setup.py develop, pip install --ignore-requires-python, calling CMake directly) rely on this guard, so a 3.10 build got past configure and failed much later. Make the guard 3.11, with the matching message.
@pytorch-bot

pytorch-bot Bot commented Oct 27, 2026

Copy link
Copy Markdown

This PR needs a release notes: label

If your changes are user facing and intended to be a part of release notes, please use a label starting with release notes:.

If not, please add the topic: not user facing label.

To add a label, you can comment to pytorchbot, for example
@pytorchbot label "topic: not user facing"

For more information, see
https://github.com/pytorch/pytorch/wiki/PyTorch-AutoLabel-Bot#why-categorize-for-release-notes-and-how-does-it-work.

@pytorch-bot

pytorch-bot Bot commented Oct 27, 2026 •

Copy link
Copy Markdown

PR Status: Approved 🚀

Please fix all CI failures and trigger merge by commenting "@pytorchbot merge".

✅ AUTOMATED REVIEW - Ready for human review:

The PR raises the Python version floor in cmake/Dependencies.cmake from 3.10 to
3.11, so builds that skip pip's requires-python check stop at configure time;
the change is correct, and the one problem is the claim that it can land before
# 202271. Recommendation: Approve, on the condition that it merges after #
202271 (or together with it).

Findings (1):

[minor] cmake/Dependencies.cmake:877
Merge order with # 202271. The description says the two PRs "can land in either
order", but at this PR's HEAD the other packaging metadata still advertises
3.10: pyproject.toml:381 has `requires-python = ">=3.10"`, pyproject.toml:468
still lists the `Programming Language :: Python :: 3.10` classifier, and
README.md:165 says "Python 3.10 or later". If this PR merges first, main is
inconsistent in the opposite direction to the one this PR fixes: `pip install .`
on 3.10 passes the requires-python check, then fails at CMake configure with
"Python < 3.11 is no longer supported", while the README and classifiers still
say 3.10 is supported. Either land this strictly after # 202271, as a stack, or
fold the pyproject.toml and README changes into this PR so the floor moves
atomically. (Related, for # 202271: the `# TODO: Remove Python-3.10 specific
suppressions` comment at pyproject.toml:602 becomes actionable once the floor
moves.)

Reviewed commit: d320b4a

Review run

🔗 Helpful Links

🧪 See artifacts and rendered test results at hud.pytorch.org/pr/202290

Note: Links to docs will display an error until the docs builds have been completed.

✅ No Failures

As of commit d320b4a with merge base afabe7b (image):
💚 Looks good so far! There are no failures yet. 💚

🟡 GREEN LIGHT - PR requires human review:

  • Removes public platform support
    • cmake/Dependencies.cmake now fails configure with FATAL_ERROR on Python 3.10, dropping source builds that worked before
    • Dropping a supported Python version is removing something public, which is never trivial
  • Inconsistent with the tree at this commit
    • pyproject.toml at PR head still declares requires-python = ">=3.10" and a Python :: 3.10 classifier
    • README.md line 165 still says Python 3.10 or later; the matching change lives in a separate PR, #​202271
  • Socialization
    • Raising the Python floor is a release-level decision that developers and downstream builders need to hear about

reason: not_trivial
Reviewed commit: d320b4a

Inference job

🐛 Report a wrong verdict

This comment was automatically generated by Dr. CI and updates every 15 minutes.

@pytorchgreenlight pytorchgreenlight Bot added the GL/human GreenLight marked as needing human review label Oct 27, 2026
@pytorchbot pytorchbot added the in progress PR is being worked on by the author, until the automated review accepts it label Oct 27, 2026

@github-actions github-actions Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Automated review of d320b4a: nothing blocking; ready for human review.

The PR raises the Python version floor in cmake/Dependencies.cmake from 3.10 to 3.11, so builds that skip pip's requires-python check stop at configure time; the change is correct, and the one problem is the claim that it can land before # 202271. Recommendation: Approve, on the condition that it merges after # 202271 (or together with it).

⚪ 1 non-blocking finding

if(${Python_VERSION} VERSION_LESS 3.11)

Merge order with # 202271. The description says the two PRs "can land in either order", but at this PR's HEAD the other packaging metadata still advertises 3.10: pyproject.toml:381 has requires-python = "&gt;=3.10", pyproject.toml:468 still lists the Programming Language :: Python :: 3.10 classifier, and README.md:165 says "Python 3.10 or later". If this PR merges first, main is inconsistent in the opposite direction to the one this PR fixes: pip install . on 3.10 passes the requires-python check, then fails at CMake configure with "Python < 3.11 is no longer supported", while the README and classifiers still say 3.10 is supported. Either land this strictly after # 202271, as a stack, or fold the pyproject.toml and README changes into this PR so the floor moves atomically. (Related, for # 202271: the # TODO: Remove Python-3.10 specific suppressions comment at pyproject.toml:602 becomes actionable once the floor moves.)

This review is AI-generated and advisory. Each new automated review replaces the previous one.

@huydhn huydhn left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

LGTM!

@atalman

atalman commented Oct 27, 2026

Copy link
Copy Markdown
Collaborator Author

@pytorchbot merge -f "all is clear, lets merge"

@pytorchmergebot

Copy link
Copy Markdown
Collaborator

Merge started

Your change will be merged immediately since you used the force (-f) flag, bypassing any CI checks (ETA: 1-5 minutes). Please use -f as last resort and instead consider -i/--ignore-current to continue the merge ignoring current failures. This will allow currently pending tests to finish and report signal before the merge.

Learn more about merging in the wiki.

Questions? Feedback? Please reach out to the PyTorch DevX Team

Advanced Debugging
Check the merge workflow status
here

dominikjastrzebskix pushed a commit to dominikjastrzebskix/pytorch that referenced this pull request Nov 5, 2026
Follow-up to pytorch#202271, from its [review comment](pytorch#202271 (comment)).

## Summary

Raise the Python floor that CMake enforces from 3.10 to 3.11, so CMake agrees with `pyproject.toml` and the README after pytorch#202271.

`cmake/Dependencies.cmake`:

```cmake
if(${Python_VERSION} VERSION_LESS 3.11)
  message(FATAL_ERROR
    "Found Python libraries version ${Python_VERSION}. Python < 3.11 is no longer supported by PyTorch.")
endif()
```

## Why

pytorch#202271 sets `requires-python = ">=3.11"` and the README prerequisite to "Python 3.11 or later". `pip install .` on 3.10 is then stopped by `requires-python`, but builds that skip that check (`python setup.py develop`, `pip install --ignore-requires-python`, calling CMake directly) rely on this guard. With the floor still at 3.10 those builds get past configure and fail much later, or produce an unsupported build, instead of stopping with a clear message.

No CI job builds PyTorch from source on Python 3.10: the only remaining `3.10` string in `.github/workflows` is a description comment, and the binary matrix starts at 3.11. It is the only 3.10 floor I found in `cmake/`, `CMakeLists.txt`, `setup.py`, `tools/` or `torch/__init__.py`.

## Testing

Ran the same `if`/`message` block with `cmake -P` (CMake 4.4.4) and `Python_VERSION` set to three values: `3.10.12` stops with the new message and exit 1; `3.11.0` and `3.15.1` are accepted. I did not run a full PyTorch configure.

Independent of pytorch#202271 (a different file), so the two can land in either order. `release/2.15` has the same guard; this PR does not change that branch.

Pull Request resolved: pytorch#202290
Approved by: https://github.com/huydhn
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

GL/human GreenLight marked as needing human review in progress PR is being worked on by the author, until the automated review accepts it Merged

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants