You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
[Python] Numpy constraint is present in the build but not in the runtime constraints #53954
For the project dependencies, there do not appear to be any mentioned that I can see. However, when I run the code, I see:
File ...
import pyarrow as pa
File ...
from pyarrow.lib import ...
File "pyarrow/lib.pyx", line 42, in init pyarrow.lib
ImportError: pyarrow requires NumPy 2.0 or newer, found 1.26.4
when I use pyarrow==26.0.0.
It seems to me that there is a missing dependency that should be present to constraint the numpy version in the runtime dependencies (alongside the build time ones).
changed the title [-]Numpy constraint is present in the build but not in the runtime constraints[/-][+][Python] Numpy constraint is present in the build but not in the runtime constraints[/+]on Oct 16, 2026
I can confirm the behaviour and the version boundary (Python 3.12.15, Linux x86_64, uv pip install):
pyarrow
numpy 1.26.4
21.0.0, 22.0.0, 23.0.1, 24.0.0, 25.0.1
import pyarrow works, pa.array(np.arange(3)).to_numpy() works
26.0.0
ImportError: pyarrow requires NumPy 2.0 or newer, found 1.26.4
The 26.0.0 wheel's METADATA has no Requires-Dist lines at all, so pip/uv have nothing to resolve against.
Some context in case it helps: this was an intentional change for 26.0.0 in #50769 (GH-48473, "Require numpy 2.0"). The check is in pyarrow/lib.pyx (lines 40-45 at apache-arrow-26.0.0) and only runs if import numpy succeeds. NumPy is still an optional runtime dependency. With numpy uninstalled, pyarrow 26.0.0 imports fine, and a Parquet write/read round trip and pc.sum work. That's probably why there's no runtime requirement. Adding numpy>=2 to [project].dependencies (what #53971 proposed; it was closed without being merged) would make numpy mandatory for everyone, and package metadata has no way to say "numpy>=2, but only if numpy is installed".
The install docs for 26.0.0 already list "NumPy 2.0 or higher" under optional dependencies, which matches this behaviour.
Practical options for now: pip install "numpy>=2" alongside pyarrow 26, or pin pyarrow<26 if you need to stay on NumPy 1.x. On the user side, a constraints file with numpy>=2 also does the job. I tried this in a fresh Python 3.12 venv with -c constraints.txt:
pyarrow==26.0.0 alone: numpy is not installed
pyarrow==26.0.0 "numpy<2": resolution fails (pip and uv both)
pyarrow==26.0.0 pandas==2.2.3: numpy 2.5.4 is picked (uv)
A constraint doesn't upgrade a numpy 1.x that's already installed if you only install pyarrow, though (checked with uv). In that case you still have to upgrade numpy yourself.
Activity
[-]Numpy constraint is present in the build but not in the runtime constraints[/-][+][Python] Numpy constraint is present in the build but not in the runtime constraints[/+]mohamd764 commentedon Oct 16, 2026
I can confirm the behaviour and the version boundary (Python 3.12.15, Linux x86_64,
uv pip install):import pyarrowworks,pa.array(np.arange(3)).to_numpy()worksImportError: pyarrow requires NumPy 2.0 or newer, found 1.26.4The 26.0.0 wheel's
METADATAhas noRequires-Distlines at all, so pip/uv have nothing to resolve against.Some context in case it helps: this was an intentional change for 26.0.0 in #50769 (GH-48473, "Require numpy 2.0"). The check is in
pyarrow/lib.pyx(lines 40-45 atapache-arrow-26.0.0) and only runs ifimport numpysucceeds. NumPy is still an optional runtime dependency. With numpy uninstalled, pyarrow 26.0.0 imports fine, and a Parquet write/read round trip andpc.sumwork. That's probably why there's no runtime requirement. Addingnumpy>=2to[project].dependencies(what #53971 proposed; it was closed without being merged) would make numpy mandatory for everyone, and package metadata has no way to say "numpy>=2, but only if numpy is installed".The install docs for 26.0.0 already list "NumPy 2.0 or higher" under optional dependencies, which matches this behaviour.
Practical options for now:
pip install "numpy>=2"alongside pyarrow 26, or pinpyarrow<26if you need to stay on NumPy 1.x. On the user side, a constraints file withnumpy>=2also does the job. I tried this in a fresh Python 3.12 venv with-c constraints.txt:pyarrow==26.0.0alone: numpy is not installedpyarrow==26.0.0 "numpy<2": resolution fails (pip and uv both)pyarrow==26.0.0 pandas==2.2.3: numpy 2.5.4 is picked (uv)A constraint doesn't upgrade a numpy 1.x that's already installed if you only install pyarrow, though (checked with uv). In that case you still have to upgrade numpy yourself.