ImportError: DLL load failed while importing _multiarray_umath (Windows)
A compiled package cannot load its native libraries on Windows — usually a missing VC++ runtime or a conda/pip hybrid environment. Install the redistributable, then rebuild the environment from one source.
Updated
The error
ImportError: DLL load failed while importing _multiarray_umath: The specified module could not be found.
The module name varies with the package: _multiarray_umath (numpy), cv2 (OpenCV), _C (torch), _ssl. The DLL trouble is the constant.
What it means
The Python package found its files, but Windows could not load the compiled .pyd/.dll at its core — because a library that file depends on is missing or wrong. Windows reports the file it tried to open, not the dependency actually absent, which is why the message seems to accuse a file that plainly exists.
Why it happens
Four causes cover nearly all cases:
- Missing Microsoft Visual C++ runtime. Compiled Python packages assume it; fresh Windows installs lack it.
- Conda/pip hybrid environments. A conda numpy and a pip-installed something (or vice versa) expect different runtime DLL arrangements, and imports fail in whichever order exposes the mismatch.
- Broken or truncated installs — an interrupted download, or an upgrade that half-replaced files.
- Architecture mismatch — 32-bit Python with 64-bit binaries or the reverse.
How to fix it
1. Install the Visual C++ Redistributable. Download "Visual C++ Redistributable for Visual Studio 2015-2022" (x64) from Microsoft, install, restart the terminal. Do this first — it is the single highest-probability fix and cures the whole class.
2. Reinstall the failing package cleanly.
pip uninstall -y numpy
pip cache purge
pip install numpy3. If the environment mixes conda and pip for compiled packages, rebuild it from one source.
conda create -n clean python=3.12
conda activate clean
conda install -c conda-forge numpy opencv pytorchOr all-pip in a venv. The rule: compiled scientific packages (numpy, scipy, opencv, torch) come from one installer per environment. Pip inside conda is fine for pure-Python packages only.
4. Check bitness when the machine has an unusual setup.
import platform; print(platform.architecture())('64bit', ...) is what you want; 32-bit Python needs replacing.
5. Antivirus interference is the wildcard. Corporate AV occasionally quarantines freshly written DLLs mid-install. If installs break repeatedly at random files, check the AV log and allowlist the environment folder.
How to prevent it
Provision Windows dev machines with the VC++ redistributable as step zero. Keep each environment single-source for compiled packages, and prefer rebuilding a suspect environment over incremental repair — environments are cattle, not pets.
Related errors
- OSError: WinError 126 — Error loading fbgemm.dll — the same failure with PyTorch specifics
- Solving environment: failed (conda) — how hybrid environments happen
- No module named 'cv2'
- ModuleNotFoundError: No module named 'torch'