Activation of Conda Environments

1397
3
Jump to solution
03-04-2023 02:01 PM
Labels (1)
RobertStevens
Occasional Contributor III

I am trying to understanding the use of Conda  within an Arcgis Pro desktop installation (version 3.1).

I'll start with a general comment:
There are a bewildering number of ESRI pages describing this: how to install Anaconda, MiniConda, Clone,...
but frankly, as so often seems to be the case with ERSI's documentation, the pages don't seem to flow together
in some sort of logical progression.

So for my specific questions which are simple:
1. When I "clone" a new Conda environment by cloning an existing copy, am I getting an exact copy of that existing environment? I would have thought yes, but a recursive diff seems to show otherwise, and the documentation seems to imply that in the new env I need to install ESRI arcgis package (conda install -c  esri arcgis) (BTW the documentation shows variously conda install -c esri arcgis=<version>. What version?

2. Suppose I activate the environment, either from a command window or from ARcGIS Pro GUI. Does that activation actually change the file system and hence subsequent invocations of ArcGIS Pro, new command line windows shell, .. whatever, or does the new environment only persist during the session in which the activation is invoked (as would be the case, for instance, if all that happened within the particular session is that some environment variables were changed, shuffled around)

2 Solutions

Accepted Solutions
DanPatterson
MVP Esteemed Contributor

conda install -c esri arcgis

no need for the version unless you want an older version or a version not tied to arcpy.

The clone is more or less the same as the arcgispro-py3 environment.  You should be able to use pro, arcpy and all the tools in arctoolbox.  Other stuff that isn't needed for it isn't carried over, since there is no need having a duplicate when it takes as just about as long to clone and environment as it does to reinstall Pro.

When you activate an environment through the package manager and save your project, close Pro and restart, the last activated environment should still be active.  Are you saying it isn't?


... sort of retired...

View solution in original post

0 Kudos
Brian_Wilson
Occasional Contributor III

Dan's short answer (install arcpy explicitly) is probably good but I personally start with a fresh, empty environment when i do that. I avoid cloning unless there is a reason to do it.

I tested it by cloning and then doing a listing of the installed packages and diffing that. Identical. Except one line

When I did a recursive diff yes I see tons of mismatches but I suspect nothing is relevant. All the same packages and same versions are installed. When I activate the clone, arcpy and arcgis there.

Activation from the command windows affects nothing permanently. Likewise if you set the new env to be the default in Pro, it only affects Pro. If you start a new separate cmd window it knows nothing about the Pro default, whether Pro is running or not.

View solution in original post

0 Kudos
3 Replies
DanPatterson
MVP Esteemed Contributor

conda install -c esri arcgis

no need for the version unless you want an older version or a version not tied to arcpy.

The clone is more or less the same as the arcgispro-py3 environment.  You should be able to use pro, arcpy and all the tools in arctoolbox.  Other stuff that isn't needed for it isn't carried over, since there is no need having a duplicate when it takes as just about as long to clone and environment as it does to reinstall Pro.

When you activate an environment through the package manager and save your project, close Pro and restart, the last activated environment should still be active.  Are you saying it isn't?


... sort of retired...
0 Kudos
RobertStevens
Occasional Contributor III

Hi Dan

You ask "Are you saying it isn't?".

No, not at all. I am not saying either "is" or "isn't". I wanted to be sure I understood what was happening when I activate a new environment. I always feel somewhat anxious when I press a button, or hit return at the end of a command line, and notice a distinct pause -- I find my wondering how much furniture is being moved around off stage occasioned by that one simple action.

 

Thanks

0 Kudos
Brian_Wilson
Occasional Contributor III

Dan's short answer (install arcpy explicitly) is probably good but I personally start with a fresh, empty environment when i do that. I avoid cloning unless there is a reason to do it.

I tested it by cloning and then doing a listing of the installed packages and diffing that. Identical. Except one line

When I did a recursive diff yes I see tons of mismatches but I suspect nothing is relevant. All the same packages and same versions are installed. When I activate the clone, arcpy and arcgis there.

Activation from the command windows affects nothing permanently. Likewise if you set the new env to be the default in Pro, it only affects Pro. If you start a new separate cmd window it knows nothing about the Pro default, whether Pro is running or not.

0 Kudos