numpy.dtype size changed, may indicate binary incompatibility (tested)
Expected 96 from C header, got 88 from PyObject means a package compiled for NumPy 1.x is running on NumPy 2. Upgrade that package (pandas 2.2.2+ works with NumPy 2) or pin numpy<2.
This error means a compiled extension (here pandas) was built against a different NumPy ABI than the NumPy that is installed. We reproduced it with uv 0.13.5 in a clean Python 3.11 venv on Linux; every transcript is unedited.
1. Reproduce: old pandas wheel + NumPy 2
Transcript:
$ rm -rf v && uv venv -q --python 3.11 v && . v/bin/activate && uv pip install -q pandas==2.0.3 numpy==2.0.2
$ . v/bin/activate && python -c "import numpy, pandas; print(numpy.__version__, pandas.__version__)"
Traceback (most recent call last):
File "<string>", line 1, in <module>
File "/tmp/dt397/v/lib/python3.11/site-packages/pandas/__init__.py", line 22, in <module>
from pandas.compat import is_numpy_dev as _is_numpy_dev # pyright: ignore # noqa:F401
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/tmp/dt397/v/lib/python3.11/site-packages/pandas/compat/__init__.py", line 25, in <module>
from pandas.compat.numpy import (
File "/tmp/dt397/v/lib/python3.11/site-packages/pandas/compat/numpy/__init__.py", line 4, in <module>
from pandas.util.version import Version
File "/tmp/dt397/v/lib/python3.11/site-packages/pandas/util/__init__.py", line 2, in <module>
from pandas.util._decorators import ( # noqa:F401
File "/tmp/dt397/v/lib/python3.11/site-packages/pandas/util/_decorators.py", line 14, in <module>
from pandas._libs.properties import cache_readonly
File "/tmp/dt397/v/lib/python3.11/site-packages/pandas/_libs/__init__.py", line 13, in <module>
from pandas._libs.interval import Interval
File "pandas/_libs/interval.pyx", line 1, in init pandas._libs.interval
ValueError: numpy.dtype size changed, may indicate binary incompatibility. Expected 96 from C header, got 88 from PyObject
[exit 1]
pandas 2.0.3 wheels were compiled against NumPy 1.x, where the C dtype struct is 96 bytes. NumPy 2.0 changed it to 88, and Cython's check at import (init pandas._libs.interval) raises ValueError: numpy.dtype size changed, may indicate binary incompatibility. Expected 96 from C header, got 88 from PyObject. The installer did not stop this because pandas 2.0.3 declares no upper bound on NumPy.
2. Fix 1: upgrade the package that fails
Transcript:
$ . v/bin/activate && uv pip install -q -U pandas
$ . v/bin/activate && python -c "import numpy, pandas; print(numpy.__version__, pandas.__version__)"
2.4.6 3.1.0
Upgrading pandas pulled a wheel built for NumPy 2 and the import works. Do the same for whichever package the traceback ends in (scikit-learn, scipy, pyarrow, statsmodels, ...). Use pip install -U pandas if you are not on uv.
3. Fix 2: keep the old package and pin numpy<2
Transcript:
$ . v/bin/activate && uv pip install -q pandas==2.0.3 'numpy<2'
$ . v/bin/activate && python -c "import numpy, pandas; print(numpy.__version__, pandas.__version__)"
1.26.4 2.0.3
If you cannot upgrade (locked project, old Python), install numpy<2 next to it. Put the pin in requirements.txt / pyproject.toml, otherwise the next install of an unrelated package can pull NumPy 2 back in.
4. Which pandas supports NumPy 2?
Transcript:
$ . v/bin/activate && uv pip install -q pandas==2.2.1 numpy==2.0.2 && python -c 'import pandas' 2>&1 | tail -1
error: No solution found when resolving dependencies
cause: Because pandas==2.2.1 depends on numpy{python_full_version < '3.12'}>=1.23.2,<2 and you require pandas==2.2.1, we can conclude that you require numpy>=1.23.2,<2.
And because you require numpy==2.0.2, we can conclude that your requirements are unsatisfiable.
[exit 1]
$ . v/bin/activate && uv pip install -q pandas==2.2.2 numpy==2.0.2 && python -c "import numpy, pandas; print(numpy.__version__, pandas.__version__)"
2.0.2 2.2.2
pandas 2.2.1 declares numpy<2 (on Python < 3.12), so the resolver refuses the combination instead of breaking at import; 2.2.2 is the first release that installs and imports with NumPy 2.0.2. If you still get the error with versions whose metadata allows NumPy 2, something bypassed the resolver: pip install --no-deps, mixing conda and pip, or a stale build in a cache. Reinstall the failing package in a fresh venv.
The other common NumPy 2 symptom is A module that was compiled using NumPy 1.x cannot be run in NumPy 2 followed by AttributeError: _ARRAY_API not found; same cause, same fixes: see AttributeError: _ARRAY_API not found.
Related: NumPy 2 breaking changes, numpy has no attribute int/float, uv pip install vs uv add, pandas 3 breaking changes.
Frequently asked questions
What causes numpy.dtype size changed, may indicate binary incompatibility?
A compiled package (e.g. pandas 2.0.3) built against NumPy 1.x is imported with NumPy 2.x installed; the C dtype struct changed size (96 vs 88 bytes).
How do I fix numpy.dtype size changed?
Upgrade the package named in the traceback (pip install -U pandas), or install numpy<2 alongside the old version.
Which pandas version works with NumPy 2?
pandas 2.2.2 and later. pandas 2.2.1 declares numpy<2, so installers refuse NumPy 2 with it.
Written with AI assistance. Measured on 2026-10-23 with uv 0.13.5, CPython 3.11 (uv-managed) on Linux, pandas 2.0.3 / 2.2.1 / 2.2.2 / 3.1.0 and NumPy 1.26.4 / 2.0.2 / 2.4.6. Each transcript was produced by running the commands verbatim. PlainTables is our extension; Python, NumPy and pandas are free.