GEOG 485:
GIS Programming and Software Development

1.4.3 Installing Spyder

PrintPrint

Spyder is the easiest IDE to install for ArcGIS Pro development as we can install it from within Pro. Go to Pro's Project menu, then choose Python to open Pro's Python Package Manager. If you are using ArcGIS Pro  version 2.2 or newer, you will first have to create and activate a clone of the ArcGIS default Python environment (see here for details on this issue). To do this, click on "Manage Environments" just above "Installed Packages", choose "Clone Default", and wait around 10 minutes or so, while ArcGIS is creating the clone (in version 2.7 you should see a list of packages being installed which will tell you that the clone is being created). If the cloning fails with an error message saying that a Python package couldn't be installed, you may need to run ArcPro as an Administrator (do a right-click -> Run as administrator on the ArcGIS Pro icon) and repeat the steps above (it's also helpful to mouseover that error box in Pro and see if it gives you any additional details). 

When the cloning is done, the new environment "arcgispro-py3-clone" (or whatever you choose to call it - but we'll be assuming it's called the default name) can be activated by clicking on the button on the left. Do so and also note down the path where the cloned environment has been installed appearing below the name. It should be something like C:\Users\<username>\AppData\Local\ESRI\conda\envs\arcgispro-py3-clone . Then click the OK button. You often need to restart Pro to get this change to take effect and you may see a message telling you to restart.

Now perform the following steps to install Spyder:

  1. Click Add Packages.
  2. In the Search box, search for spyder to narrow the list of packages.
  3. Select spyder from the list (the version number will be different to the image below and that's ok - spyder is regularly updated).  This will populate the box to the right of the list with a description of the spyder package. (If you cannot find spyder under "Add Packages", please check under "Installed Packages" whether it's already there; it seems like in some versions Pro, spyder already comes installed).
  4. Click the Install button within this description box.  You may get a "User Access Control" window popup asking if you want conda_uac.exe to make changes to your device.  It's OK to choose Yes.

screen capture of python package manager and the spyder program

Figure 1.21 Spyder installation

Source: ArcGIS Pro

If you're unable to click Install (e.g. it's greyed out) and get an error message stating "Note: Cannot modify the default Python environment. Clone and activate a new environment.", go back to what is said above about cloning the environment and activating the clone, and make sure you performed these steps correctly (you may need to restart Pro).

Once Spyder is installed, you might like to create a shortcut to it on your Desktop or Start Menu. In that case you should be able to find the Spyder executable at C:\Users\<username>\AppData\Local\ESRI\conda\envs\arcgispro-py3-clone\Scripts\spyder.exe where <username> needs to be replaced with your Windows user name, or  at C:\Program Files\ArcGIS\Pro\bin\Python\envs\arcgispro-py3\Scripts\spyder.exe if this is an older (pre version 2.2) version of ArcGIS Pro and you didn't have to create a clone of the Python environment.

If you are familiar with another IDE you're welcome to use it instead of Spyder (just verify that it is using Python 3!) but we recommend that you still install Spyder to be able to work through the following sections and the sections on debugging in Lesson 2.

When Spyder launches it should display a message in the IPython tab similar to :

Python 3.6.2 |Continuum Analytics, Inc.| (default, Jul 20 2017, 12:30:02) [MSC v.1900 64 bit (AMD64)]
Type "copyright", "credits" or "license" for more information.

IPython 6.3.1 -- An enhanced Interactive Python.
In [1]:

Don’t worry if the version number is slightly different, as long as it starts with a 3.  With Spyder installed, let's have a look at how it works.