ImportError: DLL load failed: The specified procedure could not be found.
Third-person routing text. Fixes scikit-learn failing on Windows with DLL load failed: The specified procedure could not be found. A clean reinstall of numpy, scipy, and scikit-learn from fresh wheels (preferably in a new environment) resolves the mismatched binaries. Use when an agent hits this importing sklearn on Windows. Not for other DLL errors.
TL;DR: your numpy/scipy/sklearn binaries do not line up (a partial upgrade left mismatched DLLs). Reinstall numpy, scipy, and scikit-learn cleanly, ideally in a fresh environment.
The error
ImportError: DLL load failed: The specified procedure could not be found.Fix it
- Create a fresh virtual environment (avoids the mixed state entirely):
python -m venv fresh_envActivate it. Expected: clean prompt with the new env.
- Install the trio fresh:
pip install scikit-learnExpected: pip pulls matching numpy, scipy, and sklearn wheels.
- Verify:
python -c "import sklearn; print(sklearn.__version__)"Expected: prints the version, no DLL error.
- If you must keep the old env, force-reinstall instead:
pip install --force-reinstall numpy scipy scikit-learnWhen this applies
Use this when import sklearn on Windows raises the DLL load failed message.
When it does not apply
If the message says the specified module could not be found (rather than procedure), the cause is usually a missing Visual C++ redistributable. On Linux, DLL errors do not apply; look for the .so message instead.
Compatibility
Windows, any recent scikit-learn with numpy/scipy wheels.
Root cause
sklearn's compiled extensions call into numpy/scipy DLLs. When one of the three is upgraded without the others (or a stray DLL shadows the right one), the loader finds a DLL whose exported procedures do not match, and Windows reports the procedure error at import time.
Edge cases
Antivirus quarantining a DLL mid-install produces the same symptom; reinstall with the AV paused if it recurs. Mixing conda and pip installs in one env is the most common way to get into this state.
Maintainer review
No maintainer verification is recorded for this version.
This records the version a maintainer checked. It does not assert that the version is the latest upstream release.