Skip to content

Pin pyarrow<26 and pandas<3 for the Ubuntu 24.04 image - #3990

Merged
atalman merged 2 commits into
pytorch:mainfrom
atalman:pin-pyarrow-lt-26
Oct 28, 2026
Merged

atalman merged 2 commits into
pytorch:mainfrom
atalman:pin-pyarrow-lt-26

Conversation

@atalman

@atalman atalman commented Oct 28, 2026 •

Copy link
Copy Markdown
Contributor

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.

@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/3990

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

❌ 1 New Failure

As of commit 9287967 with merge base db4c5a1 (image):

NEW FAILURE - The following job has failed:

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
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
atalman marked this pull request as ready for review October 28, 2026 21:40
On the Python 3.12 image nothing caps pandas, so pip installs 3.0.x. pandas
3.0 uses copy-on-write, which makes Series.values and to_numpy() return
read-only arrays. Ax 0.4.3 builds ObservationData.means from
d["mean"].values and then assigns into it in its winsorize transform, so
intermediate_source/ax_multiobjective_nas_tutorial.py fails with
"ValueError: assignment destination is read-only".

Cap pandas below 3. ax-platform<0.5 declares an unbounded pandas
requirement, so pip does not catch this. Drop the cap when the tutorial
moves to an Ax release that works with pandas 3.

Test Plan:

In a Python 3.12 venv with pandas 3.0.6:

```
python -c "import pandas as pd; a=pd.DataFrame({'m':[1.0]})['m'].to_numpy(); a[0]=5.0"
```

fails with "assignment destination is read-only". A resolve of
.ci/docker/requirements.txt with torch 2.14.1 standing in for 2.15:

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

gives pandas 2.3.3, pyarrow 25.0.1, numpy 1.26.4 and ax-platform 0.4.3. The
Build tutorials run on this PR is the end to end check.

This change was authored with an AI assistant (Claude Code).
@atalman atalman changed the title Pin pyarrow<26 so ray.train imports with numpy 1.26 Pin pyarrow<26 and pandas<3 for the Ubuntu 24.04 image Oct 28, 2026
@atalman
atalman merged commit 5672cd9 into pytorch:main Oct 28, 2026
37 of 38 checks passed
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