PROBLEM

Unable to import ArcPy in ArcGIS Pro

Last Published: December 1, 2023

Description

When importing ArcPy in ArcGIS Pro, one of the following errors is returned:

Error:   
ImportError: DLL load failed: %1 is not a valid Win32 application.
The error ImportError DLL load failed %1 is not a valid Win32 application is returned.
Error:   
ModuleNotFoundError: No module named ‘arcpy’
The error ModuleNotFoundError No module named 'arcpy' is returned.
Error:   
ImportError: No module named arcpy
Error:   
RuntimeError: NotInitialized
Error:
ImportError: DLL load failed: The specified module could not be found.
Error:
ImportError: DLL load failed: The specified procedure could not be found.

Cause

  • The path to the default Python installation is incorrectly set in the environmental variable.
  • The NumPy version installed in ArcGIS Pro is not compatible with the Python version.
  • A stand-alone script using a third-party Python interpreter is used to import ArcPy into ArcGIS Pro.
  • ArcGIS Pro is not updated to the latest version.
  • Python is not updated to the latest version.
  • An antivirus software is preventing the script from running correctly.
  • The DLL file may be corrupted, causing issues with the system operation.
  • The ArcGIS Pro installation may be corrupted, preventing it from running normally.

Solution or Workaround

Depending on the cause, follow one of the workarounds below to resolve the issue.

Clone the Python environment using the Python Command prompt

Get an exact copy of the Python environment to allow switching between sets of Python functionality without uninstalling and reinstalling packages each time. Refer to ArcGIS Pro: Clone an environment or How To: Clone a Python environment with the Python Command Prompt for instructions.

Note:
Ensure the Path, PYTHON, or PYTHONPATH environment variable is correctly set. Refer to How To: Edit an environment variable and Error: ImportError: DLL load failed: %1 is not a valid Win32 application for more information.

Install the latest version of NumPy

Ensure the NumPy version is compatible with the ArcPy version installed in ArcGIS Pro. Refer to FAQ: What version of Python is used in ArcGIS? for more information. Download the appropriate version by referring to NumPy: Installing NumPy.

Run the script in the Python interpreter provided by ArcGIS Pro

Run the script using IDLE instead of a third-party Python interpreter. Refer to ArcGIS Pro: Python IDEs for more information on IDLE.

Update ArcGIS Pro

Update ArcGIS Pro to the latest version. Refer to ArcGIS Pro: Update ArcGIS Pro for further instructions.

Update the Python software to the latest version

Install the latest version of the Python software to update to the latest IDLE version. Refer to Python: Python Releases for Windows for more information.

Disable or create exceptions in the antivirus software installed in the computer

Refer to FAQ: How do I troubleshoot ArcGIS Pro performance issues related to antivirus software (exceptions)? for more information.

Perform a clean uninstall and reinstall of ArcGIS Pro

Remove the files and registry keys of ArcGIS Pro to fully uninstall the software from the system and reinstall ArcGIS Pro. Refer to How To: Perform a clean uninstall and reinstall of ArcGIS Pro for further instructions.

Article ID: 000028203

Software:
  • ArcGIS Pro 3 0
  • ArcGIS Pro 2 8 x
  • ArcGIS Pro 2 7 x
  • ArcGIS Pro 2 x

Receive notifications and find solutions for new or common issues

Get summarized answers and video solutions from our new AI chatbot.

Download the Esri Support App

Related Information

Discover more on this topic

Get help from ArcGIS experts

Contact technical support

Download the Esri Support App

Go to download options