Skip to content

Move the CI docker image to Ubuntu 24.04 for PyTorch 2.15 - #3988

Merged
atalman merged 1 commit into
pytorch:mainfrom
atalman:docker-ubuntu-24.04
Oct 28, 2026
Merged

atalman merged 1 commit into
pytorch:mainfrom
atalman:docker-ubuntu-24.04

Conversation

@atalman

@atalman atalman commented Oct 28, 2026

Copy link
Copy Markdown
Contributor

Fixes the failing Docker Build on main: https://github.com/pytorch/tutorials/actions/runs/40756929817/job/123058245317

Description

torch 2.15 requires Python >= 3.11 and has no cp310 wheels, but the CI image is Ubuntu 22.04 (system Python 3.10), so pip install torch==2.15 fails with No matching distribution found. This moves the image to Ubuntu 24.04 (Python 3.12) and makes the changes that move needs:

  • build.sh: UBUNTU_VERSION 22.04 -> 24.04 (nvidia/cuda:12.6.3-devel-ubuntu24.04 exists).
  • install_base.sh: drop the cmake=3.22* pin, which does not exist on 24.04.
  • install_pip_requirements.sh: 24.04 marks system Python as externally managed (PEP 668); write /etc/pip.conf with break-system-packages = true (a config file so the sudo pip call in .jenkins/build.sh is covered), and use --ignore-installed for the pip upgrade since the apt pip has no RECORD file.
  • requirements.txt: numpy 1.24.4 -> 1.26.4, scipy 1.11.1 -> 1.11.4, numba 0.57.1 -> 0.59.1, spacy 3.7.1 -> 3.7.2, the first releases with Python 3.12 wheels. Without the numpy bump, resolution fails against onnx on 3.12.

Alternative: keep 22.04 and install Python 3.11, which leaves every pin alone but adds a non-distro Python to the image.

Not verified: I only checked dependency resolution, with uv pip compile --python-version 3.12 and torch 2.14.1 standing in for 2.15 (the internal mirror lacked the 2.15 wheels). The image was not built and no tutorial was run against the bumped numpy/scipy/numba/spacy. Please run the Docker Build workflow on this PR before merging.

AI disclosure: this change was authored with an AI assistant (Claude Code). It is a draft until the author has reviewed it.

Checklist

  • The issue that is being fixed is referred in the description (see above "Fixes #ISSUE_NUMBER")
  • Only one issue is addressed in this pull request
  • Labels from the issue that this PR is fixing are added to this pull request
  • No unnecessary issues are included into this pull request.

torch 2.15 requires Python >= 3.11 and publishes no cp310 wheels, so
`pip install torch==2.15` fails on the Ubuntu 22.04 image (system Python
3.10) with "No matching distribution found", as in the Docker Build run
https://github.com/pytorch/tutorials/actions/runs/40756929817.

Ubuntu 24.04 ships Python 3.12. Besides the base image, three things
change with it:

- The cmake=3.22* pin does not exist on 24.04; use the distro cmake.
- 24.04 marks the system Python as externally managed (PEP 668), so pip
  is told via /etc/pip.conf to install into it. A config file rather than
  an env var so the `sudo pip` call in .jenkins/build.sh is covered too.
  `pip install --upgrade pip` needs --ignore-installed because the
  apt-installed pip has no RECORD file to uninstall.
- numpy, scipy, numba and spacy were pinned to versions with no Python
  3.12 wheels (and numpy 1.24.4 conflicts with the current onnx on 3.12).
  Bump each to the first release with 3.12 support.

Alternative considered: keep 22.04 and install Python 3.11. That leaves
every pin untouched, but adds a source-built or third-party Python to the
image; the 24.04 route uses the distro Python.

Test Plan:

Dependency resolution only (torch 2.14.1 stands in for 2.15 because the
internal PyPI mirror did not have the 2.15 wheels yet):

```
uv pip compile .ci/docker/requirements.txt --python-version 3.12 --python-platform x86_64-manylinux_2_39
```

With the old pins this fails on numpy==1.24.4 vs onnx; with the new pins
it resolves. The image itself has not been built: run the Docker Build
workflow on this PR to verify the apt and pip steps.

This change was authored with an AI assistant (Claude Code).
@pytorch-bot

pytorch-bot Bot commented Oct 28, 2026 •

Copy link
Copy Markdown

🔗 Helpful Links

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

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

⏳ No Failures, 1 Pending

As of commit 1e3b506 with merge base 71db083 (image):
💚 Looks good so far! There are no failures yet. 💚

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

