Select to view content in your preferred language

DLL load failed while importing _arcgisscripting with Standalone ArcGIS Scripting Environment in Anaconda

8314
7
Jump to solution
03-10-2023 06:15 AM
JohannesMitterer
New Contributor II

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:

  1. 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).
  2. Second, I removed my Anaconda installation and replaced it with a fresh one.
  3. Third, I removed my ArcGIS Pro and replaced it with a new one.
  4. Fourth, following this blog post, I removed the clone again and created a new one using the Anaconda Prompt instead of the ArcGIS GUI.
  5. 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

1 Solution

Accepted Solutions
by Anonymous User
Not applicable

Instead of installing spyder through Anaconda, I'd stick with installing spyder from Pro's package manager because the packages will come from ersi-conda channel/repo first, and not conda-forge. I think you'd get a better dependencies that work with arcpy.  You can set the preference and order of these channels, but sometimes the conda will default to what it wants (due to dependencies and what is in your pkg folder), regardless of assignment.

I thought Anaconda came with PyCharm Community so that is a bummer it's Professional, but good to know the issue when spyder is involved. If you are a student or teacher, jetbrains offers free licenses for their IDE's. But, Anaconda also comes with VS Code, so if you are truly stuck in Anaconda maybe try VS Code?

I think the architecture difference between PyCharm and spyder is why spyder has so many issues.  PyCharm is built on Java, and is separate from python packages. Spyder is built with/ relies on many of the same python packages that we also use for our code. We may need version 3.1 of a package for our code, but spyder needs 2.8, so one or the other breaks. I could be wrong, but I think it's disastrous trying to coexists for the long term. Maybe some people like having to resolve the environment and spyder every time Pro updates, but I'd rather spend that time working in an IDE that separate, is stable, and only requires pointing to a new interpreter when needed.  Life's too short to fight with these things if there are options available.

View solution in original post

7 Replies
by Anonymous User
Not applicable

Isn't conda great? It could also be that the arcpy is not licensed. 

Sounds like you have two conda managers on your machine and they may be pulling from different package caches.

C:\Users\u\AppData\Local\ESRI\conda\pkgs and C:\Users\u\.conda\pkgs

They can be installed on the same day, within the same hour and still have different versions of packages and dependencies because conda will do what conda does. So trying to use one package from the other (by including/ setting the path) may not work because of dependency difference. If you haven't cleaned those out and rebuilt them during your cleaning, it might be worth to explicitly do so and install again, get Pro working and its env working, and then add Anaconda Navigator if you need it.  You could create a shortcut to spyder once its installed into the environment.

JohannesMitterer
New Contributor II

Hi Jeff,

Thank you for your response.

I did not know yet that ArcGIS Pro installs a second conda manager, but you are right: The paths seem to be a hint for this. Nevertheless, I indeed cleaned out all the user-specific folders (envs and pkgs) before re-installing ArcGIS Pro and Anaconda. This worked for one of our IT administrators, but it did not in my case...

Nevertheless, as I had urgent project work to do, it was the faster solution to set-up the whole Windows from scratch again than to search for the missing file/path somewhere in the deep-memory of the PC.

Thank you all for your thoughts!

Best,

Johannes

0 Kudos
JohannesMitterer
New Contributor II

Update:

I did a complete reset of Windows installing ArcGIS Pro 2.8.3 and Anaconda --> The Python-Clone of ArcGIS Pro worked perfectly with Anaconda/Spyder.

Due to instabilities of some tools (e.g., Pairwise Dissolve) in the ArcGIS Pro version 2.8.3, I tried to upgrade again to ArcGIS Pro 3.1. The result: The tools work great now, but I face the same problems using the new v3.1 clone in Anaconda/Spyder again, so I cannot use the bugfixed tools in stand-alone Python skripts from Anaconda anymore.

Does anybody have an idea, how to solve this issue?

Following this post, I add some information:

Output of "conda list" in the recently created clone:

