Python "ImportError: numpy built from source (no wheel for 3.13)" in CI
When no prebuilt numpy wheel exists for the running Python (a brand-new release like 3.13 shortly after launch), pip builds numpy from source. That requires a C/Fortran toolchain and meson; on a minimal runner it fails before producing an importable module.
What this error means
pip logs "Building wheel for numpy (pyproject.toml) ... error" on Python 3.13, or import fails with a numpy build/ABI error after a source build.
pip
Building wheel for numpy (pyproject.toml) did not run successfully.
...
meson.build:1:0: ERROR: Unknown compiler(s)Common causes
No matching wheel for the Python version
numpy has not yet published a wheel for the just-released interpreter, so pip builds from source.
The source build toolchain is missing
The runner lacks a C/Fortran compiler or meson, so the from-source build fails.
How to fix it
Use a Python version with wheels, or provide the toolchain
- Pin CI to a Python version numpy publishes wheels for, or pin a numpy version that has a wheel for your interpreter.
- If a source build is unavoidable, install a compiler toolchain and meson/ninja first.
- Prefer the latest numpy that ships wheels for your target Python.
Terminal
python -m pip install --only-binary=:all: "numpy>=1.26,<3"How to prevent it
- Latchkey managed runners auto-retry transient install failures and ship a full build toolchain, so a source build that needs a compiler does not fail for a missing dependency.
- Pin Python to versions with published numpy wheels.
- Use --only-binary to fail fast instead of building from source.
Related guides
Python "pandas FutureWarning treated as error" in CIFix a pandas FutureWarning that fails CI - filterwarnings=error turns a deprecation warning from pandas into…
Python NumPy ABI mismatch "built against different version" in CIFix a NumPy ABI mismatch in CI - a C-extension package was compiled against a different NumPy version than th…
Python "tox: ERROR could not install deps" in CIFix "ERROR: could not install deps" in tox in CI - tox failed to install the dependencies for an environment,…