close

[Solved] ImportError: DLL load failed: %1 is not a valid Win32 application. But the DLL’s are there

Hello Guys, How are you all? Hope You all Are Fine. Today I get the following error ImportError: DLL load failed: %1 is not a valid Win32 application. But the DLL’s are there in python. So Here I am Explain to you all the possible solutions here.

Without wasting your time, Let’s start This Article to Solve This Error.

How ImportError: DLL load failed: %1 is not a valid Win32 application. But the DLL’s are there Error Occurs?

Today I get the following error ImportError: DLL load failed: %1 is not a valid Win32 application. But the DLL’s are there in python.

How To Solve ImportError: DLL load failed: %1 is not a valid Win32 application. But the DLL’s are there Error ?

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

    To Solve ImportError: DLL load failed: %1 is not a valid Win32 application. But the DLL's are there Error None of the above worked. Eventually I used python's ability to introspect what was being loaded.

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

    To Solve ImportError: DLL load failed: %1 is not a valid Win32 application. But the DLL's are there Error None of the above worked. Eventually I used python's ability to introspect what was being loaded.

Solution 1

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.

Solution 2

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 imp
imp.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.

Summery

It’s all About this issue. Hope all solution helped you a lot. Comment below Your thoughts and your queries. Also, Comment below which solution worked for you? Thank You.

Also, Read