(arcgispro-py3-clone3p1) C:\WINDOWS\system32>conda list
# packages in environment at C:\Users\ga98tif\AppData\Local\ESRI\conda\envs\arcgispro-py3-clone3p1:
#
# Name                    Version                   Build  Channel
alabaster                 0.7.12             pyhd3eb1b0_0
anyio                     3.5.0            py39haa95532_0
appdirs                   1.4.4              pyhd3eb1b0_0
arcgis                    2.1.0.2                 py39_14    esri
arcgispro                 3.1                           0    esri
arcpy                     3.1             py39_arcgispro_41759  [arcgispro]  esri
arcpy-base                3.1                  py39_41759    esri
argon2-cffi               21.3.0             pyhd3eb1b0_0
argon2-cffi-bindings      21.2.0           py39h2bbff1b_0
arrow                     1.2.3            py39haa95532_1
arrow-cpp                 1.0.1                        17    esri
astroid                   2.5              py39haa95532_1
asttokens                 2.0.5              pyhd3eb1b0_0
atomicwrites              1.4.0                      py_0
attrs                     22.1.0           py39haa95532_0
autopep8                  1.6.0              pyhd3eb1b0_0
azure-core                1.12.0                     py_0    esri
azure-storage-blob        12.8.0                     py_0    esri
babel                     2.11.0           py39haa95532_0
backcall                  0.2.0              pyhd3eb1b0_0
bcrypt                    3.2.0            py39h2bbff1b_1
beautifulsoup4            4.11.1           py39haa95532_0
binaryornot               0.4.4              pyhd3eb1b0_1
black                     22.6.0           py39haa95532_0
blas                      1.0                         mkl
bleach                    4.1.0              pyhd3eb1b0_0
blinker                   1.4              py39haa95532_0
bottleneck                1.3.5            py39h080aedc_0
brotli                    1.0.9                h2bbff1b_7
brotli-bin                1.0.9                h2bbff1b_7
brotlipy                  0.7.0           py39h2bbff1b_1003
ca-certificates           2023.01.10           haa95532_0
cachetools                4.2.2              pyhd3eb1b0_0
certifi                   2022.12.7        py39haa95532_0
cffi                      1.15.1           py39h2bbff1b_3
cftime                    1.6.2                    py39_0    esri
chardet                   4.0.0           py39haa95532_1003
charset-normalizer        2.0.4              pyhd3eb1b0_0
click                     8.0.4            py39haa95532_0
cloudpickle               2.0.0              pyhd3eb1b0_0
colorama                  0.4.6            py39haa95532_0
comm                      0.1.2            py39haa95532_0
contourpy                 1.0.5            py39h59b6b97_0
cookiecutter              1.7.3              pyhd3eb1b0_0
cppzmq                    4.4.1                         4    esri
cryptography              39.0.1           py39h21b164f_0
cycler                    0.11.0             pyhd3eb1b0_0
cytoolz                   0.11.0           py39h2bbff1b_0
dask                      2022.7.0                   py_0    esri
dask-core                 2022.7.0         py39haa95532_0
debugpy                   1.5.1            py39hd77b12b_0
decorator                 5.1.1              pyhd3eb1b0_0
defusedxml                0.7.1              pyhd3eb1b0_0
despatch                  0.2.0                    py39_0    esri
diff-match-patch          20200713           pyhd3eb1b0_0
distributed               2022.7.0         py39haa95532_0
docutils                  0.18.1           py39haa95532_3
entrypoints               0.4              py39haa95532_0
et_xmlfile                1.1.0            py39haa95532_0
exceptiongroup            1.0.0rc9           pyhd8ed1ab_0    esri
executing                 0.8.3              pyhd3eb1b0_0
flake8                    3.9.2              pyhd3eb1b0_0
flit-core                 3.8.0            py39haa95532_0
fonttools                 4.25.0             pyhd3eb1b0_0
freetype                  2.12.1                        4    esri
fsspec                    2022.7.1         py39haa95532_0
future                    0.18.3           py39haa95532_0
gdal                      3.4.0           arcgispro_py39_17150  [arcgispro]  esri
geomet                    1.0.0                      py_0    esri
greenlet                  1.1.1            py39hd77b12b_0
h5py                      3.7.0           arcgispro_py39_0  [arcgispro]  esri
heapdict                  1.0.1              pyhd3eb1b0_0
icc_rt                    2019.0.5            arcgispro_0  [arcgispro]  esri
icu                       58.2                 ha925a31_3
idna                      3.4              py39haa95532_0
imagesize                 1.4.1            py39haa95532_0
importlib-metadata        6.0.0            py39haa95532_0
importlib_metadata        6.0.0                hd3eb1b0_0
inflection                0.5.1            py39haa95532_0
iniconfig                 1.1.1              pyhd3eb1b0_0
intel-openmp              2020.0                      166
intervaltree              3.1.0              pyhd3eb1b0_0
ipykernel                 6.19.2           py39hd4e2768_0
ipython                   8.10.0           py39haa95532_0
ipython_genutils          0.2.0              pyhd3eb1b0_1
ipywidgets                7.7.2                      py_0    esri
isodate                   0.6.0                      py_0    esri
isort                     5.9.3              pyhd3eb1b0_0
jaraco.classes            3.2.1              pyhd3eb1b0_0
jdcal                     1.4.1              pyhd3eb1b0_0
jedi                      0.18.1           py39haa95532_1
jinja2                    3.0.3              pyhd3eb1b0_0
jinja2-time               0.2.0              pyhd3eb1b0_3
jpeg                      9e                   h2bbff1b_1
json5                     0.9.5                      py_0    esri
jsonschema                4.17.3           py39haa95532_0
jupyter_client            6.1.12             pyhd3eb1b0_0
jupyter_console           6.4.2                      py_0    esri
jupyter_contrib_core      0.4.0                      py_0    esri
jupyter_contrib_nbextensions 0.6.0                      py_2    esri
jupyter_core              5.2.0            py39haa95532_0
jupyter_highlight_selected_word 0.2.0                      py_4    esri
jupyter_latex_envs        1.4.6                      py_5    esri
jupyter_nbextensions_configurator 0.4.1                      py_3    esri
jupyter_server            1.21.0                     py_0    esri
jupyterlab                3.4.8                      py_0    esri
jupyterlab_pygments       0.1.2                      py_0
jupyterlab_server         2.16.0                     py_1    esri
jupyterlab_widgets        3.0.3                      py_1    esri
keyring                   23.13.1          py39haa95532_0
kiwisolver                1.4.2            py39hd77b12b_0
krb5                      1.19.2               h5b6d351_0
lazy-object-proxy         1.6.0            py39h2bbff1b_0
lerc                      3.0                  hd77b12b_0
libbrotlicommon           1.0.9                h2bbff1b_7
libbrotlidec              1.0.9                h2bbff1b_7
libbrotlienc              1.0.9                h2bbff1b_7
libdeflate                1.17                 h2bbff1b_0
libiconv                  1.16                 h2bbff1b_2
libpng                    1.6.39               h8cc25b3_0
libprotobuf               3.19.4                        0    esri
libsodium                 1.0.18               h62dcd97_0
libspatialindex           1.9.3                h6c2663c_0
libtiff                   4.5.0                h6c2663c_2
libxml2                   2.10.3               h0ad7f3c_0
libxslt                   1.1.37               h2bbff1b_0
locket                    1.0.0            py39haa95532_0
lxml                      4.9.2            py39h2bbff1b_0
lz4                       3.1.3            py39h2bbff1b_0
lz4-c                     1.9.4                h2bbff1b_0
markupsafe                2.1.1            py39h2bbff1b_0
matplotlib                3.6.0           py39_arcgispro_3  [arcgispro]  esri
matplotlib-base           3.6.0           py39_arcgispro_4  [arcgispro]  esri
matplotlib-inline         0.1.6            py39haa95532_0
mccabe                    0.6.1            py39haa95532_2
mistune                   0.8.4           py39h2bbff1b_1000
mkl                       2020.0            arcgispro_167  [arcgispro]  esri
mkl-service               2.3.0            py39h196d8e1_0
mkl_fft                   1.3.0            py39h46781fe_0
mkl_random                1.0.2            py39h848d8c7_0
more-itertools            8.12.0             pyhd3eb1b0_0
mpmath                    1.2.1            py39haa95532_0
msgpack-python            1.0.3            py39h59b6b97_0
msrest                    0.6.21                     py_0    esri
munkres                   1.1.4                      py_0
mypy_extensions           0.4.3            py39haa95532_1
nbclassic                 0.4.8                      py_0    esri
nbclient                  0.5.13           py39haa95532_0
nbconvert                 6.5.4            py39haa95532_0
nbformat                  5.7.0            py39haa95532_0
nest-asyncio              1.5.6            py39haa95532_0
netcdf4                   1.6.1           py39_arcgispro_1  [arcgispro]  esri
networkx                  2.8.4            py39haa95532_0
nlohmann_json             3.7.0                         2    esri
nose                      1.3.7           pyhd3eb1b0_1008
notebook                  6.4.12                     py_0    esri
notebook-shim             0.1.0                      py_0    esri
ntlm-auth                 1.4.0                      py_0    esri
numexpr                   2.8.1                    py39_0    esri
numpy                     1.20.1                   py39_0    esri
numpy-base                1.20.1                   py39_0    esri
numpydoc                  1.5.0            py39haa95532_0
oauthlib                  3.2.0                    py39_0    esri
olefile                   0.46               pyhd3eb1b0_0
openpyxl                  3.0.10           py39h2bbff1b_0
openssl                   1.1.1t               h2bbff1b_0
packaging                 23.0             py39haa95532_0
pandas                    1.4.4            py39hd77b12b_0
pandocfilters             1.5.0              pyhd3eb1b0_0
paramiko                  2.8.1              pyhd3eb1b0_0
parso                     0.8.3              pyhd3eb1b0_0
partd                     1.2.0              pyhd3eb1b0_1
pathspec                  0.10.3           py39haa95532_0
pefile                    2022.5.30          pyhd8ed1ab_0    esri
pexpect                   4.8.0              pyhd3eb1b0_3
pickleshare               0.7.5           pyhd3eb1b0_1003
pillow                    9.3.0                    py39_0    esri
pip                       23.0.1           py39haa95532_0
platformdirs              2.5.2            py39haa95532_0
pluggy                    1.0.0            py39haa95532_1
poyo                      0.5.0              pyhd3eb1b0_0
pro_notebook_integration  3.1                     py39_12    esri
prometheus_client         0.8.0                      py_0    esri
prompt-toolkit            3.0.36           py39haa95532_0
prompt_toolkit            3.0.36               hd3eb1b0_0
protobuf                  3.19.4                   py39_1    esri
psutil                    5.9.0            py39h2bbff1b_0
ptyprocess                0.7.0              pyhd3eb1b0_2
pure_eval                 0.2.2              pyhd3eb1b0_0
pyarrow                   1.0.1                    py39_3    esri
pybind11                  2.7.1                         1    esri
pybind11_json             0.2.6                         3    esri
pycodestyle               2.7.0              pyhd3eb1b0_0
pycparser                 2.21               pyhd3eb1b0_0
pydocstyle                6.3.0            py39haa95532_0
pyflakes                  2.3.1              pyhd3eb1b0_0
pygments                  2.11.2             pyhd3eb1b0_0
pyjwt                     2.4.0                      py_1    esri
pylint                    2.7.4            py39haa95532_1
pyls-spyder               0.4.0              pyhd3eb1b0_0
pynacl                    1.5.0            py39h8cc25b3_0
pyodbc                    4.0.34           py39hd77b12b_0
pyopenssl                 23.0.0           py39haa95532_0
pyparsing                 3.0.9            py39haa95532_0
pypdf2                    1.26.0                     py_4    esri
pyqt                      5.9.2            py39hd77b12b_6
pyrsistent                0.18.0           py39h196d8e1_0
pyshp                     2.1.3              pyhd3eb1b0_0
pysocks                   1.7.1            py39haa95532_0
pytest                    7.2.0                    py39_0    esri
python                    3.9.16               h6244533_2
python-certifi-win32      1.6                        py_0    esri
python-dateutil           2.8.2              pyhd3eb1b0_0
python-fastjsonschema     2.16.2           py39haa95532_0
python-gssapi             1.8.1                    py39_1    esri
python-lsp-black          1.0.0              pyhd3eb1b0_0
python-lsp-jsonrpc        1.0.0              pyhd3eb1b0_0
python-lsp-server         1.2.4              pyhd3eb1b0_0
python-slugify            5.0.2              pyhd3eb1b0_0
python_abi                3.9                      1_cp39    esri
pytoolconfig              1.2.5            py39haa95532_1
pytz                      2022.7           py39haa95532_0
pywin32                   305              py39h2bbff1b_0
pywin32-ctypes            0.2.0           py39haa95532_1000
pywin32-security          302                      py39_1    esri
pywinpty                  2.0.1                    py39_0    esri
pyyaml                    6.0              py39h2bbff1b_1
pyzmq                     23.2.0           py39hd77b12b_0
qdarkstyle                3.0.2              pyhd3eb1b0_0
qstylizer                 0.2.2            py39haa95532_0
qt                        5.9.7            vc14h73c81de_0
qtawesome                 1.2.2            py39haa95532_0
qtconsole                 5.4.0            py39haa95532_0
qtpy                      2.2.0            py39haa95532_0
regex                     2022.7.9         py39h2bbff1b_0
requests                  2.28.1           py39haa95532_1
requests-gssapi           1.2.3                      py_2    esri
requests-kerberos         0.12.0                        0    esri
requests-negotiate-sspi   0.5.3                    py39_0    esri
requests-oauthlib         1.3.0                      py_0
requests-toolbelt         0.9.1              pyhd3eb1b0_0
rope                      1.7.0            py39haa95532_0
rtree                     1.0.1            py39h2eaa2aa_0
saspy                     4.3.2                      py_1    esri
scipy                     1.6.2                    py39_0    esri
seaborn                   0.12.1           py39haa95532_0
send2trash                1.8.0              pyhd3eb1b0_1
setuptools                65.6.3           py39haa95532_0
sip                       4.19.13          py39hd77b12b_0
six                       1.16.0             pyhd3eb1b0_1
sniffio                   1.2.0            py39haa95532_1
snowballstemmer           2.2.0              pyhd3eb1b0_0
sortedcontainers          2.4.0              pyhd3eb1b0_0
soupsieve                 2.3.2.post1      py39haa95532_0
sphinx                    5.0.2            py39haa95532_0
sphinxcontrib-applehelp   1.0.2              pyhd3eb1b0_0
sphinxcontrib-devhelp     1.0.2              pyhd3eb1b0_0
sphinxcontrib-htmlhelp    2.0.0              pyhd3eb1b0_0
sphinxcontrib-jsmath      1.0.1              pyhd3eb1b0_0
sphinxcontrib-qthelp      1.0.3              pyhd3eb1b0_0
sphinxcontrib-serializinghtml 1.1.5              pyhd3eb1b0_0
spyder                    5.1.5            py39haa95532_1
spyder-kernels            2.1.3            py39haa95532_0
sqlalchemy                1.4.39           py39h2bbff1b_0
sqlite                    3.41.1               h2bbff1b_0
stack_data                0.2.0              pyhd3eb1b0_0
swat                      1.12.0                   py39_0    esri
sympy                     1.9                      py39_1    esri
tblib                     1.7.0              pyhd3eb1b0_0
terminado                 0.13.1           py39haa95532_0
testpath                  0.6.0            py39haa95532_0
text-unidecode            1.3                pyhd3eb1b0_0
textdistance              4.2.1              pyhd3eb1b0_0
three-merge               0.1.1              pyhd3eb1b0_0
tinycss2                  1.2.1            py39haa95532_0
toml                      0.10.2             pyhd3eb1b0_0
tomli                     2.0.1            py39haa95532_0
toolz                     0.11.2             pyhd3eb1b0_0
tornado                   6.1              py39h2bbff1b_0
tqdm                      4.64.1           py39haa95532_0
traitlets                 5.7.1            py39haa95532_0
typed-ast                 1.4.3            py39h2bbff1b_1
typing-extensions         4.4.0            py39haa95532_0
typing_extensions         4.4.0            py39haa95532_0
tzdata                    2022g                h04d1e81_0
ujson                     5.4.0            py39hd77b12b_0
unidecode                 1.2.0              pyhd3eb1b0_0
urllib3                   1.26.14          py39haa95532_0
vc                        14.2                 h21ff451_1
vs2015_runtime            14.27.29016          h5e58377_2
watchdog                  2.1.6            py39haa95532_0
wcwidth                   0.2.5              pyhd3eb1b0_0
webencodings              0.5.1            py39haa95532_1
websocket-client          0.58.0           py39haa95532_4
wheel                     0.38.4           py39haa95532_0
widgetsnbextension        3.6.1                      py_0    esri
win_inet_pton             1.1.0            py39haa95532_0
wincertstore              0.2              py39haa95532_2
winkerberos               0.8.0                    py39_0    esri
winpty                    0.4.3                         4
wrapt                     1.14.1           py39h2bbff1b_0
x86cpu                    0.4                      py39_1    esri
xarray                    0.20.1             pyhd3eb1b0_1
xeus                      0.24.1                        8    esri
xeus-python               0.8.2                        10    esri
xlrd                      2.0.1              pyhd3eb1b0_0
xlwt                      1.3.0            py39haa95532_0
xtl                       0.6.15                        1    esri
xz                        5.2.10               h8cc25b3_1
yaml                      0.2.5                he774522_0
yapf                      0.31.0             pyhd3eb1b0_0
zeromq                    4.3.4                hd77b12b_0
zict                      2.1.0            py39haa95532_0
zipp                      3.11.0           py39haa95532_0
zlib                      1.2.13               h8cc25b3_0
zlib-ng                   2.0.6                         1    esri
zstd                      1.5.2                h19a0ad4_0

