0

I am running ArcGIS Pro 2.2 and I have cloned my conda environment from Python command prompt. When I activate this environment and attempt to run Python 3.5 from the terminal, I can load arcpy as the cloned environment runs the python located at 'C:\\Program Files\\ArcGIS\\Pro\\bin\\Python\\envs\\arcgispro-py3\\python.exe'. However, Spyder links to the python installed in the cloned environment and I get the following traceback:

File "<ipython-input-4-f7f77bfeaa96>", line 1, in <module>
    from arcpy.geoprocessing import gp

  File "C:\Program Files\ArcGIS\Pro\Resources\ArcPy\arcpy\__init__.py", line 66, 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

ImportError: DLL load failed: The specified module could not be found.

I have followed the directions located here and here, and the paths mirror a previous installation of ArcGIS Pro 2.0 from which I can use Spyder and arcpy together.

Does anyone know how to resolve this?

6
  • It's easier to just install Spyder into your cloned conda environment. Run "Start Menu\Programs\ArcGIS\ArcGIS Pro\Python Command Prompt" (not Python Interactive Terminal) and type conda install spyder. Then use that Spyder to run ArcGIS Pro arcpy scripts.
    – user2856
    Mar 19, 2019 at 23:00
  • That is how I installed spyder. I am editing my question to add some more information.
    – user44796
    Mar 20, 2019 at 13:21
  • You might be missing ArcGISPro.pth, copy from C:\Program Files\ArcGIS\Pro\bin\Python\envs\arcgispro-py3\Lib\site-packages to your env, Lib\sitepackages.
    – klewis
    Mar 20, 2019 at 15:04
  • This might be more of a conda issue, so I have posted the question on Stack Overflow. stackoverflow.com/questions/55268949/…. This question could be put on hold.
    – user44796
    Mar 20, 2019 at 19:40
  • My cloned ArcGIS Pro 2.2 env is in "%LocalAppData%\ESRI\conda\envs\arcgispro-py3-clone". I just ran conda install spyder from my activated env and then from the same command prompt, ran spyder which opened and I was able to import arcpy from the spyder IPython console. My clone runs the python in the env, i.e "%LocalAppData%\ESRI\conda\envs\arcgispro-py3-clone\python.exe" not from the original env, so I don't know how you've managed that.
    – user2856
    Mar 21, 2019 at 3:33

1 Answer 1

1

Okay all,

I think that I figured out the problem. When I cloned the ArcGISPro environment, I used the following: conda create --clone arcgispro-py3 --name clone. This led to the creation of a clone located at %LocalAppData%\conda\conda\envs\clone. This is not the default location that ArcGISPro uses. When I clone using conda create --clone arcgispro-py3 --name %LocalAppData%\ESRI\conda\envs\clone is creates the cloned environment at %LocalAppData%\ESRI\conda\envs, which is the default location. I am now able to use arcpy from within spyder.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.