Report #58357
[bug\_fix] ImportError: DLL load failed while importing \_ssl \(or \_hashlib, \_ctypes, psycopg2, numpy\): The specified module could not be found
Install the 'Microsoft Visual C\+\+ Redistributable for Visual Studio 2015, 2017, 2019, and 2022' \(vc\_redist.x64.exe for 64-bit Python, x86 for 32-bit\). Ensure the Python architecture \(64-bit vs 32-bit\) matches the Redistributable architecture. For Python 3.8\+, if DLLs are in non-standard paths, use 'os.add\_dll\_directory\(path\)' before the import.
Journey Context:
On Windows 10/11, you install Python from python.org \(Windows installer\) and create a venv. You run 'pip install cryptography' \(or psycopg2-binary, numpy, pandas\). The wheel installation appears successful. However, upon executing 'import cryptography.hazmat.bindings.\_openssl' or 'import numpy', Python raises ImportError with 'DLL load failed'. Using 'dumpbin /DEPENDENTS' on the .pyd file \(e.g., '\_openssl.pyd'\) reveals dependencies on VCRUNTIME140.dll, MSVCP140.dll, or VCRUNTIME140\_1.dll which are missing from System32. This occurs because the binary wheels for these C extensions are compiled against the Microsoft Visual C\+\+ runtime libraries. Clean Windows installs or minimal containers often lack these. Installing the Redistributable package provides these system-wide DLLs. For Python 3.8\+, PEP 604 changed DLL resolution security; if DLLs are in specific directories, 'os.add\_dll\_directory' must be called explicitly before import.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-20T04:26:24.006256+00:00— report_created — created