(arcgispro-py3-clone3p1) C:\WINDOWS\system32>

 

0 Kudos
by Anonymous User
Not applicable

Could you try PyCharm as an alternative? There is a Anaconda version you can install in Navigator. Start with a fresh clone, without Spyder, only modifying the cloned env through Pro's manager.

0 Kudos
JohannesMitterer
New Contributor II

Hi @Anonymous User,

thank you for the idea. For a better understanding I summarize my Python environment clones:

  • base = original Anaconda environment created while installing Anaconda (from here called "Anaconda-environment")
  • arcgispro-py3 = original ArcGIS Pro environment created while installing ArcGIS Pro 3.1 (from here called "ArcPro-environment")
  • arcgispro-py3-clone3p1 = clone of arcgispro-py3, where I installed Spyder with Anaconda Navigator (from here called "Spyder-environment")
  • arcgispro-py3-clone3p1_pch = clone of arcgispro-py3, where I installed PyCharm Professional (from here called "PyCharm-environment")

I hopefully did what you had in mind (I have never worked with PyCharm before):

  1. Created a fresh clone of the ArcPro-environment (-> PyCharm-environment) and activated it
  2. Activated the PyCharm-env in Anaconda Navigator
  3. Installed PyCharm Professional using Anaconda Navigator (I checked the box to update the PATH variable during the installation process)
  4. Created a new project and set the Python Interpreter Path on the existing Python.exe within the PyCharm-env Environment folder (C:\Users\USER\AppData\Local\ESRI\conda\envs\arcgispro-py3-clone3p1_pch)

