spaCy and NumPy 2 compatibility (tested)

spaCy 3.7 fails at import spacy under NumPy 2 with ValueError: numpy.dtype size changed, may indicate binary incompatibility, raised inside thinc.backends.numpy_ops. Upgrade to spaCy 3.8 (thinc 8.3), or pin numpy<2. Tested below.

1. Reproduce: spaCy 3.7.4 after NumPy is upgraded to 2

A Python 3.11 venv with pip install spacy==3.7.4 resolves to thinc 8.2.5, blis 0.7.11 and numpy 1.26.4, and works. thinc 8.2.5 pins numpy<2.0.0, so asking for both is refused:

error: No solution found when resolving dependencies
  cause: Because thinc==8.2.5 depends on numpy>=1.19.0,<2.0.0 and you require thinc==8.2.5, we can conclude that you require numpy>=1.19.0,<2.0.0.
         And because you require numpy==2.2.6, we can conclude that your requirements are unsatisfiable.

But a later install that upgrades NumPy on its own (here numpy==2.2.6; any package that needs NumPy 2 does the same) is not stopped. b1.py:

import numpy
print("numpy", numpy.__version__)
import spacy
print("spacy", spacy.__version__)
nlp = spacy.blank("en")
print([t.text for t in nlp("NumPy 2 broke my pipeline.")])

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

$ pip install "numpy==2.2.6"
$ python b1.py
numpy 2.2.6
Traceback (most recent call last):
  File "b1.py", line 3, in <module>
    import spacy
  File "/venv/lib/python3.11/site-packages/spacy/__init__.py", line 6, in <module>
    from .errors import setup_default_warnings
  File "/venv/lib/python3.11/site-packages/spacy/errors.py", line 3, in <module>
    from .compat import Literal
  File "/venv/lib/python3.11/site-packages/spacy/compat.py", line 39, in <module>
    from thinc.api import Optimizer  # noqa: F401
    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/venv/lib/python3.11/site-packages/thinc/api.py", line 1, in <module>
    from .backends import (
  File "/venv/lib/python3.11/site-packages/thinc/backends/__init__.py", line 17, in <module>
    from .cupy_ops import CupyOps
  File "/venv/lib/python3.11/site-packages/thinc/backends/cupy_ops.py", line 16, in <module>
    from .numpy_ops import NumpyOps
  File "thinc/backends/numpy_ops.pyx", line 1, in init thinc.backends.numpy_ops
ValueError: numpy.dtype size changed, may indicate binary incompatibility. Expected 96 from C header, got 88 from PyObject

The error comes from thinc, spaCy's ML library: its compiled numpy_ops was built against NumPy 1.x. Even spacy.blank("en") never runs, because import spacy fails. thinc 8.2.4 (uncapped metadata) gives the identical error with NumPy 2.2.6.

2. Which spaCy version supports NumPy 2

PyPI metadata: spaCy 3.7.4, 3.7.5 and 3.8.0 require thinc<8.3.0 (NumPy 1 builds). spaCy 3.8.2 and later require thinc>=8.3.0, whose builds target NumPy 2 (thinc 8.3.0 itself pins numpy>=2.0.0,<2.1.0). The latest, spaCy 3.8.16, requires thinc>=8.3.12 and Python 3.9 to 3.14.

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

$ pip install -U spacy numpy
$ python b1.py
numpy 2.4.6
spacy 3.8.16
['NumPy', '2', 'broke', 'my', 'pipeline', '.']

The upgrade moved spaCy 3.7.4 to 3.8.16, thinc 8.2.5 to 8.3.13, blis 0.7.11 to 1.3.3 and NumPy to 2.4.6. Trained pipelines (en_core_web_sm etc.) are versioned per spaCy minor release, so re-download them after moving to 3.8 (python -m spacy download en_core_web_sm). To stay on 3.7:

$ pip install "numpy<2"
$ python b1.py
numpy 1.26.4
spacy 3.7.4
['NumPy', '2', 'broke', 'my', 'pipeline', '.']

Restart any Jupyter kernel after changing versions. In this test a fresh spacy==3.8.2 install then failed on ModuleNotFoundError: No module named 'click', so prefer the latest 3.8.x. The generic form of this error: numpy.dtype size changed. Same problem elsewhere: gensim, statsmodels, shap. All changes: NumPy 2 breaking changes.

Frequently asked questions

Which spaCy version supports NumPy 2?

spaCy 3.8.2 and later require thinc 8.3, built for NumPy 2. spaCy 3.8.16 ran with numpy 2.4.6 in this test; 3.7.4 failed.

Why does import spacy say numpy.dtype size changed?

thinc 8.2.x was compiled against NumPy 1.x and NumPy 2 was installed later. pip install -U spacy numpy, or pip install "numpy<2".

Written with AI assistance. Measured on 2026-10-24 on Linux with Python 3.11.17: spaCy 3.7.4 with thinc 8.2.4/8.2.5 and numpy 1.26.4/2.2.6, an upgrade to spaCy 3.8.16 + thinc 8.3.13 + numpy 2.4.6, and a fresh spaCy 3.8.2. The script ran verbatim and output was pasted unedited (paths shortened). Version pins read from PyPI metadata the same day. PlainTables is our extension; spaCy, thinc and NumPy are free.