PyTables and NumPy 2 compatibility (tested)

PyTables 3.9.2 and older fail at import tables under NumPy 2 with ValueError: numpy.dtype size changed, may indicate binary incompatibility. PyTables 3.10.1 is the first release that supports NumPy 2. Tested below.

1. Reproduce: a plain pip install of PyTables 3.9.2

A fresh Python 3.11 venv. PyTables 3.9.2's metadata says numpy>=1.19.0 with no upper cap, so the resolver installs NumPy 2.4.6 next to it. b1.py:

import numpy
print("numpy", numpy.__version__)
import tables
print("tables", tables.__version__)
with tables.open_file("demo.h5", "w") as f:
    f.create_array("/", "x", numpy.arange(3))
with tables.open_file("demo.h5") as f:
    print(f.root.x[:])

Output, exit code 1 (paths shortened to /venv):

$ pip install tables==3.9.2
$ python b1.py
numpy 2.4.6
Traceback (most recent call last):
  File "b1.py", line 3, in <module>
    import tables
  File "/venv/lib/python3.11/site-packages/tables/__init__.py", line 44, in <module>
    from .utilsextension import get_hdf5_version as _get_hdf5_version
  File "tables/utilsextension.pyx", line 1, in init tables.utilsextension
ValueError: numpy.dtype size changed, may indicate binary incompatibility. Expected 96 from C header, got 88 from PyObject

It fails at import tables, in the compiled utilsextension module built against NumPy 1.x. pandas' to_hdf/read_hdf run on PyTables, so fix it there too.

2. Which PyTables version supports NumPy 2

PyPI metadata: 3.9.2 numpy>=1.19.0 (uncapped, but broken on NumPy 2); 3.10.0 numpy<2,>=1.20.0; 3.10.1 numpy>=1.20.0. PyTables 3.10.1 is the first release that works with NumPy 2; fresh venv, same script:

$ pip install "tables==3.10.1"
$ python b1.py
numpy 2.4.6
tables 3.10.1
[0 1 2]

3. Fix: upgrade tables, or pin numpy<2

$ pip install -U tables numpy
$ python b1.py
numpy 2.4.6
tables 3.11.1
[0 1 2]
$ pip install "numpy<2"
$ python b1.py
numpy 1.26.4
tables 3.9.2
[0 1 2]

Restart any Jupyter kernel after changing versions. The generic form of this error: numpy.dtype size changed. Same problem elsewhere: PyArrow, statsmodels, spaCy. All changes: NumPy 2 breaking changes.

Frequently asked questions

Which PyTables version supports NumPy 2?

PyTables 3.10.1: it ran with numpy 2.4.6 in this test. 3.9.2 failed; 3.10.0 pins numpy<2.

How do I fix import tables failing on NumPy 2?

pip install -U tables (3.10.1 or newer), or pip install "numpy<2".

Written with AI assistance. Measured on 2026-10-24 on Linux with Python 3.11.17: tables 3.9.2 with numpy 2.4.6 and 1.26.4, tables 3.10.1 and 3.11.1 with numpy 2.4.6. The script ran verbatim and output was pasted unedited (paths shortened). Version pins read from PyPI metadata the same day. PlainTables is our extension; PyTables and NumPy are free.