ArcGIS PRO .... your conda environments and script editor

14610
1
07-01-2018 04:10 PM
Labels (1)
DanPatterson_Retired
MVP Emeritus
13 1 14.6K

Make it happen

/blogs/dan_patterson/2018/10/08/making-conda-package-installs-easier 

 Install Spyder, Jupyter console and Jupyter notebook for ArcGIS Pro by default 

With ArcGIS PRO 2.2 there has been a slight change in the way packages can be installed. 

This will evolve but some pictures to get you going.

---------------------     ---------------------     ---------------------    ---------------------    

Updates....

---------------------     ---------------------     ---------------------    ---------------------    

Readings

Esri's Anaconda cloud repo... location of the install packages for Pro 2.2

Spyder .... a view of the IDE's capabilities

The Python Package Manager—ArcPy Get Started | ArcGIS Desktop 

Issues and workarounds

Mangled paths issue … package manager fails to read the _ in the _backup

comment on arcgis pro 2.2.0 and python package manager 

---------------------     ---------------------     ---------------------    ---------------------    

Current installation

Here is where I installed Pro 2.2 a while ago and here it still resides today.

Now some of you don't have the luxury of being able to install your software where you want, but most of this should work if you are given the slightest bit of freedom in how you want to perform your work.  You will be able to perform most of the following in your User profile though (albeit, creating ridiculously long and convoluted path lengths..

Onward.... find out where ArcGIS Pro is installed....

---------------------     ---------------------     ---------------------    ---------------------    

Make some shortcuts

I covered making shortcuts previously, but I will reiterate here.  I like shortcuts on the desktop and I like to dock them on the Task Bar.  First... create your shortcut

Conda access shortcut

Follow the path to the proenv.bat file located as shown in the following figure.

My installation path is C:\ArcGISPro\ You just need to change that portion in your searching and the rest will be the same.

When I located, the file, I created a shortcut and modified the contents of the shortcut as shown below.  I then copied that shortcut to my desktop.

I always keep a separate folder containing customizations like shortcuts so that I can share and/or modify as needed.

: ----------------------------------------------------------------------------

Installing Spyder and other packages

Yes... spyder is in the default package, but since the ArcGISpro-py3 environment is shut down, you have to do installs using conda..

If you don't have a shortcut created... just fire up the python prompt

Or fire up your new shortcut and follow along

Navigate to  C:\Your_Install_Folder\bin\Python\envs\arcgispro-py3\Scripts\spyder-script.py

and make a shortcut like...

Target

C:\ArcGISPro\bin\Python\envs\arcgispro-py3\pythonw.exe "C:\ArcGISPro\bin\Python\envs\arcgispro-py3\Scripts\spyder-script.py"

NOTE...
!!! if your default installation path has flotsam (like spaces, dashes and dots),
 you may have to enclose both portions of the Target in double quotes.  !!!!!

If you want to make a development environment, you now need to clone it to install packages.

Here is the Manage Environments dialog, found on the Project page.

---------------------     ---------------------     ---------------------    ---------------------    

Setup Spyder as your script IDE

You get to reuse the Target shortcut used before.  

Just remember 

  • the pythonw.exe and spyder-script.py paths below need to be on one line.
  • if the python path is in a horrid space or flotsam filled path... enclose it in double quotes.
  • always enclose the spyder-script.py path in double quotes
  • Remember to replace C:\ArcGISPro with your installation path... everything else is the same
  • This is your target path and it goes into the geoprocessing editor selection as below
  • environment:  C:\ArcGISPro\bin\Python\envs\arcgispro-py

Put them together....

     env\pythonw.exe "env\Scripts\spyder-script.py"

Yields....

C:\ArcGISPro\bin\Python\envs\arcgispro-py3\pythonw.exe "C:\ArcGISPro\bin\Python\envs\arcgispro-py3\Scripts\spyder-script.py"

---------------------     ---------------------     ---------------------    ---------------------    

Alternative IDEs ...

Of course you can always install and use Pythonwin for that easy-to-use Python IDE

How about just a simple QtConsole for parallel IDEs

---------------------     ---------------------     ---------------------    ---------------------    

Jupyter Notebook... graphing, analysis and graphing...

Just create a folder structure to store your notebooks and it can be replicated within the jupyter setup making it easy to find your examples.

A graphing example... there are lots

---------------------     ---------------------     ---------------------    ---------------------    

To Come... Managing your packages...

If will fill these in over the next week or so... a few things have to be cleaned up since they may not be for everyone.  So I will delay for now

I just used conda to upgrade jupyter notebook and install jupyter lab.  To stop it from trying to downgrade a bunch of packages, just add the default channel and --no-pin.  

ArcGIS Pro's package manager

Currently locked down for editing the initial install... and there are issues 'cloning' the existing one to make changes in.  Mind you... you can do your package installations using conda after the initial install, skipping the package manager altogether.  BUT .... if things get totally fouled up, you may be left with a dysfunctional installation... so only proceed if you sortof know what you are doing

Anaconda Navigator

So very useful, since you can access other Anaconda packages through one interface... but currently not ArcGIS Pro, but many others including documentation and the like.

https://community.esri.com/ideas/14817-anaconda-navigator-to-arcgis-pro

So... Once Anaconda Navigator got installed, I decided to see whether I could clone an environment that Pro 2.2 could see ... which seems to be an issue.  It seems to have worked so far.  Have a look

Now to experiment....

IF you have comments and questions... email me through my profile link

1 Comment
About the Author
Retired Geomatics Instructor at Carleton University. I am a forum MVP and Moderator. Current interests focus on python-based integration in GIS. See... Py... blog, my GeoNet blog...
Labels