Skip to content
Latchkey

NumPy "numpy.core.multiarray failed to import" in CI

A package tried to import NumPy's compiled core and it failed to load. The NumPy install is broken or partial, or a dependent was built against an incompatible NumPy, so its C core cannot initialize.

What this error means

An import fails with "ImportError: numpy.core.multiarray failed to import" or "Original error was: ... numpy.core._multiarray_umath", often surfacing through pandas, scipy, or cv2.

python
ImportError: numpy.core.multiarray failed to import
(auto-generated because you didn't call 'matplotlib.use()')

Common causes

A broken or partial NumPy install

An interrupted install, a leftover stale NumPy, or a shadowing local file named numpy leaves the compiled core unloadable.

An ABI mismatch with a dependent

A dependent built against a different NumPy version cannot import the installed NumPy core, surfacing as the multiarray import failure.

How to fix it

Reinstall NumPy cleanly

Force a clean NumPy reinstall so its compiled core is whole.

Terminal
pip install --force-reinstall --no-cache-dir numpy

Align NumPy with its dependents

  1. Confirm no local file or folder named numpy shadows the package.
  2. Pin NumPy and its binary dependents to a compatible set.
  3. Re-run an import smoke test to confirm the core loads.
Terminal
python -c "import numpy; print(numpy.__version__)"

How to prevent it

  • Avoid local modules named like installed packages (numpy).
  • Lock NumPy with its dependents to a compatible set.
  • Clear the pip cache after an interrupted scientific-stack install.

Related guides

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