--> no error message while importing ArcPy in PyCharm!

Unfortunately, this does not solve my problem, as I could only install the trial version of PyCharm Professional, which is free for 30 days only.

Inspired by this success, I launched Spyder from the Spyder-env in Anaconda Navigator, set the interpreter path accordingly (C:/Users/USER/AppData/Local/ESRI/conda/envs/arcgispro-py3-clone3p1/python.exe) on the Python.exe in the env folder. Additionally, I added the following paths to PYTHONPATH in Spyder:

  • C:\Users\USER\AppData\Local\ESRI\conda\envs\arcgispro-py3-clone3p1
  • C:\Program Files\ArcGIS\Pro\bin\Python

--> error message while importing ArcPy in Spyder!

Could you explain, what did the trick in PyCharm and how I can do the same for Spyder?

Best,

Johannes

0 Kudos
by Anonymous User
Not applicable

Instead of installing spyder through Anaconda, I'd stick with installing spyder from Pro's package manager because the packages will come from ersi-conda channel/repo first, and not conda-forge. I think you'd get a better dependencies that work with arcpy.  You can set the preference and order of these channels, but sometimes the conda will default to what it wants (due to dependencies and what is in your pkg folder), regardless of assignment.

I thought Anaconda came with PyCharm Community so that is a bummer it's Professional, but good to know the issue when spyder is involved. If you are a student or teacher, jetbrains offers free licenses for their IDE's. But, Anaconda also comes with VS Code, so if you are truly stuck in Anaconda maybe try VS Code?

I think the architecture difference between PyCharm and spyder is why spyder has so many issues.  PyCharm is built on Java, and is separate from python packages. Spyder is built with/ relies on many of the same python packages that we also use for our code. We may need version 3.1 of a package for our code, but spyder needs 2.8, so one or the other breaks. I could be wrong, but I think it's disastrous trying to coexists for the long term. Maybe some people like having to resolve the environment and spyder every time Pro updates, but I'd rather spend that time working in an IDE that separate, is stable, and only requires pointing to a new interpreter when needed.  Life's too short to fight with these things if there are options available.

JohannesMitterer
New Contributor II

I tried installing Spyder directly from ArcGIS Pro. This failed for the available Spyder versions 5.4.2 and 5.2.2 because of conflicting dependencies. I attached the protocol, but there are so many conflicts that it is a real mess and I do not expect anybody to unravel this.

I also found the download of PyCharm Community now and installed it. I am gonna make PyCharm to my new IDE to work with in future. Spyder obviously is not able to handle ArcGIS Pro 3.1 on my working environment for the moment.

Thank you, @Anonymous User for these helpful hints. At least you made me understand the advantage of a totally Anaconda-independent IDE, where I can select the interpreter without any interdependencies to other packages.

0 Kudos