1) Python import errors: ImportError: DLL load failed
Symptoms: import cv2 fails with "DLL load failed" or "module not found" messages.
Checklist
- Create a clean virtual environment (venv or conda) and activate it.
- Run:
python -m pip install --upgrade pip setuptools wheel - Install OpenCV and numpy inside that env:
pip install opencv-contrib-python numpy - If using conda, consider using pip inside conda env or conda-forge packages.
- Verify which python is used:
python -c "import sys;print(sys.executable)"
2) Missing MSVC or runtime DLLs
Symptoms: errors mentioning MSVCP140.dll, VCRUNTIME140.dll, or similar.
Fixes
- Install the latest Microsoft Visual C++ Redistributable (x64) from Microsoft official downloads.
- Ensure the redistributable matches the MSVC version used for the OpenCV build (common recent versions cover many builds).
- Restart your system after installation if issues persist.
3) "The program can't start because ... dll is missing" for C++
Symptoms: Running your EXE fails complaining about missing OpenCV DLLs.
Fixes
- Add OpenCV bin directory to the System or User PATH: Control Panel → System → Advanced system settings → Environment Variables.
- Or copy required Opencv binaries (DLLs) into the same folder as your executable.
- Match runtime types: don't mix Debug builds with Release DLLs and ensure all libs are x64.
4) Camera not opening or strange camera errors
Symptoms: VideoCapture(0) returns empty frames or fails.
Checklist
- Confirm camera index: try 0,1,2 etc. Multiple cameras/devices change indices.
- Ensure another application (Teams/Zoom/Browser) is not locking the camera.
- Check Windows camera privacy settings: Settings → Privacy & security → Camera → allow apps to access camera.
- Test with a minimal script:
import cv2
cap = cv2.VideoCapture(0)
if not cap.isOpened():
print('Camera open failed')
else:
ret, frame = cap.read()
print('Frame ok:', ret)
cap.release()
5) Video I/O / GStreamer / FFmpeg issues
Symptoms: imread works but VideoCapture for files or streams fails, or certain codecs are unsupported.
Notes & fixes
- Official wheels include common FFmpeg builds but not all codec variants.
- Use opencv-python packages that include ffmpeg support; for custom cases, build OpenCV with your desired codec support.
- Ensure file paths do not contain non-ASCII characters — on Windows, this can cause issues with older I/O builds.
6) Permission and antivirus blocking
- Sometimes antivirus or Windows Defender may quarantine DLLs. Check quarantine logs and exclude the OpenCV install folder if safe.
- Run your IDE/terminal as Administrator if you encounter permission-denied issues during install.
7) If nothing helps — a final checklist
- Use a fresh user account or clean virtual environment.
- Install Microsoft Visual C++ Redistributable (x64).
- Ensure Python and OpenCV wheel architectures match (x64).
- Try the official OpenCV Windows installer to get prebuilt libraries: opencv-4.12.0-windows.exe.
- Search the Troubleshooting page sections for the exact error text — copy-paste the message into Google/GitHub issues.