Installing spyder IDE for ArcPro

24070
23
11-13-2019 04:34 AM
DuncanHornby
MVP Notable Contributor
8 23 24.1K

Introduction

This is a mini guide to installing the spyder IDE so it works for ArcPro and is arcpy aware. Just upgraded ArcPro to the latest version?  See end of article for top tip. 

 

Background info

ArcPro is 64 bit and the version of Python it uses is 64 bit so you need an IDE that will work with a 64 bit version. As of version 2.4.2 of ArcPro it is using Python 3.6.8 in the Anaconda environment.

 

Important pre-install instructions

If you have gone to the Spyder website, downloaded it directly and installed it then that was the wrong thing to do! Uninstall it.

 

Install instructions

  1. In ArcPro click on Project tab then Python in the blue menu bar.
  2. Click on Manage Environments button and in the dialog box you will see the default arcgispro-py3 environment, this is the base install environment.
  3. To avoid corrupting this base environment, click on the clone icon and create a clone, you can choose the default name (arcgispro-py3-clone) or set it to something else. This will take several minutes to run as the environment is cloned.
  4. Make sure it is the Active environment, click OK and restart ArcPro.
  5. In ArcPro click on Project tab then Python in the blue menu bar. Make sure your cloned environment is the active environment.
  6. Click on the Add Packages button.
  7. Find Spyder and then click on the Install button in the panel to the right. Again this will take several minutes for it to install.
  8. That's it you just installed a version of the spyder IDE that will work with ArcPro and is aware of the arcpy module.

 

Post Install instructions

Having installed spyder how do you actually run it? Well the way I do that is to create a short cut to it and place that on my desktop.  You will find the application here:

 

C:\Users\xxx\AppData\Local\ESRI\conda\envs\yyy\Scripts\spyder.exe

 

xxx = Your user login

yyy = Your chosen name for the cloned environment

 

  1. Open file explorer and navigate to spyder location.
  2. Right click on the application and send to desktop to create a shortcut.
  3. Optionally right click on the newly created shortcut, select properties and set the icon for the application, the ico file is in the same folder location as the application.

 

My desktop icons:

 

Tips for when upgrading ArcPro breaks your python environment...

 

I want to share with you a few ideas for you to investigate....

