Skip to content

Commit 67fe971

Browse files
committed
Pin pyarrow<26 so ray.train imports with numpy 1.26
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).
1 parent db4c5a1 commit 67fe971

1 file changed

Lines changed: 3 additions & 0 deletions

File tree

‎.ci/docker/requirements.txt‎

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,9 @@ pytorch_sphinx_theme2==0.4.9
2121
# Tutorial dependencies
2222
tqdm==4.66.1
2323
numpy==1.26.4
24+
# Pin pyarrow: 26.0.0 requires NumPy >= 2.0 at import, while numba and spacy keep
25+
# numpy below 2. Its wheels declare no numpy requirement, so pip does not catch it.
26+
pyarrow<26
2427
pydantic>=2.10
2528
# Pin fastapi: 0.139.2 made router route building thread-safe by adding an
2629
# _effective_routes_lock (threading.Lock) to APIRouter, which ray[serve]'s

0 commit comments

Comments
 (0)