How to use Conda in my cloned environment?

228
8
Jump to solution
07-01-2022 01:45 PM
ShawnCarson
New Contributor III

I have cloned my python environment using Environment Manager in Pro

So I have this:

C:\Users\xxxxxx\AppData\Local\ESRI\conda\envs\arcgispro-py3-clone\Scripts

Question: There is no conda.exe anywhere here. Don't I get a conda.exe when I clone?

The only place I found a conda.exe is here (default install): C:\Program Files\ArcGIS\Pro\bin\Python\Scripts

When you clone,  it literally creates a folder called Conda. Why don't I get a conda.exe?

 

Thanks for reading! Have a good weekend everyone.

 

0 Kudos
4 Solutions

Accepted Solutions
BrianWilson7
Regular Contributor

You clone, then you activate the environment, then you can continue using the conda command right? Your PATH should still have the original conda.exe on it. The path gets modified when you activate it to add the stuff it needs to the current environment, and then restored when you deactivate. The part of the PATH for the conda command should exist in both environements.

 

View solution in original post

DanPatterson
MVP Esteemed Contributor

from a clone.... use conda info

(pro_3) C:\Users\dan_p\AppData\Local\ESRI\conda\envs\pro_3>conda info

     active environment : pro_3
    active env location : C:\Users\dan_p\AppData\Local\ESRI\conda\envs\pro_3
       user config file : C:\Users\dan_p\.condarc
 populated config files : C:\arc_pro\bin\Python\.condarc
          conda version : 4.9.2
    conda-build version : not installed
         python version : 3.9.12.final.0
       virtual packages : __cuda=11.2=0
                          __win=0=0
                          __archspec=1=x86_64
       base environment : C:\arc_pro\bin\Python  (writable)
           channel URLs : https://conda.anaconda.org/esri/win-64
                          https://conda.anaconda.org/esri/noarch
                          https://repo.anaconda.com/pkgs/main/win-64
                          https://repo.anaconda.com/pkgs/main/noarch
                          https://repo.anaconda.com/pkgs/r/win-64
                          https://repo.anaconda.com/pkgs/r/noarch
                          https://repo.anaconda.com/pkgs/msys2/win-64
                          https://repo.anaconda.com/pkgs/msys2/noarch
          package cache : C:\Users\dan_p\AppData\Local\ESRI\conda\pkgs
                          C:\arc_pro\bin\Python\pkgs
                          C:\Users\dan_p\.conda\pkgs
       envs directories : C:\arc_pro\bin\Python\envs
                          C:\Users\dan_p\AppData\Local\ESRI\conda\envs
                          C:\Users\dan_p\.conda\envs
               platform : win-64
             user-agent : conda/4.9.2 requests/2.27.1 CPython/3.9.12 Windows/10 Windows/10.0.22000
          administrator : False
             netrc file : None
           offline mode : False


(pro_3) C:\Users\dan_p\AppData\Local\ESRI\conda\envs\pro_3>

and

(pro_3) C:\Users\dan_p\AppData\Local\ESRI\conda\envs\pro_3>conda env list
# conda environments:
#
pro_3                 *  C:\Users\dan_p\AppData\Local\ESRI\conda\envs\pro_3
base                     C:\arc_pro\bin\Python
arcgispro-py3            C:\arc_pro\bin\Python\envs\arcgispro-py3


(pro_3) C:\Users\dan_p\AppData\Local\ESRI\conda\envs\pro_3>

of course there is

Anaconda Nucleus

and

Conda Cheatsheet: Your Guide to Basic Conda Commands (anaconda.cloud)

It takes a while but it is navigable eventually

 


... sort of retired...

View solution in original post

DanPatterson
MVP Esteemed Contributor

PS

I create a desktop shortcut to run

C:\... ArcGISPro Install Folder\bin\Python\Scripts\proenv.bat

with  

Start In 

set to

C:\... ArcGISPro Install Folder\bin\Python\envs\arcgispro-py3

Also, some python IDE's can run conda from within.  Spyder, for example, has line magics that allow you to run conda from the editor


... sort of retired...

View solution in original post

0 Kudos
JeffK
by MVP Regular Contributor
MVP Regular Contributor

There is a Python Command Prompt that is in the ArcGIS app folder you can use to skip the cd commands.

Starting the Python Command Prompt starts a conda command prompt in the currently active Pro environment.

If you want to change the active env to your clone, its a simple command: activate <your env>. 

If you want set the env to be the active env in Pro, use the command:  proswap <your env>.  The next time you open the Python Command Prompt, it would start in the env you set and Pro will be set.

View solution in original post

8 Replies
BrianWilson7
Regular Contributor

You don't get a copy but you don't need a clone of the conda executable so it does not matter.

What folder are you talking about? I currently have 2 envs that have etc/conda/ folders but those are to hold environment settings.

BrianWilson7
Regular Contributor

You clone, then you activate the environment, then you can continue using the conda command right? Your PATH should still have the original conda.exe on it. The path gets modified when you activate it to add the stuff it needs to the current environment, and then restored when you deactivate. The part of the PATH for the conda command should exist in both environements.

 