I recently upgraded from 2.8 to 2.9 and this broke my python environment, I eventually tracked it down to the fact I had previously installed (following ESRI's recommended steps) the deep learning libraries and this was causing spyder to fail to install in the new cloned environment because of incompatibility issues with some of the python modules. I did the following:

  1. Uninstall deep learning libraries via add/remove programs
  2. Uninstalled ArcPro
  3. Deleted the contents of the folder C:\Users\XXX\AppData\Local\ESRI\conda where XXX is your user profile name
  4. Installed ArcPro

This then allowed me to successfully clone the python environment and then install spyder.

Tags (3)
23 Comments
JoeBorgione
MVP Emeritus

Good stuff Duncan.  I hope the user in this post follows your link here!

ChrisWiebke
Occasional Contributor

Can you provide some detail on uninstalling spyder?  Thanks, Chris.

DuncanHornby
MVP Notable Contributor

Just the standard Windows approach, go to Add or Remove Programs and uninstall it.

ChrisWiebke
Occasional Contributor

I can open spyder:

but I do not see it in my programs?

DanPatterson_Retired
MVP Emeritus

You have to change into the conda folder in order to execute conda functionality within spyder

/blogs/dan_patterson/2018/12/13/spyder 

%cd C:\arc_pro\bin\Python\Scripts
C:\arc_pro\bin\Python\Scripts

conda list
# packages in environment at C:\arc_pro\bin\Python\envs\arcgispro-py3:
#
alabaster                 0.7.12                   py36_0  
appdirs                   1.4.3              pyh91ea838_0  
arcgis                    1.7.0                  py36_834    esri/label/prerelease
arcgispro                 2.5                           0    esri
asn1crypto                1.2.0                    py36_0  
astroid                   2.3.2                    py36_0  
atomicwrites              1.3.0                    py36_1  

.... huge snip

Note the conda executable (and proenv.bat which executes things and sets stuff up)

is different than the path to the python environment (line 5)

DuncanHornby
MVP Notable Contributor

Chris,

A colleague of mine has that Anaconda Navigator installed and has installed spyder that way. We checked his Windows Add/Remove option and it does not appear in the list, like yours. I guess Anaconda installs it in a different way? I don't have Anaconda Navigator installed so I don't know if you can remove it from that and install spyder following my above instructions or you can have both versions installed?

Duncan

DanPatterson_Retired
MVP Emeritus

spyder should have been installed through the conda environment set up by ArcGIS Pro.

If anaconda navigator wasn't 'tweaked' to be able to be used directly with ArcGIS pro, I suspect it is a separate conda installation.  Navigator doesn't tie into to ArcGIS pro without some modifications to one of the files.

You can only "remove" package through conda or Navigator, Windows knows nothing about what or how packages are installed.

kmsmikrud
Occasional Contributor III

Hi,

I had successfully installed Spyder thru a clone environment and it had been working until I updated to ArcGIS Pro 2.5 and then had a type mismatch in the clone environment. I was able to create a new clone and added the spyder package again similar to before thru the 'add package' within ArcGIS Pro. (your steps above). However now when I go click on the spyder.exe in my Users file path (same as before), I'm getting an error, "This application failed to start because it could not find or load the Qt platform plugin "windows" in "". Reinstalling the application may fix this problem." 

I've been looking around and found info related to the error with setting a new system environment variable with the correct path for "QT_PLUGIN_PATH path" but I'm not sure of what path to use. I tried the suggestion of  “C:\Users\<username>\AppData\Local\ESRI\conda\envs\arcgispro-py3-clone\Library\plugins\platforms” but this didn't resolve the issue or I'm not even sure the plugin is there. How do I find the exact name of the plugin? Is it installed elsewhere with the default install that I could copy it to the file path above?

Has anyone else received this error and can help troubleshoot? 

Thanks,
Kathy

DanPatterson_Retired
MVP Emeritus

clean everything out and start again would be easiest..  You don't click on spyder.exe to run it since there is some prior setup that has to be done, so create a shortcut

/blogs/dan_patterson/2020/02/09/clone-arcgis-pro-25 

/blogs/dan_patterson/2017/07/01/arcgis-pro-2-creating-desktop-shortcuts 

kmsmikrud
Occasional Contributor III

Thanks Dan!

What do you mean by 'clean everything out and start again', delete the clone and clone attempts and then create a new clone? I'm not very familiar at all with conda and so I must have lucked out the first go around with getting the clone and spyder working. I had previously created a shortcut as Duncan had outlined in this post (https://community.esri.com/people/Hornbydd/blog/2019/11/13/installing-spyder-ide-for-arcpro ) for using spyder.

Thanks again for your help!

JoeBorgione
MVP Emeritus

Not quite a couple weeks ago I was in the same spot as you this post :ArcGIS Pro 2.5 New Env but... chronicles how Dan helped me through it...

MattLinker
New Contributor

If you landed on this page, you've likely spend half a day screwing with the tom-**bleep**ery that comes with ESRI, if you can avoid their libraries, when many open source ones from geopandas or shapely and many other can do. 

BrianWilson
Occasional Contributor II

 I love opensource and that includes the Anaconda project, which Esri has chosen to incorporate into ArcGIS Pro. I used spyder for over a year. That said, I find Visual Studio Code to be vastly superior to spyder. I could probably write a 1000 words here easily to tell you why but I will spare you that. It's not open source but it's still free. I use it all day developing both Python and JavaScript code to support GIS work.

The best approach to GIS is not Esri OR open source, the best approach is to use the ALL the tools that work for you, and using VSCode + conda environments makes this approach a lot easier.

It's possible to do just about everything Pythonish inside VSCode, including running Jupyter notebooks. It's also possible to work remotely across network connections and also to use Docker containers for special projects.

Anyway, dump spyder, switch to VSCode. It will be easier for you in the long run.

BSplitt
New Contributor II

Hi, when I try to clone the environment, I get this error. I've read on other websites that users have resolved this issue by running ArcGIS Pro as an administrator, but I'm not sure how to do that. Any help here would be great. 

BSplitt_0-1619486392863.png

 

zhongying_gan
New Contributor III

Hello,

I have installed spyder according to the tutorial. However, when I ran it, there was the following message and I was unable to run spyder. Any comments will be greatly appreciated. Thank you.

spyder.png

Brian_Wilson
Occasional Contributor III

It looks like it wants you to install the package "mkl-service"

Can you tell us what ArcGIS Pro version and what Python version you are using?

I remember hitting this back some time, and I read that mkl-service needs python 3.7 which I believe comes with Pro 2.8. Are you still running Python 3.6?

In Pro, Project -> Python -> look at the list of installed packages, see if mkl-service is there. If not, try using Add Packages and type in mkl-service and see if it shows up.

Or do it all using "conda" at a command line if you know how to do that. On my computer it looked like this

conda install --name=arcgispro-py3-vscode mkl-service
Collecting package metadata (current_repodata.json): done
Solving environment: done
## Package Plan ##
  environment location: C:\Users\bwilson\AppData\Local\ESRI\conda\envs\arcgispro-py3-vscode
  added / updated specs:
    - mkl-service

Proceed ([y]/n)?

 

zhongying_gan
New Contributor III

Hello, 

Thank you for replying. My python version is 3.8.8, and my arcgis pro version is 2.8.2.

The mkl-service is installed in arcgis pro(mkl-service.png).

mkl-service.png

I followed https://medium.com/@ianmcintyre_38849/creating-custom-conda-environments-in-an-arcgis-pro-workflow-1... up until the line "activate my_arcgispro_clone". And then I typed 

conda install --name=arcgispro-py3-vscode mkl-service

But I received the following error:

conda.png

I would really appreciate it if you could share with me your thoughts on this. Thank you.

 

 

Brian_Wilson
Occasional Contributor III

You already have mkl-service so you don't need to install it

What happens if you do this?

conda activate my_arcgispro_clone
conda install spyder

(Once you have activated an environment you don' t have to use the "--name=" option) 

If you have some other version of Spyder installed (like from a separate installer) then you probably want to remove it before installing again with this.

What this is doing is telling conda to install a copy of spyder inside its active environment.

It should also show in your start menu with the environment after it, so for you it should show as 

spyder (my_arcgispro_clone)

Clicking on that should be enough to load the environment and launch spyder.

 

zhongying_gan
New Contributor III

Hello. Thank you so much for your reply. I started the lower version of spyder via the anaconda navigator by changing the "Applications on" field to my cloned arcpy environment, instead of double clicking it to start it, and I could open Spyder without any problem.

by Anonymous User
Not applicable

I followed your instructions to install Spyder. When I launch the program, I get two Spyder icons in the taskbar. Is there a way to get rid of the 2nd icon and just have one? I've tried various ways of launching the program and always get the same result.

Launching Spyder creates two icons in the taskbar.Launching Spyder creates two icons in the taskbar.

Andrew_P
New Contributor II

Hello Duncan and All,

I have referred to this feed multiple times when reviving the Spyder IDE for use with ArcGIS PRO after a PRO version update has broken its functionality (grrrrrr).

I assumed that I would be able to get Spyder working again after an upgrade to PRO 3.x today (first mistake).

I can get Spyder 5.1.5 installed and working in general.

However, Spyder 5.1.5 has a bug which crashes it if you have an input() command in your code [https://github.com/spyder-ide/spyder/issues/17616] - which I didn't know before upgrading to PRO 3.x, and appears to have been fixed in Spyder 5.3.0.

Despite seeing 5.3.3 in the update list in the PRO Package Manager, I can not get the PRO package manager to install the update. Nor can my newbie-ish python skills get conda to update/install 5.3.3 from the command line (see attached screenshots).

It appears that my two choices when starting again fresh tomorrow morning are:
1) Revert to PRO 2.9.x and install and get Spyder working again using Duncan's original post - which will likely break my main project file, which PRO has helpfully 'ugraded to 3.x' and I stupidly accepted... second mistake;

2) Hard code all input() requests in my python code - and hope that no other bugs in 5.1.5 keep the code from running in Spyder;

3) move away from Spyder and use another IDE, although a brief foray into getting other gui-based IDEs working yielded little useful in my scramble today.

