Python has a rich ecosystem of pre-existing Python packages that can be leveraged within ArcGIS, but managing which packages are installed on a system can be a complex and time consuming task, especially when working on multiple projects at once or trying to share code with others.
To leverage this versatility, the Python community has designed methods to create projects in multiple versions of Python while trivializing the process of installing nearly all publicly available Python packages. The most popular and widely used Python package manager is conda. Integrating conda with ArcGIS Pro allows you to utilize the functionality in Python's ecosystem of open-source and third-party packages from within ArcGIS Pro. It allows you to quickly install, run, and update packages and their dependencies for use in your Python scripts.
Python encourages the sharing of user-developed functionality through packages that are hosted at a variety of locations on the web. While ArcGIS users have always been able to utilize these packages in their scripts, the workflow of finding, installing, and using these packages has traditionally been time consuming and subject to compatibility issues.
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. There are several shortcuts for accessing this environment, including the Python Command Prompt shortcut, which opens a command prompt initialized with the arcgispro-py3 environment.
Adding Python packages within ArcGIS Pro
To access Python when working in ArcGIS Pro, click the Project tab and click Python to access the Python Package Manager.
To see a list of currently installed packages click on the Installed Packages button. This includes all 3rd party Python packages installed with ArcGIS Pro and any additional libraries you've already added.
You are free to uninstall any packages you've already added, but packages used by ArcGIS Pro are blocked.
Over time, Python packages may become out of date. If there are package updates you would like to include, click on the Update Packages button. From here, any package that has available updates will be presented. You can update a single package by clicking on the package, and clicking the Install button, or you can choose to install all updates by clicking on the Update All button. Note, some packages will be pinned by ArcGIS Pro and cannot be updated; these particular packages will not show in the list even when updates are available.
One of the advantages of using Conda, is the availability and ease of installing many 3rd party Python packages into your current environment. Conda will install and manage any additional 3rd party libraries to ensure that the package can be immediately used. Once the package is installed you can use in freely in the Python window, and use it with any script tools or Python toolboxes you may have.
By clicking on the Add Packages button, you can see all available Python packages that are compatible with your Python environment. By default the latest current version of each package is shown, but you can also access earlier versions by clicking on the version number under the Version column. To install a particular Python package, click it's name under the Name column, change the version if needed, and click the Install button.
If you have cloned your ArcGIS Pro Python environment arcgispro-py3, you can change the environment by clicking on the pull-down under Project Environment and change your environment. Having different environments could be of use, for example, if you need to use incompatible Python packages; you could install the different packages in different environments and switch the environment as needed.
Accessing conda from Python
Within 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 search for and access additional third-party libraries.