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)
😎 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/polyline_to_polygon.py', 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/polyline_to_polygon.py', wdir='G:/My Drive/Python Scripts')
File "C:\Users\Tab5a\AppData\Local\ESRI\conda\envs\arcgispro-py3-clone\lib\site-packages\spyder_kernels\customize\spydercustomize.py", 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\spydercustomize.py", line 110, in execfile
exec(compile(f.read(), filename, 'exec'), namespace)
File "G:/My Drive/Python Scripts/polyline_to_polygon.py", line 27, in <module>
ap.CopyFeatures_management(vtx_arr, vtx_output)
File "C:\Program Files\ArcGIS\Pro\Resources\ArcPy\arcpy\management.py", line 2624, in CopyFeatures
raise e
File "C:\Program Files\ArcGIS\Pro\Resources\ArcPy\arcpy\management.py", 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\_base.py", 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.
Thomas... does that software install a version of python?
It does not. I found the following solution, I'm unsure if anything else relies on these .dll files, but my scripts now work.
yup... libmmd has caused python issues before according to a quick dr google search and it is indeed in the ArcGIS pro install paths
C:\arc_pro\bin
C:\arc_pro\bin\Python\envs\arcgispro-py3\Library\bin
(change arc_pro to match your installation path)