Home  /  Scenarios  /  Python / Anaconda "DLL load failed"
🐍
Developers / data scientists

Python / Anaconda "DLL load failed"

After pip install, importing a package raises "DLL load failed while importing xxx"

Typical symptoms

  • ImportError: DLL load failed while importing _ssl
  • ImportError: DLL load failed: The specified module could not be found
  • numpy / scipy / torch / tensorflow import errors
  • Python crashing immediately after activating a Conda env

Official safe fix steps

  1. Install the latest VC++ 2015-2022 Redistributable

    Python 3.5+ is built with VS 2015+, and every C-extension package (numpy, scipy, torch, pillow, psycopg2, etc.) depends on vcruntime140. x64 Python needs x64 redist, x86 Python needs x86 redist.

  2. Make sure Python bitness matches your wheels

    Run python -c "import struct; print(struct.calcsize('P')*8)" in PowerShell to see if your Python is 32 or 64 bit. Then make sure the wheels (.whl) you pip-install match.

    python -c "import struct; print(struct.calcsize('P') * 8)"
  3. Recreate the conda env instead of repairing it

    When a conda env breaks, "conda create -n new_env --clone broken_env" then deleting the old one is far faster than patching DLLs by hand.

  4. Capture load failures with Process Monitor

    Advanced: SysInternals Process Monitor filtered on python.exe with "Result is NOT SUCCESS" shows exactly which DLL load step failed β€” far more useful than the error message.

DLLs commonly seen in this scenario

πŸ’‘ Still stuck? Check the general Fix Guide or look up your exact error code at Error Codes.