ShawnCarson
New Contributor III

Hi Brian,

Thanks for replying. When you say PATH do you mean environmental variable?

The only way I can fire up conda is to fire up a command prompt then cd to here here:

C:\Program Files\ArcGIS\Pro\bin\Python\Scripts

I can now type  conda list (for example) and it works.

I guess I am just trying to understand if conda.exe is in the clone and how to activate it. I may not fully understand the purpose of it. I thought the whole point of cloning and activating was to have mutually exclustive "silos" of my python stuff including conda. I am trying to lern more about conda so don't let me waste too much of your time. Just trying to make sense of the deluge of material (conda, anaconda, miniconda and how it works w/in Pro.)

0 Kudos
DanPatterson
MVP Esteemed Contributor

from a clone.... use conda info

(pro_3) C:\Users\dan_p\AppData\Local\ESRI\conda\envs\pro_3>conda info

     active environment : pro_3
    active env location : C:\Users\dan_p\AppData\Local\ESRI\conda\envs\pro_3
       user config file : C:\Users\dan_p\.condarc
 populated config files : C:\arc_pro\bin\Python\.condarc
          conda version : 4.9.2
    conda-build version : not installed
         python version : 3.9.12.final.0
       virtual packages : __cuda=11.2=0
                          __win=0=0
                          __archspec=1=x86_64
       base environment : C:\arc_pro\bin\Python  (writable)
           channel URLs : https://conda.anaconda.org/esri/win-64
                          https://conda.anaconda.org/esri/noarch
                          https://repo.anaconda.com/pkgs/main/win-64
                          https://repo.anaconda.com/pkgs/main/noarch
                          https://repo.anaconda.com/pkgs/r/win-64
                          https://repo.anaconda.com/pkgs/r/noarch
                          https://repo.anaconda.com/pkgs/msys2/win-64
                          https://repo.anaconda.com/pkgs/msys2/noarch
          package cache : C:\Users\dan_p\AppData\Local\ESRI\conda\pkgs
                          C:\arc_pro\bin\Python\pkgs
                          C:\Users\dan_p\.conda\pkgs
       envs directories : C:\arc_pro\bin\Python\envs
                          C:\Users\dan_p\AppData\Local\ESRI\conda\envs
                          C:\Users\dan_p\.conda\envs
               platform : win-64
             user-agent : conda/4.9.2 requests/2.27.1 CPython/3.9.12 Windows/10 Windows/10.0.22000
          administrator : False
             netrc file : None
           offline mode : False


(pro_3) C:\Users\dan_p\AppData\Local\ESRI\conda\envs\pro_3>

and

(pro_3) C:\Users\dan_p\AppData\Local\ESRI\conda\envs\pro_3>conda env list
# conda environments:
#
pro_3                 *  C:\Users\dan_p\AppData\Local\ESRI\conda\envs\pro_3
base                     C:\arc_pro\bin\Python
arcgispro-py3            C:\arc_pro\bin\Python\envs\arcgispro-py3


(pro_3) C:\Users\dan_p\AppData\Local\ESRI\conda\envs\pro_3>

of course there is

Anaconda Nucleus

and

Conda Cheatsheet: Your Guide to Basic Conda Commands (anaconda.cloud)

It takes a while but it is navigable eventually

 


... sort of retired...
DanPatterson
MVP Esteemed Contributor

PS

I create a desktop shortcut to run

C:\... ArcGISPro Install Folder\bin\Python\Scripts\proenv.bat

with  

Start In 

set to

C:\... ArcGISPro Install Folder\bin\Python\envs\arcgispro-py3

Also, some python IDE's can run conda from within.  Spyder, for example, has line magics that allow you to run conda from the editor


... sort of retired...
0 Kudos
BrianWilson7
Regular Contributor

I just put the conda.exe I use on my PATH environment variable so that it's always available to me in every shell or IDE. It's the second line here.

Capture.PNG

0 Kudos
JeffK
by MVP Regular Contributor
MVP Regular Contributor

There is a Python Command Prompt that is in the ArcGIS app folder you can use to skip the cd commands.

Starting the Python Command Prompt starts a conda command prompt in the currently active Pro environment.

If you want to change the active env to your clone, its a simple command: activate <your env>. 

If you want set the env to be the active env in Pro, use the command:  proswap <your env>.  The next time you open the Python Command Prompt, it would start in the env you set and Pro will be set.

ShawnCarson
New Contributor III

Thanks to BrianWilson DanPatterson and JeffK.

They each provided me the info and solved.  

ANSWER: There is only one conda.exe. It lives here: C:\Program Files\ArcGIS\Pro\bin\Python\Scripts

to use conda in your cloned environment, you fire up conda.exe and type this:

activate C:\Users\TheUser\AppData\Local\ESRI\conda\envs\arcgispro-py3-clone

Then when you type this: "conda info" you can confirm which environment you are in. (Thank you DanP)

If you fire up  conda.exe  without activating your clone, the "conda info" is pointing to your default environment  (C:\Program Files\ArcGIS\Pro\bin\Python\envs\arcgispro-py3)

Thanks guys. Would never have figure this out.