@meta-cla meta-cla Bot added the cla signed label Oct 28, 2026
@atalman
atalman marked this pull request as ready for review October 28, 2026 19:57
@atalman
atalman merged commit f9507a2 into pytorch:main Oct 28, 2026
5 of 6 checks passed
atalman added a commit to atalman/tutorials that referenced this pull request Oct 28, 2026
The Ubuntu 24.04 image (pytorch#3988) pins numpy==1.26.4, because numba 0.59.1
and spacy 3.7.2 need numpy < 2. pyarrow's wheels declare no numpy
requirement, so pip installs the latest pyarrow, 26.0.0, which fails at
import with "pyarrow requires NumPy 2.0 or newer, found 1.26.4".

ray.train reports any failure to import fsspec, pandas, pyarrow or
requests as "Can't import ray.train as some dependencies are missing",
so beginner_source/distributed_training_with_ray_tutorial.py failed the
Build tutorials job on main:
https://github.com/pytorch/tutorials/actions/runs/40763826746/job/123082673219

Cap pyarrow below 26. Drop the cap when numpy moves to 2.x.

Alternative considered: moving numpy to 2.x. That needs new numba and
spacy, which is a much larger change to the tutorial environment.

Test Plan:

In a Python 3.12 venv with numpy==1.26.4, ray[train]==2.55.0,
pandas==3.0.6, fsspec and requests:

```
python -c "import pyarrow"            # 26.0.0: ImportError, NumPy 2.0 required
python -c "import pyarrow"            # 22.0.0 to 25.0.0: ok
python -c "import ray.train"          # with pyarrow<26: ok
```

The image has not been rebuilt: run the Docker Build workflow on this
PR, then the tutorial build, to verify.

This change was authored with an AI assistant (Claude Code).
atalman added a commit that referenced this pull request Oct 28, 2026
Follow-up to #3988. Fixes the failing Build tutorials job on `main`:
https://github.com/pytorch/tutorials/actions/runs/40763826746/job/123082673219
and https://github.com/pytorch/tutorials/actions/runs/40773662620

## Description
#3988 moved the CI image to Ubuntu 24.04 (Python 3.12) and pinned
`numpy==1.26.4`. Nothing caps the other packages, so pip resolves newer
majors that do not work with it. Two caps in
`.ci/docker/requirements.txt` fix the four failing tutorials:

- `pyarrow<26`: `pyarrow` 26.0.0 raises `ImportError: pyarrow requires
NumPy 2.0 or newer, found 1.26.4`. Its wheels declare no numpy
requirement, so pip installs it anyway. This broke
`distributed_training_with_ray_tutorial`,
`hyperparameter_tuning_tutorial` and `serving_tutorial`. `ray.train` and
`ray.tune` report any failure to import `fsspec`, `pandas`, `pyarrow` or
`requests` as "dependencies are missing", which hides the real error.
- `pandas<3`: pandas 3.0 makes `Series.values` read-only
(copy-on-write). Ax 0.4.3 builds its observation means from
`d["mean"].values` and assigns into them in its winsorize transform, so
`ax_multiobjective_nas_tutorial` fails with `ValueError: assignment
destination is read-only`.

Both caps can come out when numpy moves to 2.x (and, for pandas, when
the Ax tutorial moves to an Ax release that works with pandas 3).

Alternative: move numpy to 2.x, which needs new numba and spacy and is a
much larger change.

Checked in a Python 3.12 venv with numpy 1.26.4: `pyarrow` 26.0.0 fails
to import and 22.0.0 to 25.0.0 import fine, `import ray.train` passes
with the cap, and `to_numpy()` is read-only under pandas 3.0.6. A
resolve of `requirements.txt` gives pandas 2.3.3, pyarrow 25.0.1, numpy
1.26.4. On the first run of this PR the `pyarrow` shards (1 and 9)
passed and the Ax shard (4) failed; the second commit adds the pandas
cap for it.

**Not verified:** the Build tutorials run on the latest commit of this
PR.

> **AI disclosure:** this change was authored with an AI assistant
(Claude Code). It is a draft until the author has reviewed it.

## Checklist
- [ ] The issue that is being fixed is referred in the description (see
above "Fixes #ISSUE_NUMBER")
- [ ] Only one issue is addressed in this pull request
- [ ] Labels from the issue that this PR is fixing are added to this
pull request
- [ ] No unnecessary issues are included into this pull request.

---------

Co-authored-by: Andrey Talman <atalman@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants