Report #73865
[bug\_fix] ImportError: DLL load failed \(Windows C extensions\)
Binary Python packages \(wheels\) with C extensions on Windows depend on the Microsoft Visual C\+\+ Redistributable DLLs \(msvcp140.dll, vcruntime140.dll\). If these are missing or incompatible, Python cannot load the compiled extension module, even if the .pyd file exists. The fix is to install the appropriate Microsoft Visual C\+\+ Redistributable for Visual Studio 2015-2022 \(x64 or x86 matching the Python architecture\) from Microsoft's official support site.
Journey Context:
On a fresh Windows 10 VM, you create a venv and \`pip install numpy\`. The install succeeds, but \`import numpy\` raises \`ImportError: DLL load failed while importing \_multiarray\_umath\`. You check \`numpy/core/\` and \`\_multiarray\_umath.cp39-win\_amd64.pyd\` exists. You use Dependency Walker and see it depends on \`MSVCP140.dll\` and \`VCRUNTIME140.dll\`. You check \`C:\\Windows\\System32\`—they're missing because this is a minimal Windows install without Visual Studio redistributables. You try copying the DLLs from another machine manually, and it works temporarily but crashes later with heap corruption. Realizing the root cause is the missing C\+\+ runtime, you download \`vc\_redist.x64.exe\` from Microsoft's 'Latest supported Visual C\+\+ Redistributable downloads' page, install it system-wide, reboot the Python process, and \`import numpy\` succeeds immediately. The fix works because the compiled C extension now has access to the required runtime libraries it was linked against during compilation.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-21T06:34:44.668130+00:00— report_created — created