ArcGIS Pro provides access to a large collection of Python packages. To support Python packages, ArcGIS Pro includes a package management system named conda. ArcGIS Pro integrates conda with the Package Manager page. You can also access conda from a command prompt.
To further extend the versatility and utility of Python packages, multiple Python environments can coexist on a single workstation, independent of one another. Each Python environment can have its own set of packages, allowing you to switch between sets of Python functionality without uninstalling and reinstalling packages each time.
By default, ArcGIS Pro has a single conda environment, arcgispro-py3, which includes all Python libraries used by ArcGIS Pro as well as several others, such as scipy and pandas.
- Clone an environment
- Activate an environment
- Add an environment
- Delete an environment
- Upgrade an environment
- Repair an environment
- Add or remove a package
- Update a package
Caution:
Modifying the ArcGIS Pro default Python environment (arcgispro-py3) is not advisable and may result in unintended consequences. It is recommended that you only modify a cloned environment.
License:
Users installing packages using the -c esri channel for use in Esri products such as ArcGIS Pro or ArcGIS Enterprise and deploying applications for use in Esri environments are covered by all current licensing. If you are deploying applications into external environments or are mirroring Anaconda repositories or components, you need an additional Anaconda license to cover use of the Anaconda base packages. For detailed information, see Esri's licensing agreement with Anaconda.
Access conda from a command prompt
From a command prompt, you can access conda functionality using the conda command. The active Python environment is indicated in parentheses at the prompt before the current directory. Use the Python Command Prompt shortcut to open a command prompt window initialized with the active conda environment for ArcGIS Pro.
The following are examples of conda commands:
List packages in the active environment.
conda list
List all conda environments.
conda env list
Clone the default arcgispro-py3 environment to create an environment named my_env.
conda create --clone arcgispro-py3 --name my_env --pinned
To get help for a command, type the --help or -h flag after the conda command.
The --pinned flag, introduced by Esri, carries over the pinned file from the source environment to the cloned environment. Use this flag to ensure that the integrity of the cloned environment is maintained when upgrading or installing packages.
To activate an environment for your current command line session, use the activate command.
activate my_env
For more information about using and working with conda, see Introduction to conda.
ArcGIS Pro also supports additional commands introduced by Esri, such as proswap and propy.
To activate an environment for your current command line session and set the environment as the new default for future ArcGIS Pro and command line sessions, use the proswap command.
proswap my_env
You can open a Python session in the active environment with the propy command and run Python scripts using the following format:
propy yourscript.py
The ArcGIS Pro environment includes conda as a stand-alone executable rather than the typical full Python distribution, which makes the ArcGIS Pro installation smaller and faster. Every time you run a conda-based command such as proswap, the conda executable will extract the files it needs to load the static build of Python into your temporary directory, identified by %TMPDIR%, %TEMP%, or %TMP% in your system environmental variables. After the command is complete, the temporary files will be removed.
Network access for creating environments and installing packages
Creating conda environments and installing packages requires an internet connection. If you're trying to clone an environment from behind a firewall, the following sites may need to be put on an allow list in your network's firewall settings:
- https://conda.anaconda.org
- https://repo.anaconda.com
pip
Like conda, pip is a package management system. pip is a command-line tool for installing Python packages from the Python Package Index (PyPI), and is part of the standard Python distribution.
Although the functionality of pip and conda overlap in some respects, they are fundamentally different systems. While conda and pip serve difference purposes, they can be used together.
Conda installs various packages as binaries written in any language. pip is part of the standard Python distribution and only installs Python packages. pip installations may have additional compiler and library requirements to be successful.
pip can install hundreds of thousands of packages from PyPi, whereas conda includes a smaller subset but includes the most popular packages.
Tip:
When using conda and pip together, install the conda packages before installing the pip packages. If a package is available from both systems, use conda to install the package.
To install a package with pip, use the pip install command.