Code Yarns ‍👨‍💻
Tech BlogPersonal Blog

Python DLL load failed error

📅 2012-Apr-28 ⬩ ✍️ Ashwin Nanjappa ⬩ 🏷️ dll, error, python ⬩ 📚 Archive

 

Problem

You execute a Python program that uses a module and the module throws up this error at runtime:

ImportError: DLL load failed: %1 is not a valid Win32 application.

Solution

This is usually caused by a mismatch in the DLL of the module. I faced this error when I had mistakenly installed a 32-bit Python module (numpy in this case) on to a 64-bit Python installation. The error is thrown when the communication between the 64-bit Python and the 32-bit module DLL does not work, as expected. The error went away after I installed a 64-bit version of the module.

Tried with: Python 3.2 64-bit on Windows 7