Skip to content
Latchkey

NumPy "module compiled against API version ... but this version of numpy is" in CI

A compiled package (pandas, scipy, a C extension) was built against one NumPy C-API version, but a different NumPy is installed at runtime. The ABI does not match, so importing it warns or raises, most often after the NumPy 2.0 transition.

What this error means

An import warns "RuntimeError: module compiled against API version 0x10 but this version of numpy is 0xe" or "A module that was compiled using NumPy 1.x cannot be run in NumPy 2.x".

python
A module that was compiled using NumPy 1.x cannot be run in NumPy 2.0.2 as it may crash.
... RuntimeError: module compiled against API version 0x10 but this version of numpy is 0xe

Common causes

NumPy 2.x installed with a 1.x-built extension

A dependency wheel compiled against NumPy 1.x is loaded under NumPy 2.x, which broke the C ABI, so the extension is incompatible.

Mixed wheels from different NumPy build bases

CI resolved a NumPy newer than the one the other binary packages were built against, leaving an ABI gap.

How to fix it

Pin NumPy to a compatible major version

Until all dependencies ship NumPy 2.x-compatible wheels, pin NumPy below 2 (or upgrade the dependents).

Terminal
pip install "numpy<2"
# or upgrade the dependents to NumPy 2.x-compatible releases

Upgrade dependents to NumPy 2.x builds

Install versions of pandas/scipy/etc. that publish wheels built for NumPy 2.x so the ABI matches.

Terminal
pip install --upgrade "numpy>=2" "pandas>=2.2.2" "scipy>=1.13"

How to prevent it

  • Lock NumPy and its binary dependents as a matched set.
  • Cross the NumPy 2.0 boundary deliberately, upgrading dependents together.
  • Run an import smoke test after installing the scientific stack.

Related guides

Tired of flaky CI? Latchkey auto-heals failed jobs and retries them for you. Start free →