ImportError: DLL load failed: %1 is not a valid Win32 application. But the DLL's are there ImportError: DLL load failed: %1 is not a valid Win32 application. But the DLL's are there python python

ImportError: DLL load failed: %1 is not a valid Win32 application. But the DLL's are there


Please check if the python version you are using is also 64 bit. If not then that could be the issue. You would be using a 32 bit python version and would have installed a 64 bit binaries for the OPENCV library.


Wow, I found yet another case for this problem. None of the above worked. Eventually I used python's ability to introspect what was being loaded. For python 2.7 this means:

import impimp.find_module("cv2")

This turned up a completely unexpected "cv2.pyd" file in an Anaconda DLL directory that wasn't touched by multiple uninstall/install attempts. Python was looking there first and not finding my good installation. I deleted that cv2.pyd file and tried imp.find_module("cv2") again and python immediately found the right file and cv2 started working.

So if none of the other solutions work for you, make sure you use python introspection to see what file python is trying to load.