Skip To Content

Python in ArcGIS Pro

Python is the primary language for automation in both ArcGIS 10.x and ArcGIS Pro, due in large part to its versatility and extensibility. It is partially due to these virtues that Python is also becoming one of the most widely used programming languages in general. Python has a rich ecosystem of preexisting 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 or trying to share code with others.


To leverage this versatility, the Python community has created methods to easily create projects in multiple versions of Python and simplifies the process of installing nearly all publicly available Python packages. Conda is the most popular and widely used Python package manager.

Integrating the functionality of conda into ArcGIS Pro will remove many hurdles faced when writing Python code. It will support installing open-source and third-party libraries that are associated with an individual project, rather than into the base Python installation. This will simplify the process of sharing complex Python tools that will work on multiple computers. Conda does this by providing environments that both isolate installations and solve dependencies.

Learn more about conda in ArcGIS Pro


If migrating Python code written against a version of ArcGIS Desktop (or ArcGIS Server or ArcGIS Engine), see Python migration for ArcGIS Pro. The primary differences are that ArcGIS Pro uses Python 3 and other ArcGIS products uses Python 2, and ArcPy itself has some differences in the tools it includes and the arcpy.mapping module is replaced in favor of the arcpy.mpmodule.

If migrating from an earlier version of ArcGIS Pro (1.0 through 1.2), ArcPy itself is unchanged (except for new functionality). From within ArcGIS Pro, Python will act and appear as it did in previous releases of ArcGIS Pro. The switch to conda will impact how you interact with Python (and ArcPy) outside of ArcGIS Pro.


In ArcGIS Pro 1.0 through 1.2, if you needed to use Python outside of ArcGIS Pro, you also had to install Python for ArcGIS Pro. With changes at 1.3, this is no longer required. To avoid confusion, uninstall Python for ArcGIS Pro.

Running Python

From a command prompt

To start Python from a command prompt, type the following:


All paths shown assume a per machine (all users) installation of ArcGIS Pro. If ArcGIS Pro has been installed for the current user, substitute %LOCALAPPDATA% for %PROGRAMFILES%.

To run a Python script from a command prompt (arguments can be added following the .py file), type the following:

"C:\Program Files\ArcGIS\Pro\bin\Python\Scripts\propy"

Start the ArcGIS Pro Python 3 conda environment:


From a batch file

To run a Python script from a .bat file, use call on propy:

@echo Run my Python script
call "%PROGRAMFILES%\ArcGIS\Pro\bin\Python\Scripts\propy"
@echo Finished

As a scheduled task

If running a Python script as a scheduled task, the program or script should be C:\PROGRA~1\ArcGIS\Pro\bin\Python\Scripts\propy and the arguments should include the full path to your Python script.

Using shortcuts

Python Command Prompt

Opens a command prompt window initialized with the current conda environment. To start an interactive Python session, type python. To run a Python script, type python followed by the path of a .pyfile.

Python Interactive Terminal

Opens a Python session with the current conda environment.

Python IDEs

Most modern Python Integrated Development Environments (IDE) can be used seamlessly with conda by configuring the version of Python that the IDE uses. The primary step involves directing the IDE to use the correct Python.exe within the ArcGIS Pro installation. To configure several common IDEs, see How to set up an IDE or the documentation for the particular IDE.

Python IDLE can be launched from a conda environment by typing idle.


In prior versions of ArcGIS Pro, Python was accessed outside of ArcGIS Pro through a separate installation of Python for ArcGIS Pro. Starting in ArcGIS Pro 1.3, Python for ArcGIS Pro is no longer required and should be uninstalled to avoid confusion.

If Python for ArcGIS Pro is still installed, and is used directly, it will be unable to find arcpy and will fail with the following exception:

Traceback (most recent call last):
  File "d:\temp\", line 1, in <module>
    import arcpy
ImportError: No module named 'arcpy'

ArcPy must be run from inside the conda environment, which ArcGIS Pro uses to manage the installation of Python. You can access this environment by launching Python from the links inside the ArcGIS > ArcGIS Pro start menu group or by running proenv in a terminal.

If a conda environment is opened in a command window without the necessary administration privileges, a message will be provided indicating the lack of permissions. Close the command window, reopen, and Run as administrator.

Authorizing Python to work offline

If you run Python scripts that use ArcGIS Pro functionality outside of the ArcGIS Pro application, such as a Python IDE, from a command prompt, or running scripts through scheduled tasks, one of the following conditions must be true.

  • Sign me in automatically is checked on when signing in to ArcGIS Pro.
  • ArcGIS Pro is currently open.
  • ArcGIS Pro has been authorized to work offline.

If one of the above conditions are not met, you will encounter a RuntimeError: NotInitialized exception when importing arcpy or arcgisscripting.

Learn more about licensing ArcGIS Pro

Temas relacionados