Package Manager

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.

Vorsicht:

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.

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

To get help for a command, type the help or -h flag after the conda command.

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.

In addition, ArcGIS Pro supports additional Esri-based commands 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

Verwandte Themen