Select to view content in your preferred language

How to clone the ArcGIS Pro 3 Python environment?

1725
7
Jump to solution
02-27-2024 06:26 AM
Labels (1)
JörgEbert
Occasional Contributor

ArcGIS Pro is installed in an extremely hostile government environment with extreme security measures and "isolated from the internet".

So the following sites cannot be accessed

Adding the sites to the allowlist in the network's firewall settings was rejected by the administrators.

Is there still a way to get a clone of the arcgispro-py3 environment?

0 Kudos
1 Solution

Accepted Solutions
AlexanderDanielPratama
Esri Contributor

I think that, first you must work in your device that is connected to the Internet first (clone step). Then, install some library there that you need to comply for project requirement. After that copy that environment folder to a flash disk or external drive. Final step is to copy the env folder to your client device. Lastly, change the Arcgis pro environment to the environment folder.

Notes, you must have a similar version of ArcGIS Pro between your connected device and your client. 

Hope it helps you

Cheers

View solution in original post

7 Replies
AlexanderDanielPratama
Esri Contributor

I think that, first you must work in your device that is connected to the Internet first (clone step). Then, install some library there that you need to comply for project requirement. After that copy that environment folder to a flash disk or external drive. Final step is to copy the env folder to your client device. Lastly, change the Arcgis pro environment to the environment folder.

Notes, you must have a similar version of ArcGIS Pro between your connected device and your client. 

Hope it helps you

Cheers

JörgEbert
Occasional Contributor

Thanks!

It seems this is a quick and practical solution in this particular case.
Create the Python environment (including the additional packages) on an external computer, i.e. on a computer with "unrestricted" Internet access and the same ArcGIS Pro installation/version, and transfer it to the target computer.
I will try with Conda Pack.


But it is completely incomprehensible to me why there is no option to create a clone, i.e. an "unchanged" copy of the existing Python environment without Internet access.

0 Kudos
Brian_Wilson
Honored Contributor

Conda is already installed with ArcGIS Pro, you can use it. On my machine right now the Esri version of Conda is super slow, I will ignore that for the moment.

Find the install location. On my computer, (running Windows 11 with ArcGIS Pro 3.2), I use environment variables. I set CONDA_PATH to C:\Program Files\ArcGIS\Pro\Python\Scripts then add %CONDA_PATH% to the PATH.

It wanted me to do this to set up the shell: conda init powershell

Then open a new Powershell and try running "conda info" and see what it says.

On my machine the output looks like this

PS C:\Users\bwilson> conda info

     active environment : arcgis_tools
    active env location : C:\Users\bwilson\AppData\Local\ESRI\conda\envs\arcgis_tools
       user config file : C:\Users\bwilson\.condarc
 populated config files : C:\Program Files\ArcGIS\Pro\bin\Python\.condarc
                          C:\Users\bwilson\.condarc
          conda version : 4.14.0
    conda-build version : not installed
         python version : 3.9.18.final.0
       virtual packages : __cuda=12.0=0
                          __win=0=0
                          __archspec=1=x86_64
       base environment : C:\Program Files\ArcGIS\Pro\bin\Python  (read only)
      conda av data dir : C:\Program Files\ArcGIS\Pro\bin\Python\etc\conda
  conda av metadata url : None
           channel URLs : https://conda.anaconda.org/conda-forge/win-64
                          https://conda.anaconda.org/conda-forge/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
                          https://conda.anaconda.org/esri/win-64
                          https://conda.anaconda.org/esri/noarch
          package cache : C:\Users\bwilson\AppData\Local\ESRI\conda\pkgs
                          C:\Program Files\ArcGIS\Pro\bin\Python\pkgs
                          C:\Users\bwilson\.conda\pkgs
       envs directories : C:\Program Files\ArcGIS\Pro\bin\Python\envs
                          C:\Users\bwilson\AppData\Local\ESRI\conda\envs
                          C:\Users\bwilson\.conda\envs
               platform : win-64
             user-agent : conda/4.14.0 requests/2.31.0 CPython/3.9.18 Windows/10 Windows/10.0.22631
          administrator : False
             netrc file : None
           offline mode : False

 

Note that I have it reading a .condarc file too, I believe this is mostly for Miniconda but my file has this in it.

channels:
  - conda-forge
  - defaults
envs_dirs:
  - C:/Program Files/ArcGIS/Pro/bin/Python/envs
  - C:/Users/bwilson/AppData/Local/ESRI/conda/envs

 

At this point I can run any Conda commands, so I can list out what environments exist, "conda env list" and I can clone one and activate it and use it.

(base) PS C:\Users\bwilson> conda create --name=myclone --clone arcgispro-py3
(base) PS C:\Users\bwilson> conda activate myclone
(myclone) PS C:\Users\bwilson> python
>>> import arcpy
>>> arcpy.__version__
'3.2'
>>>

 

I have worked in constrained environments before, I used to keep copious notes on what tools I could use. They did let me plug in a thumb drive (really not a good idea for security!) and I kept lots of "portable" versions of tools on there.

Hope this helps

Brian

 

Brian_Wilson
Honored Contributor

Further research on the slowness of Esri conda, it looks like it's the version (not so very old = 2022) they are using, it's been fixed. Sorry you will not be able to use a current version in your environment.

0 Kudos
DanPatterson
MVP Esteemed Contributor

There is the option for offline installation of packages, but you would probably have to download the required package elsewhere.

Installing with conda — conda 24.1.3.dev36 documentation

BUT if what you need has a lot of dependencies that aren't already installed, it won't work.

In that situation, getting IT to sit at your machine and do the installs for you might be your only course of action.


... sort of retired...
0 Kudos
JörgEbert
Occasional Contributor
Thanks for the tip!
Before packages are installed, a clone of the Python environment installed with ArcGIS Pro has to be created and that doesn't work with the extremely limited internet access.
 
It seems the best solution in this specific case is that of AlexanderDaniel_Pratama 
Create a Python environment (including the additional packages) on an external computer with "unrestricted" Internet access and the same ArcGIS Pro installation/version and transfer it to the target computer.
0 Kudos
Brian_Wilson
Honored Contributor

It's nice with Conda that you just need to copy the entire folder and conda will still find it and work normally. (It won't freak out when it sees a folder it did not create)

0 Kudos