From 67fe971d791666928c7ef889bbafca7b4afa0895 Mon Sep 17 00:00:00 2001 From: Andrey Talman Date: Wed, 28 Oct 2026 14:36:46 -0700 Subject: [PATCH 1/2] Pin pyarrow<26 so ray.train imports with numpy 1.26 The Ubuntu 24.04 image (#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). --- .ci/docker/requirements.txt | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.ci/docker/requirements.txt b/.ci/docker/requirements.txt index 157647e887..cf6ad87c7b 100644 --- a/.ci/docker/requirements.txt +++ b/.ci/docker/requirements.txt @@ -21,6 +21,9 @@ pytorch_sphinx_theme2==0.4.9 # Tutorial dependencies tqdm==4.66.1 numpy==1.26.4 +# Pin pyarrow: 26.0.0 requires NumPy >= 2.0 at import, while numba and spacy keep +# numpy below 2. Its wheels declare no numpy requirement, so pip does not catch it. +pyarrow<26 pydantic>=2.10 # Pin fastapi: 0.139.2 made router route building thread-safe by adding an # _effective_routes_lock (threading.Lock) to APIRouter, which ray[serve]'s From 9287967c810a92f5d831a20cb639d40526b2f55b Mon Sep 17 00:00:00 2001 From: Andrey Talman Date: Wed, 28 Oct 2026 15:21:07 -0700 Subject: [PATCH 2/2] Pin pandas<3 so Ax's winsorize transform can write observation means 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). --- .ci/docker/requirements.txt | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.ci/docker/requirements.txt b/.ci/docker/requirements.txt index cf6ad87c7b..9d960a5e27 100644 --- a/.ci/docker/requirements.txt +++ b/.ci/docker/requirements.txt @@ -24,6 +24,9 @@ numpy==1.26.4 # Pin pyarrow: 26.0.0 requires NumPy >= 2.0 at import, while numba and spacy keep # numpy below 2. Its wheels declare no numpy requirement, so pip does not catch it. pyarrow<26 +# Pin pandas: 3.0 makes Series.values read-only (copy-on-write), which breaks Ax 0.4.x +# ("assignment destination is read-only" in its winsorize transform). +pandas<3 pydantic>=2.10 # Pin fastapi: 0.139.2 made router route building thread-safe by adding an # _effective_routes_lock (threading.Lock) to APIRouter, which ray[serve]'s