Dear all,
I usually work with a complete ArcGIS Pro installation on an x64-Windows10 machine. I additionally used to script with a Python environment clone created in the ArcGIS Pro GUI, and Spyder started from Anaconda Navigator.
With the recent upgrade to ArcGIS Pro 3.1, I started getting error messages in Spyder last week while importing ArcPy:
ImportError: DLL load failed while importing _arcgisscripting: Das angegebene Modul wurde nicht gefunden.
Although I followed the usual procedure after an upgrade (deleting, copying and activating a new clone in ArcGIS Pro), this did not solve the problem. Based on troubleshooting reports on the web, I tried several modifications then:
- First, I deleted the created clone, cleaned up all temporary files in the User folders of conda and ESRI and created the clone again (with the old and afterwards also with a new name).
- Second, I removed my Anaconda installation and replaced it with a fresh one.
- Third, I removed my ArcGIS Pro and replaced it with a new one.
- Fourth, following this blog post, I removed the clone again and created a new one using the Anaconda Prompt instead of the ArcGIS GUI.
- And finally, I tried to solve this by adding path strings to the system variables "Path" and "PYTHONPATH" (the created environment is called "esri", I did not change the user variables as the paths are user-independent):
- C:\ProgramData\Anaconda3\envs\esri\Lib\site-packages\arcgisscripting
- C:\Program Files\ArcGIS\Pro\bin\Python\envs\arcgispro-py3\Lib\site-packages\arcgisscripting
Unfortunately, I was not able to solve it. I also run the DependencyWalker tool on the _arcgisscripting.pyd file in C:\ProgramData\Anaconda3\envs\esri\Lib\site-packages\arcgisscripting getting some error messages:
Error: At least one required implicit or forwarded dependency was not found.
Error: At least one module has an unresolved import due to a missing export function in an implicitly dependent module.
Error: A circular dependency was detected.
Warning: At least one delay-load dependency module was not found.
Warning: At least one module has an unresolved import due to a missing export function in a delay-load dependent module.
I am new to DependencyWalker, but as far as I have seen, the tool cannot tell me directly what I must do to make Python find the _arcgisscripting.pyd file in the created environment.
Right now, I have no idea anymore what I could try next. I do not want to make a new setup of the whole Windows system just because of a missing path string; I hope someone can help me with this...
Here are the code lines and the resulting error message again:
(base) C:\Users\ga98tif>activate esri
(esri) C:\Users\ga98tif>python
Python 3.9.16 (main, Mar 8 2023, 10:39:24) [MSC v.1916 64 bit (AMD64)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> import arcpy
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "C:\Program Files\ArcGIS\Pro\Resources\ArcPy\arcpy\__init__.py", line 77, in <module>
from arcpy.geoprocessing import gp
File "C:\Program Files\ArcGIS\Pro\Resources\ArcPy\arcpy\geoprocessing\__init__.py", line 14, in <module>
from ._base import *
File "C:\Program Files\ArcGIS\Pro\Resources\ArcPy\arcpy\geoprocessing\_base.py", line 14, in <module>
import arcgisscripting
File "C:\ProgramData\Anaconda3\envs\esri\lib\site-packages\arcgisscripting\__init__.py", line 131, in <module>
from ._arcgisscripting import *
ImportError: DLL load failed while importing _arcgisscripting: Das angegebene Modul wurde nicht gefunden.
>>>
Thank you already in advance and best regards,
Johannes