AnsweredAssumed Answered

Code working in ArcGIS Pro Python Window but not in Spyder

Question asked by tab5ay_uvalibrary on Jul 30, 2019
Latest reply on Sep 13, 2019 by Dan_Patterson

Like many of you, I want to be able to edit and execute python code from Spyder instead of ArcGIS's Python Window. I am running into some problems and hoping that someone can help me troubleshoot what exactly is going on. I noticed that some old scripts that I had written would no longer execute in Spyder but when the code was copied into ArcGIS Pro's Python Window the code worked just fine. After messing around with it for quite some time, uninstalling and reinstalling both ArcGIS Pro and Anaconda3 Navigator (3.7 64-bit), to not avail I decided to roll uninstall both again, delete all traces of them from my system, delete registry keys, etc. to make sure it wasn't the fault of something latent on my computer after uninstalling.


I just got everything reinstalled and am running into the exact same problem. Again, the code will work when copy pasted into the Python Window in ArcGIS Pro, but not in Spyder. Here is how I installed it after my clean uninstall:

1) Installed ArcGIS 2.3

2) Installed Patched 2.3.1, 2.3.2, and 2.3.3 in that order (I'm wary of 2.4 and know my code was working on 2.3)

3) Opened ArcGIS, signed in, went to Project --> Python --> Manage Environments --> Clone Environment

4) Once the Cloned Environment (named arcgispro-py3-clone) finished installing I closed ArcGIS Pro and restarted it

5) Went back into Project --> Python --> Manage Environments and changed the environment to the cloned environment

6) Checked that my sample code worked in the cloned environment in the Python Window, it did

7) Installed the spyder package (which installed all of its dependencies)

8) Restarted ArcGIS Pro, checked that spyder package was installed, tried code again in Python Window, it worked

9) Installed Anaconda3 -> unchecked Anaconda3 as default Python 3.7, did not add to path

10) Opened Anaconda3 and checked for cloned arcgispro-py3 environment, it was there

11) Restarted computer for good measure

12) In Anaconda3, switched to arcgispro-py3-clone environment and launched spyder

13) Opened and ran my test code


Here is the error given to me by Spyder:


runfile('G:/My Drive/Python Scripts/', wdir='G:/My Drive/Python Scripts')
Traceback (most recent call last):

File "<ipython-input-1-210cd50e08ec>", line 1, in <module>
runfile('G:/My Drive/Python Scripts/', wdir='G:/My Drive/Python Scripts')

File "C:\Users\Tab5a\AppData\Local\ESRI\conda\envs\arcgispro-py3-clone\lib\site-packages\spyder_kernels\customize\", line 827, in runfile
execfile(filename, namespace)

File "C:\Users\Tab5a\AppData\Local\ESRI\conda\envs\arcgispro-py3-clone\lib\site-packages\spyder_kernels\customize\", line 110, in execfile
exec(compile(, filename, 'exec'), namespace)

File "G:/My Drive/Python Scripts/", line 27, in <module>
ap.CopyFeatures_management(vtx_arr, vtx_output)

File "C:\Program Files\ArcGIS\Pro\Resources\ArcPy\arcpy\", line 2624, in CopyFeatures
raise e

File "C:\Program Files\ArcGIS\Pro\Resources\ArcPy\arcpy\", line 2621, in CopyFeatures
retval = convertArcObjectToPythonObject(gp.CopyFeatures_management(*gp_fixargs((in_features, out_feature_class, config_keyword, spatial_grid_1, spatial_grid_2, spatial_grid_3), True)))

File "C:\Program Files\ArcGIS\Pro\Resources\ArcPy\arcpy\geoprocessing\", line 498, in <lambda>
return lambda *args: val(*gp_fixargs(args, True))

RuntimeError: Object: Error in executing tool


I'm hoping I left out a step or something of that nature akin to forgetting to copy the batch files in ArcMap, but otherwise I have no clue why this wouldn't be working. Thank you all for your time and help.