SciPy and NumPy 2 compatibility (tested)
SciPy 1.11 on NumPy 2 imports with a warning, then each submodule fails differently: numpy.core.multiarray failed to import, numpy.dtype size changed, or cannot import name 'Inf'. SciPy 1.13.0 is the first version that supports NumPy 2. Tested below.
1. Reproduce: SciPy 1.11.4 with NumPy 2
A Python 3.11 venv with scipy==1.11.4, then numpy==2.2.6 installed in a second command (asking for both in one command is refused by the resolver). b1.py:
import numpy
print("numpy", numpy.__version__)
import scipy
print("scipy", scipy.__version__)
from scipy import stats
print(stats.norm.cdf(1.96))
Output (paths shortened to /venv and /usr):
numpy 2.2.6
/venv/lib/python3.11/site-packages/scipy/__init__.py:132: UserWarning: A NumPy version >=1.21.6 and <1.28.0 is required for this version of SciPy (detected version 2.2.6)
warnings.warn(f"A NumPy version >={np_minversion} and <{np_maxversion}"
scipy 1.11.4
Traceback (most recent call last):
File "b1.py", line 5, in <module>
from scipy import stats
File "<frozen importlib._bootstrap>", line 1229, in _handle_fromlist
File "/venv/lib/python3.11/site-packages/scipy/__init__.py", line 189, in __getattr__
return _importlib.import_module(f'scipy.{name}')
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/lib/python3.11/importlib/__init__.py", line 126, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/venv/lib/python3.11/site-packages/scipy/stats/__init__.py", line 608, in <module>
from ._stats_py import *
File "/venv/lib/python3.11/site-packages/scipy/stats/_stats_py.py", line 39, in <module>
from scipy.spatial.distance import cdist
File "/venv/lib/python3.11/site-packages/scipy/spatial/__init__.py", line 110, in <module>
from ._kdtree import *
File "/venv/lib/python3.11/site-packages/scipy/spatial/_kdtree.py", line 4, in <module>
from ._ckdtree import cKDTree, cKDTreeNode
File "_ckdtree.pyx", line 1, in init scipy.spatial._ckdtree
ValueError: numpy.dtype size changed, may indicate binary incompatibility. Expected 96 from C header, got 88 from PyObject
import scipy itself only warns. The crash comes from the first compiled submodule you touch, and the error is different for each one. b2.py imports each submodule in a fresh process:
import subprocess, sys
for mod in ("scipy.linalg", "scipy.sparse", "scipy.optimize", "scipy.spatial", "scipy.stats"):
r = subprocess.run([sys.executable, "-c", f"import {mod}"], capture_output=True, text=True)
last = r.stderr.strip().splitlines()[-1] if r.stderr.strip() else "OK"
print(f"{mod:15} exit {r.returncode}: {last}")
scipy.linalg exit 1: ImportError: numpy.core.multiarray failed to import
scipy.sparse exit 1: ImportError: numpy.core.multiarray failed to import
scipy.optimize exit 1: ImportError: cannot import name 'Inf' from 'numpy' (/venv/lib/python3.11/site-packages/numpy/__init__.py)
scipy.spatial exit 1: ValueError: numpy.dtype size changed, may indicate binary incompatibility. Expected 96 from C header, got 88 from PyObject
scipy.stats exit 1: ValueError: numpy.dtype size changed, may indicate binary incompatibility. Expected 96 from C header, got 88 from PyObject
scipy.linalg and scipy.sparse also print the long "A module that was compiled using NumPy 1.x cannot be run in NumPy 2" banner plus AttributeError: _ARRAY_API not found before the ImportError. The dependency check spells out the conflict:
$ uv pip check
Found 1 incompatibility
The package `scipy` requires `numpy>=1.21.6,<1.28.0`, but `2.2.6` is installed
2. What the three errors mean
numpy.core.multiarray failed to import/_ARRAY_API not found(linalg, sparse): the extension module was compiled against the NumPy 1.x C API. See A module compiled using NumPy 1.x.numpy.dtype size changed, may indicate binary incompatibility. Expected 96 from C header, got 88(spatial, stats): a Cython module built against NumPy 1.x headers. Same root cause; see numpy.dtype size changed.cannot import name 'Inf' from 'numpy'(optimize): pure Python code using an alias NumPy 2 removed (np.Inf, now onlynp.inf). See NumPy 2 breaking changes.
3. Which SciPy versions support NumPy 2
From the Requires-Dist metadata on PyPI. SciPy 1.13.0 is the first release that allows NumPy 2.
| SciPy | NumPy requirement | NumPy 2 OK? |
|---|---|---|
| 1.11.4 | numpy>=1.21.6, <1.28.0 | No |
| 1.12.0 | numpy>=1.22.4, <1.29.0 | No |
| 1.13.0 / 1.13.1 | numpy>=1.22.4, <2.3 | Yes (first) |
| 1.14.1 | numpy>=1.23.5, <2.3 | Yes |
| 1.15.3 | numpy>=1.23.5, <2.5 | Yes |
| 1.16.0 | numpy>=1.25.2, <2.6 | Yes (Python 3.11+) |
| 1.18.1 | numpy>=2.0.0, <2.8 | Yes (Python 3.12+, NumPy 2 only) |
The upper bound matters too: SciPy 1.13 and 1.14 cap NumPy below 2.3, so a new NumPy can still outrun an old-but-NumPy-2-ready SciPy.
4. Fix: pin numpy<2, or upgrade SciPy
$ pip install "numpy<2"
$ python b1.py
numpy 1.26.4
scipy 1.11.4
0.9750021048517795
$ python b2.py
scipy.linalg exit 0: OK
scipy.sparse exit 0: OK
scipy.optimize exit 0: OK
scipy.spatial exit 0: OK
scipy.stats exit 0: OK
$ pip install -U scipy numpy
$ python b1.py
numpy 2.4.6
scipy 1.17.1
0.9750021048517795
$ python b2.py
scipy.linalg exit 0: OK
scipy.sparse exit 0: OK
scipy.optimize exit 0: OK
scipy.spatial exit 0: OK
scipy.stats exit 0: OK
On Python 3.11 the upgrade resolved to SciPy 1.17.1 with NumPy 2.4.6. If something else pins SciPy below 1.13 (an old scikit-learn, statsmodels or a lock file), use numpy<2 until you can upgrade it. Same problem in other libraries: scikit-learn, Matplotlib, OpenCV, TensorFlow, pandas.
Frequently asked questions
Which SciPy version supports NumPy 2?
SciPy 1.13.0 is the first release whose metadata allows NumPy 2 (numpy>=1.22.4,<2.3). SciPy 1.11 and 1.12 require numpy<1.28/<1.29.
How do I fix SciPy errors after upgrading to NumPy 2?
pip install "numpy<2", or pip install -U scipy numpy (scipy 1.17.1 + numpy 2.4.6 on Python 3.11 in this test).
Written with AI assistance. Measured on 2026-10-24 on Linux with Python 3.11.17: scipy 1.11.4 with numpy 2.2.6 and 1.26.4, then upgraded to scipy 1.17.1 with numpy 2.4.6. Scripts ran verbatim and output was pasted unedited (paths shortened). Version pins read from PyPI metadata the same day. PlainTables is our extension; SciPy and NumPy are free.