. Advertisement .
. Advertisement .
Have you ever encountered the error “importerror: dll load failed: %1 is not a valid win32 application.“? If yes, don’t miss this article. It’s beneficial for you. We will help you learn about the cause of this error and some ways to fix it, so let’s read it.
How Does The Error “importerror: dll load failed: %1 is not a valid win32 application.” Happen?
When trying to import ArcPy into ArcGIS Pro, you easily get the following warning message:
Importerror: dll load failed: %1 is not a valid win32 application.
Due to the Environment Variable ‘PYTHON’ or ‘PYTHONPATH’ referring to a folder holding the ArcMap 32 bits ArcPy module, the ArcGIS Pro 64 bits Python interpreter is trying to load a 32-bit module. Therefore, the error “importerror: dll load failed: %1 is not a valid win32 application.” happens.
Some Ways To Solve The Error “importerror: dll load failed: %1 is not a valid win32 application.”
Method 1: Follow these steps
Follow these steps to fix the error “importerror: dll load failed: %1 is not a valid win32 application.”
- Step 1: In the ArcGIS Pro Python interpreter, let’s run the command below:
import sys for path in sys.path: print (path)
The program iterates over the Python interpreter’s path to refer to modules. Go to Step 2 if the created lists contain the ArcMap 32-bit ArcPy module.
- Step 2: Go to Control Panel -> System -> Advanced system settings -> Environment Variables. This defines the environment variables “PYTHON” and “PYTHONPATH” here.
- Step 3: Click Edit after choosing the ‘PYTHONPATH’ or ‘PYTHON’ variable. Then, the Edit System Variable window is displayed.
- Step 4: Convert the variable’s value to C:\Program Files\ArcGIS\Pro\bin\Python. . Then, select OK.
- Step 5: Finally, Start the machine again.
After finishing these steps, your problem will be solved.
Method 2: Delete the 32-bit Python
You may find the Python bit version by running the command python in a Dos window. First, let’s open the Dos window and do as the following:
C:\Users\zhaosong>python Python 3.7.1 (v3.7.1:260ec2c36a, Oct 20 2018, 14:05:16) [MSC v.1915 32 bit (Intel)] on win32
You can get the bit version of your Windows OS by running the command set pro in the dos window as shown below:
>set pro PROCESSOR_ARCHITECTURE=AMD64 PROCESSOR_IDENTIFIER=Intel64 Family 6 Model 60 Stepping 3, GenuineIntel PROCESSOR_LEVEL=6 PROCESSOR_REVISION=3c03 PROGRAMDATA=C:\ProgramData PROGRAMFILES=C:\Program Files PROGRAMFILES(X86)=C:\Program Files (x86) PROGRAMW6432=C:\Program Files PROMPT=(base) $P$G
To fix this problem, let’s delete the 32-bit Python and install a 64-bit Python alternative. Then, use the 64-bit Python as the Python interpreter of your eclipse Pydev project.
We hope you have found the best way to solve the error “importerror: dll load failed: %1 is not a valid win32 application.” from the solutions mentioned above. If there are any other problems or any questions with this error, please comment below, and we will reply as soon as possible! And whenever you have difficulties with an IT problem, let’s contact us. We are always willing to help you. Thank you for reading our article!
→ Tips On Fixing The Error “ImportError: DLL load failed while importing win32api: The specified module could not be found”
Leave a comment