With the release of ArcGIS Pro 2.2, any modification to the Python environment used by ArcGIS Pro requires that the default environment be cloned, as that environment is read-only and cannot be modified. When cloning the default environment within the Python Package Manager inside of ArcGIS Pro you may experience problems. This blog covers those most common problems and suggests potential workarounds to those problems. Let’s dive in.
Most issues related to creating clones of the ArcGIS Pro Python environment are related to permissions. Behind the scenes, ArcGIS Pro uses Conda. Conda, a Python package management program, is widely used and is the most popular package manager. Often, the conda installation which is leveraged to manage your environments and packages does not have permissions to download modules from the conda package repository or it does not have permissions to install those modules into your user profile. If you launch ArcGIS Pro as an administrator and try again most times these issues are resolved. If your problems continue, please carry on reading.
If your cloning continues to fail within ArcGIS Pro’s Python package manager, no problem. We can leverage conda directly using the Python Command Prompt. This can be found in Start > ArcGIS > Python Command Prompt (Make sure to run this as administrator as well). To build a clone using conda directly, we use the command:
conda create --clone="C:\Program Files\ArcGIS\Pro\bin\Python\envs\arcgispro-py3" -p "C:\Your\Output\Directory"
This command matches very closely to what ArcGIS Pro uses when cloning from the Python Package Manager but often will either resolve the problem or will provide us with more detailed information as to why it failed. If it succeeds, ensure you’ve activated the environment by using the conda activate command:
conda activate "C:\Your\Output\Directory”
Then proceed to ArcGIS Pro Python Package Manager and set it as your default environment using the ‘Add’ button and browse to where you generated this new clone. Lastly, restart ArcGIS Pro and you’re all set! If the cloning failed, carry on reading.
Python Command Prompt showing a manual clone in progress, downloading modules
Sometimes, network security or firewalls are to blame for failed clones. The conda package repository can be blocked and your machine will be unable to access that repository. When this is true, the cloning will also fail; you may see errors like ‘HTTP 000 CONNECTION FAILED’. We can test to confirm if your machine can access the repository directly by leveraging CURL, a command line library which mimics network protocols. To do this, launch your windows command prompt by searching for ‘CMD’. Once launched, type the command:
curl -Iv https://conda.anaconda.org
A successful connection would complete an SSL/TLS handshake and provide session information, such as a cookie. An unsuccessful connection is more obvious and would say ‘Could not resolve host: conda.anaconda.org’ and would close the connection. If the connection is unsuccessful, you’ll need to have https://conda.anaconda.org allowed through your network, which may involve contacting your IT or helpdesk teams.
CURL command used in the Windows 10 Command Prompt with a successful request
Lastly, for advanced users, the ArcGIS Pro conda install comes with a configuration file (named .condarc) which can be used to leverage proxies or include additional configuration settings which conda can leverage. This file is found in C:\Program Files\ArcGIS\Pro\bin\Python. The configuration settings in the .condarc file may resolve issues related to network security or cloning. This includes options for disabling or enabling SSL verification, adding proxy servers and adding custom channels for accessing your own modules. Sometimes, as a last resort, we can implement some configuration settings in this file to allow us to successfully create clones of our conda environment. Often this will involve working with your IT or Helpdesk team as well.
Example of a .condarc file with custom configuration settings
These are the most common troubleshooting techniques you can leverage to resolve cloning issues in conda and ArcGIS Pro. If you’re still experiencing issues after going through some or all these suggestions, please contact your distributor’s technical support team for further assistance. If it has resolved your issues, happy coding!
About the AuthorMore Content by Tom Thompson