Any and all thoughts on my conundrum would be appreciated.

[UPDATE on 26/09/2022 - still no fix for core issue; was able to get the PyCharm IDE set up an working using this link - https://epjmorris.wordpress.com/2020/09/16/configuring-pycharm-for-use-with-arcgis-pro-and-arcmap/ -  (Thanks Grace!). Not ideal but a workaround. Better that people avoid the inconvenience and wait until the bugs in the PRO 3.x - Spyder 5.x interface are worked out. I will add an update to this post if I stick with PRO3.x and Spyder updates and starts to work, or I revert to 2.x in frustration!]

[UPDATE on 03/10/2022 - still no fix for core issue; still running PyCharm. Did some checking against the spyder update list (see third screenshot) and these items - and their dependencies - seem to be holding the spyder 5.1.5 -> 5.3.3 update up in PRO 3.x Package Manager (PM):

* ipython >=7.31.1,<8.0.0 [8.4.0 available in PM, but cannot update; appears to need less than 8.0.0 so need to be able to install older version until spyder 5.x accepts versions >8.0.0]
*python-lsp-black >=1.2.0 (1.2.1 available in PM, but cannot update)
*python-lsp-server >=1.5.0,<1.6.0 (1.5.0 available in PM, but cannot update)
*spyder-kernels >=2.3.3,<2.4.0 (2.3.3 available in PM, but cannot update)
*pyqtwebengine >=5.15,<5.16 (not available in PM? Need to install for spyder5.3.3 to work?)]

Thank you and Kind regards,

Andrew

Screen Shot 2022-09-20 at 15.07.01.pngScreen Shot 2022-09-20 at 16.23.29.png

Spyder update dependenciesSpyder update dependencies

JosephKempf
New Contributor II

I recently upgraded to ArcGIS Pro 3.1 and spyder wouldn't install in the Arc Pro package manager. It kept on giving the following error repeatedly: 

Solving environment: failed with initial frozen solve. Retrying with flexible solve.
Solving environment: failed with repodata from current_repodata.json, will retry with next repodata source.

 

However this tutorial helped. 

https://gis.sfsu.edu/sites/default/files/documents/Spyder_Installation_1.pdf

DuncanHornby
MVP Notable Contributor

To anyone who has ended up at this thread. With every major release of ArcPro spyder gets broken or something does not work and it's a monumental effort it trying to get spyder working with arcpy/arcpro.  I recently upgraded to 3.1.0 and against everything got blitzed and things just stop behaving as expected.  So I have official given up using spyder (shame its a great piece of software) and started using VScode as discussed in this thread. So far VScode installed OK, worked first first and seems to be working OK...

So my advice is abandon spyder and start using VSCode, its a lot less stressful...

About the Author
GIS Desktop Developer I have specialised in river network analysis and mapping but have worked on a wide variety of projects. I am often found at the bottom of a cave!