Python has a rich ecosystem of preexisting packages that can be leveraged in ArcGIS Pro. The Python community has designed methods to create projects in multiple versions of Python while simplifying the process of installing nearly all publicly available Python packages. These solutions are commonly referred to as package managers.
To simplify the use of Python packages in ArcGIS scripts, ArcGIS Pro includes a package management system named conda. Conda takes the guesswork and hassle out of installing and updating packages and their dependencies for use in your Python scripts.
To further extend the versatility and utility of Python packages, multiple installations of Python can coexist on a single workstation, independent of one another. This allows multiple versions of Python to be accessible simultaneously. Each of these installations is referred to as a Python environment.
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. In addition to its package management capabilities, conda also functions as an environment manager.
By default, ArcGIS Pro has a single conda environment, arcgispro-py3, that includes all Python libraries used by ArcGIS Pro as well as several others, such as scipy and pandas.
Work with Python environments
ArcGIS Pro includes a package manager that allows you to interact directly with conda without leaving ArcGIS Pro. To access Python when working in ArcGIS Pro, click the Project tab and click Python to access the Python Package Manager. To create, edit, or remove environments, click the Manage Environments button.
Starting with ArcGIS Pro 2.2, the default arcgispro-py3 environment is read-only and cannot be modified. Changes can be made by creating, or cloning, an environment in your user profile.
Create an environment
To create a clone of the default arcgispro-py3 environment, on the Manage Environments dialog box, click the Clone Default button . The new environment is a copy of the arcgispro-py3 environment, and only the default packages included with ArcGIS Pro will be installed.
You can also create a clone of any environment, including the arcgispro-py3 environment, by clicking the environment and then clicking the Clone button . This opens the Clone Environment dialog box, where you can set the environment's name and path.
Activate an environment
The active Python environment is used to run any Python functionality executed in the application, such as code executed in the Python window, script tools, and Python toolbox tools. To change the active environment on the Manage Environments dialog box, select the environment and click OK. After changing the active environment, you may need to restart ArcGIS Pro to reinitialize Python and use the new environment.
Remove an environment
To delete an environment, click the Remove button on the appropriate environment. The default arcgispro-py3 environment cannot be removed.
Add an environment
By default, only environments found in two well-known locations (%PROGRAMFILES%\ArcGIS\Pro\bin\Python\envs and %LocalAppData%\Esri\conda\envs) will be listed on the Manage Environments dialog box. To include an environment from another location, click the Add button .
Work with Python packages
One of the advantages of using conda is the availability and ease of installing many third-party Python packages into your current environment. You can use conda to install and manage any additional third-party dependencies to ensure that the package can be immediately used. Once the package is installed, you can use it in the Python window and in any script tools or Python toolboxes you may have.
View installed packages
To see the currently installed packages, click the Installed Packages button. All third-party Python packages installed with ArcGIS Pro and any additional libraries you already added will be displayed.
Update outdated packages
Over time, Python packages may become out of date. If there are updates that you want to include, click the Update Packages button to see available updates. You can update a single package by clicking the package and clicking the Install button, or you can choose to install all updates by clicking the Update All button. Some packages are pinned to a specific version and cannot be updated; these packages will not appear in the list even when updates are available. Since the default arcgispro-py3 environment is read-only, its packages cannot be updated. Create or clone an environment to update packages.
Install available packages
By clicking the Add Packages button, you can see the available Python packages that are compatible with your Python environment. By default, the latest version of each package is shown, but you can also access earlier versions by clicking the version number in the Version column. To install a Python package, click the package name in the Name column, change the version if necessary, and click the Install button. Since the default environment is read-only, it cannot be updated with new packages. Create or clone an environment to install packages.
Remove installed packages
You can uninstall any packages you add, but packages required by ArcGIS Pro are pinned and cannot be altered or removed. To uninstall a package, click the Uninstall button for the package. Since the default environment is read-only, its packages cannot be removed. Create or clone an environment to remove packages.
Access conda from Python
In the conda environment, you can open a Python session with the Python command and run Python scripts using the form Python yourscript.py. You can also access conda functionality using the conda command, such as listing the contents of the current environment (using conda list) and searching for and accessing additional third-party libraries.
For additional information about using and working with conda, see Introduction to conda.