what python editors do you use for arcpy

2752
11
Jump to solution
08-10-2021 07:01 PM
zhongying_gan
New Contributor III

Hello. I'm using ArcGIS Pro. I'm doing a project and I would like to be able to replicate my results in the future. Therefore, I would like to use python to run commands in ArcGIS Pro, so that with all the codes saved in a file I could replicate the results in the future.

I've already installed anaconda on my laptop. I used Spyder that comes with anaconda and when I imported arcpy, the error message says "No module named 'arcpy'". Therefore, I followed the following blog to install spyder through ArcGIS Pro: https://community.esri.com/t5/arcgis-pro-blog/installing-spyder-ide-for-arcpro/ba-p/901923However, when I ran it, a console window showed up. Some messages quickly appeared and disappeared. I could only capture part of the message (spyder.png). I was unable to run Spyder. I have tried uninstalling and reinstalling Spyder through ArcGIS Pro. But that doesn't help. It shows in ArcGIS Pro that the version of Spyder ArcGIS Pro downloaded for me is 3.3.6 (spyder2.png). I went to anaconda and downgraded my python to 3.3.6, but I was still not able to import arcpy.

After all this I sort of giving up on using Spyder to import arcpy. I was wondering for those experienced users of python in ArcGIS Pro, what python editors do you use? And how should I make the python editor able to import arcpy?

Thank you. Any comments are appreciated.

1 Solution

Accepted Solutions
Deborah_Priss
New Contributor II

If you're still considering Spyder, I had the same issue and I used this

https://www.programmersought.com/article/32855710236/

to set up Spyder. Then I start it via the anaconda navigator by changing the "Applications on" field to my cloned arcpy environment. That was the only thing that worked for me.

View solution in original post

11 Replies
DanPatterson
MVP Esteemed Contributor

esri hasn't updated the version of spyder.

Install in your base environment or in your clone if you intend to use it there.  Remove the old version or you will have dependency issues

>>> conda install spyder=5.0.5


... sort of retired...
by Anonymous User
Not applicable

You can use any IDE/Python editor to run arcpy scripts, as long as it allows you to select the ArcGIS Pro python environment for use. For example, I use VS Code, and  can set the environment to the default python environment that is included with ArcGIS Pro.

This can be set by clicking the "Select Python Environment" message:

no-interpreter-selected-statusbar.png

 ...clicking "Enter interpreter path"...

enter-interpreter-path.png

...and entering the path of your arcgispro-py3 environment. By default this is "C:\Program Files\ArcGIS\Pro\bin\Python\envs\arcgispro-py3".

enter-or-find-interpreter.png

Hope this helps!

Deborah_Priss
New Contributor II

If you're still considering Spyder, I had the same issue and I used this

https://www.programmersought.com/article/32855710236/

to set up Spyder. Then I start it via the anaconda navigator by changing the "Applications on" field to my cloned arcpy environment. That was the only thing that worked for me.

zhongying_gan
New Contributor III

I was able to start Spyder this way. Thank you.

0 Kudos
JoeBorgione
MVP Emeritus

@Deborah_Priss & @zhongying_gan   What version ArcGIS Pro are you using?   The link Deborah provides shows Pro 2.5.

That should just about do it....
0 Kudos
zhongying_gan
New Contributor III

Hello.  My arcgis pro version is 2.8.2. I didn't use the link @Deborah_Priss mentioned. I installed Python following the steps on https://community.esri.com/t5/arcgis-pro-blog/installing-spyder-ide-for-arcpro/bc-p/1088109#M369. Then I started it via the anaconda navigator by changing the "Applications on" field to my cloned arcpy environment. 

0 Kudos
Deborah_Priss
New Contributor II

I also use 2.8 but it worked anyway. I tried various other approaches and decided to give it a try.

JoeBorgione
MVP Emeritus

I'm going to give this a shot.

That should just about do it....
0 Kudos
JoeBorgione
MVP Emeritus

I'm in the Spyder camp (thanks to @DanPatterson ).  One word of caution however; installing packages in ArcGIS Pro 2.8 is problematic.  There is a bug where changing to a cloned environment does not work.  I'm holding at 2.7.3 until that gets fixed. See this thread...

That should just about do it....