ArcGIS Pro 2.2.0 and Python Package Manager

30133
112
Jump to solution
06-27-2018 11:00 AM
MitchHolley1
MVP Regular Contributor

I updated to Pro 2.2.0 today and noticed the default python environment is now read-only.  The previously downloaded packages I had were wiped out with the new update.  I need to get the package, spyder, back into my environment.  So, I cloned the arcgispro-py3 environment in order to make the install. 

Notice that the window says, "Restart ArcGIS Pro for your environment changes to take effect."

So, I clicked 'Exit'. 

After the program restarted, I no longer have a cloned environment to select.

Can someone please help?

112 Replies
TimMinter
Occasional Contributor III

Hi Joe - possibly.  As Dan pointed out earlier, I'm operating in a restricted environment.  Windows AppLocker has been helpfully configured to smack down anything that tries to run from my user account path, which is one of the things going on here.  Event Viewer delivers the receipts on that statement.  I may have to look into installing ArcGIS Pro in a locally supported system path.

0 Kudos
JoeBorgione
MVP Emeritus

And so it goes... They can't make it more difficult for the end user....

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

I always ride with my head out the wind.. not much of a herd guy either

0 Kudos
TimMinter
Occasional Contributor III

Sounds like a pleasure ride in the country

0 Kudos
ErikLash1
Occasional Contributor

Hi Tim.

Since I'm in the same boat with AppData locked down for my users, and we've all been bloodied bashing our heads against the wall on this for way too long, and I've wasted too much of my own time and agencies money on something that should be so simple and a default in the software, and because I spent my entire weekend last weekend running through test environments to get things to work, let me shed some light on some unofficial workaround options.

3  easy options you have.

Option 1) Add Spyder to the default arcgispro-py3 environment via command prompt (I'd not recommend taking this route unless you are certain that you don't need to clone the default environment for anything else or if you want all your clones to have the same software installed as default (ie spyder)).

                  conda install spyder

Option 2) Clone the default arcgispro-py3 environment to a new environment under the the original path and add Spyder to it using an administrative command prompt (safest option). 

  • Open Python Command Prompt as administrator same as above.
  • Once you are up on administrative command prompt clone the default environment to the same root path (Pro only recognizes the Local User Directory and the Python Root path) using code similar to the following:

                  conda create --name "C:\Program Files\ArcGIS\Pro\bin\Python\envs\myEnvName --clone arcgispro-py3

  • Activate the new environment: 
    • activate "C:\Program Files\ArcGIS\Pro\bin\Python\envs\myEnvName"
  • Swap Project Environments in Pro:
    • proswap myEnvName
  • Install spyder
    • conda install spyder

Option 3 (which I went with in the end and am very happy to be using)) is much trickier but much more elegant and ideal solution for the data scientist, install Anaconda Navigator and go from there

Only attempt this if you are comfortable working with Anaconda outside of ArcGIS Pro as successfully accomplishing this (IE not screwing things up) requires understanding Anacondas installation structure and ArcGIS Pro Installs.

  • Open Python Command Prompt as administrator same as above.
  • Activate the root environment:
    • activate root
  • Install Anaconda Navigator to root. NOTE THIS WILL SCREW UP YOUR ARCGIS PRO INSTALLATION, SO YOU MUST BE READY TO FIX IT USING A REPAIR OPERATION.  If you do this and you break your system that's on you. Test your workflow before moving into production.
    • conda install anaconda-navigator
    • Exit the Python Command Prompt and Open Windows Control Panel.
  • In Windows Control Panel, Add-Remove Programs > ArcGIS Pro > Repair missing components or corrupt registry settings.
    • You need to do this step because installing Anaconda Navigator changes the name of "root" env to "base" env and Pro won't work until that's repaired.
  • Open Python Command Prompt as administrator same as above.
    • activate root
  • Open Anaconda Navigator from Command Prompt
    • anaconda-navigator
  • Once Anaconda Navigator opens go to Environments > arcgispro-py3 > Clone to the environment name of your choice.
    • The new environment is fully accessible to Python Package Manager and ArcGIS Pro.
  • Select your new environment in Navigator and add applications, update packages, or add new features to it.

Note 1 -  if you require Jupyter Lab functionality best to update the ArcGIS Python package to 1.5.0 (can be done in Navigator or at the commandline using "conda install -c esri arcgis")

Note 2 - ArcGIS Pro Python Manager locks down changes to every environment under the root install directory, updating and adding packages to all environments you create using these methods requires administrative privileges and must either be done through the command line or Anaconda Navigator.

Anaconda Navigator with ArcGIS Pro integration

DanPatterson_Retired
MVP Emeritus

Option 4... which what I used.

https://community.esri.com/ideas/14817 

  • Install Pro
  • conda install what you want, including navigator, spyder, jupyter whatever etc etc
  • Fix how navigator is deployed so that it can operate where you want to install it (I installed mine in c:\ArcGISPro)
    • To this end, Shaun W. has provided a gist which allows you to edit how anaconda-navigator is called (I have documented this elsewhere as well).  So you can install it where you want.
  • No registry fixes.  In our locked down environment we stopped installing beyond 2.1.  My students have installed the latest and are following this process without incident
  • There are no clones, since the User profile is wiped regularly... there are no clones to disk... they are reimaged regularly during off hours.

It would just be nice to allow for what is needed to be installed upfront.  If things go bad... remove and reinstall.  Works 

ErikLash1
Occasional Contributor

It's a good fix.  I hadn't even noticed that. Thank you for option #4.  That will probably be the option I go with for deployment to my user base.

My decision comes down to actually needing clones. I've found in my testing that installing R Studio into the environment mucks some things up on my machine and both Jupyter Notebooks and Spyder stop working.

In my use case, with R Studio,  it's going to require its own environment to be used.

Hoping to keep things simple with multiple environments under the same root rather than deploying elsewhere for non-esri uses. Plus, we don't have the capability at this time of running off VM or maintaining any but a base installation image of our workstations. "Remove Environment" works so well from Navigator and takes no time at all to complete as opposed to removing entire installs, cleaning leftover files and registry bits, and then reinstalling. We're, unfortunately, a small shop with both limited budgets and limited resources.

DanPatterson_Retired
MVP Emeritus

Good to know about R.  We have a few clamoring around, but I am reluctant to contemplate mingling within the python/Pro environment

0 Kudos
ErikLash1
Occasional Contributor

Attempting the new patch from Shaun W results in this error on my test box with a clean clone of the arcgispro-py3 environment:

patch: navigator-pro.patch: extra operand
patch: Try 'patch --help' for more information.

My first inclination is to think that maybe spaces in the path are causing problems.

Update 1:  Yep. Problem was with spaces in the path. Hardcoded the path string in between quotes and the patch worked. 

Launched Navigator and runs advertised from the cloned environment. No need to mess with root.

This will be my preferred approach with my users until the enhancement is included in an update.

Thanks for the help Shaun W and  

DanPatterson_Retired
MVP Emeritus

i just backed up the file and made the edits manually during beta