English
Continue in the app
Be The First To Get Support Updates
Want to know about the latest technical content and software updates?

Problem: Unable to import ArcPy in ArcGIS Pro

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 Esri Belux: Clean uninstall of ArcGIS Pro for further instructions.

Related Information

Last Published: 9/16/2022

Article ID: 000028203

Software: ArcGIS Pro 3.0.1, 3.0, 2.9.4, 2.9.3, 2.9.2, 2.9.1, 2.9, 2.8.7, 2.8.6, 2.8.5, 2.8.4, 2.8.3, 2.8.2, 2.8.1, 2.8, 2.7.7, 2.7.6, 2.7.5, 2.7.4, 2.7.3, 2.7.2, 2.7.1, 2.7