Skip to main content
v2026.11,986 entries · CC-BY 4.0

ArcPy: What It Is and How to Script Reproducible ArcGIS Geoprocessing

ArcPy is a Python site package for ArcGIS geoprocessing: how to import it, run a tool, read the output and script spatial work reproducibly.

Written and maintained by CASRAI Editorial Board

Published

On this page

ArcPy is a Python site package from Esri for geographic data analysis, data conversion, data management and map automation. It is not a programming language of its own: you write Python, and import arcpy gives that Python code access to ArcGIS geoprocessing tools. This guide shows how researchers use ArcPy to turn a sequence of mouse clicks into a script that can be rerun, reviewed and archived.

What ArcPy is used for in research

Esri’s documentation describes ArcPy as a package for “geographic data analysis, data conversion, data management, and map automation” with Python. It provides code completion (type a keyword and a dot to see properties and methods) and reference documentation for its functions, modules and classes. Applications built with ArcPy can also use other Python modules, so a spatial step can sit inside a larger analysis script (Esri: What is ArcPy?).

For a research team the practical value is repeatability. A tool run from the ArcGIS Pro interface leaves no record of the exact parameters unless someone writes them down. The same tool called from a script is a line of text that names every input, output and setting. That line can be kept in version control, checked in a code review, and rerun on a new data release. This is the core of computational reproducibility, and it is the reason a methods section can say which tool and which parameters produced a map or table. See also reproducible research practices and the geovisualization guide for the mapping side of spatial work.

Is ArcPy a Python library?

Yes. Esri calls ArcPy a Python site package, which means it is a library installed into a Python environment and loaded with import arcpy. Outside the application it needs a valid sign-in to run (see the troubleshooting section below).

Do not confuse it with the CRAN package of the same name. The CRAN “arcpy” package (version 0.4-0, published 2024-01-22) is a third-party R package titled “Interface to ‘ArcGIS’ ‘Python’ Modules”. It sets up a Conda environment so that R can call the ArcGIS Python modules, and it lists ArcGIS Pro 3.0 or later and Conda as system requirements. It wraps ArcPy; it is not the ArcPy package itself (CRAN: arcpy).

What coding language does ArcGIS use?

For scripting and automation with ArcPy the language is Python. Esri’s installation page states that ArcGIS Pro uses Python 3 and includes many third-party Python modules by default (Esri: Python in ArcGIS Pro). Python is the language this guide covers; the interface itself needs no code.

Is ArcGIS outdated?

The current Esri documentation describes ArcGIS Pro as a Python 3 environment with an actively documented ArcPy. One concrete change that matters for old scripts: the older arcpy.mapping module has been replaced by arcpy.mp in ArcGIS Pro, so scripts written for earlier desktop software may need to be migrated rather than run unchanged. Whether the software suits a project is a separate question; the free options below are the alternative when a team cannot depend on a licensed product.

How to install or access ArcPy

ArcPy is installed with ArcGIS Pro, and the Python environment it uses is managed with conda. Use only Esri’s own installation and Python-environment documentation for setup. The facts below come from that documentation.

  • ArcGIS Pro uses Python 3 and ships with many third-party modules already installed.
  • Conda is integrated through the Python Package Manager page in the application. Libraries you add are installed per environment, not into the base installation.
  • The Python Command Prompt shortcut opens a prompt initialised with the current conda environment. A Python Interactive Terminal shortcut is also provided.
  • The scripts propy and proenv in the Scripts folder run a script or activate an environment. Their location depends on whether the software was installed per machine (under the Program Files path) or per user (under the local application data path).

How to run a geoprocessing tool with ArcPy step by step

The steps below use the documented pattern: import the package, set a workspace, call a tool, read the messages.

  1. Open the Python Command Prompt shortcut so that the active conda environment is the one that contains ArcPy.
  2. Type python to start an interactive session, or run a saved script with python pathscript.py.
  3. Import the package with import arcpy. This loads all geoprocessing tools in the standard toolboxes.
  4. Set the workspace with arcpy.env.workspace = "C:/Data/Tongass". Environment settings live in arcpy.env.
  5. Call a tool as arcpy.toolbox.Tool. Esri’s example clips a feature class: arcpy.analysis.Clip("standb4", "clipcov", "standby_clip", 1.25).
  6. Print the messages from the run with print(arcpy.GetMessages()).

The documentation recommends keyword arguments for optional parameters, for example arcpy.management.AddField("schools", "school_id", "LONG", field_is_nullable="NON_NULLABLE"). Optional arguments can also be skipped with an empty string, "#" or None, and parameters may be pathlib.Path objects. Keyword arguments make a script self-explanatory when a reviewer reads it months later (Esri: Importing ArcPy; Esri: Using tools in Python).

Two further habits from the same documentation help a project survive a change of machine. Tools can be called either from toolbox modules, such as arcpy.management.GetCount(in_features), or as functions on arcpy, such as arcpy.GetCount_management(in_features); Esri treats both as valid, so pick one style and use it throughout a project. Setting arcpy.env.returnPathlib = True makes tools and functions return pathlib.Path objects, which keeps file-path handling consistent in a script that also uses other Python modules.

The data table below lists the access patterns Esri documents for calling tools.

How to read the output

Every tool call returns a Result object, for example result = arcpy.management.CopyFeatures("roads", "urban_roads"). You can read values from it by integer index, by parameter name or with getOutput. Values come back as strings, so convert them with int() or float() before computing with them.

arcpy.GetMessages() returns the messages as a single newline-separated string, and it reports only on the most recent tool. Save the text straight after each call if you need a log; a Result object, by contrast, keeps its information after other tools run. The optional severity argument filters what is returned:

Severity argument Messages returned
0 (default) Informative messages, warnings and errors
1 Warnings only
2 Errors only

Esri’s own example runs arcpy.management.GetCount(fc) and then prints arcpy.GetMessages() (Esri: GetMessages).

A reproducibility checklist for an ArcPy script

  • Record the conda environment the script ran in, since ArcPy must run inside one and libraries are installed per environment.
  • Set arcpy.env.workspace explicitly rather than relying on a default.
  • Use keyword arguments for optional tool parameters.
  • Write the output of arcpy.GetMessages() to a log file after each tool.
  • Note that a script run outside the application needs a valid sign-in, so record how the team authorises it. Pair this with the practices on computational environment.

Troubleshooting ArcPy

The import fails outside the ArcGIS Python environment

Esri’s documentation states that ArcPy must run inside a conda environment. Use the Python Command Prompt shortcut or activate the right environment with proenv.

The script runs inside ArcGIS Pro but not on its own

Scripts that run outside the application need a valid sign-in. The documentation gives examples such as having ArcGIS Pro open and signed in, or offline authorisation.

Old code that uses arcpy.mapping

Replace it with arcpy.mp, which is the module used in ArcGIS Pro.

Spatial Analyst or Image Analyst tools are not found on arcpy

Those tools live in the arcpy.sa and arcpy.ia modules, not directly on arcpy.

Unwanted modules load with the import

The modules datetime, math, numpy, sys and time load automatically with import arcpy. In a standalone script, set the ARCPY_NO_IMPORTS environment variable (any value) before the import to stop this.

Free alternatives to ArcPy

Two open Python routes cover much of the same ground for researchers who cannot or prefer not to depend on ArcGIS. Neither is a drop-in replacement: tool names and parameters differ, so a script must be rewritten, not just re-imported.

Tool What it is How you run it
GeoPandas An open-source (BSD-3-Clause) project that extends pandas with GeoSeries and GeoDataFrame types and works with Shapely geometries Import it in any Python environment and work with geographic data like a pandas table
PyQGIS The Python API for QGIS Inside QGIS through Plugins › Python Console, where from qgis.core import * runs automatically; in standalone scripts through QgsApplication(False), initQgis() and exitQgis()

For PyQGIS standalone scripts, do not name your script qgis.py, because it will shadow the package. Whichever tool you choose, the reproducibility checklist above applies unchanged: pin the environment, make settings explicit and keep the script with the data. See also the code review for research software entry.

Frequently asked questions

What coding language does ArcGIS use?

ArcPy scripting uses Python. ArcGIS Pro uses Python 3 and includes many third-party modules by default.

Is ArcGIS outdated?

Esri’s current documentation covers ArcPy on Python 3 in ArcGIS Pro. Older code written for arcpy.mapping must be moved to arcpy.mp.

Is ArcGIS difficult to learn?

The interface needs no code. ArcPy adds a scripting layer: if you already know basic Python, the documented pattern is to import arcpy, set arcpy.env.workspace and call tools as arcpy.toolbox.Tool. Esri also provides code completion to help you find tool names and parameters.

Is ArcPy a Python library?

Yes, it is a Python site package loaded with import arcpy. A different, third-party R package on CRAN also uses the name arcpy and wraps it.

Sources

Data: ArcPy tool-access patterns documented by Esri

Compares the four ways Esri's ArcGIS Pro documentation shows for calling geoprocessing tools from Python with ArcPy, with the documented example for each. Compiled from Esri ArcPy documentation pages read on 2026-12-03.

Period covered: 2026.

ArcPy tool-access patterns documented by Esri
Access patternDocumented exampleWhere it applies
Toolbox modulearcpy.management.GetCount(in_features)Standard toolboxes, called as arcpy..
Function with toolbox aliasarcpy.GetCount_management(in_features)Same tools, called as functions on arcpy
Spatial Analyst modulearcpy.saSpatial Analyst tools, not available directly on arcpy
Image Analyst modulearcpy.iaImage Analyst tools, not available directly on arcpy

Sources

Compiled by CASRAI from the sources above. Free to reuse under CC BY 4.0 with attribution.

Follow CASRAI

Research-administration guidance, standards updates and independent tool reviews.

Ask CASRAI · full access

Ask about ArcPy: What It Is and How to Script Reproducible ArcGIS Geoprocessing

Full access: large monthly usage, up to 10 source passages behind each answer, and MCP and API access for Claude Code, Codex and other CLIs. Cancel any time.

An AI assistant for research: funder rules, compliance, methods and publishing. It links the sources behind its answers and labels answers that come from a web search.

Answers draw on CASRAI's guides and dictionary plus the federal and funder documents we index: Federal Register, Grants.gov, Regulations.gov and UKRI.

Works on this site and inside Claude, Cursor and the AI tools you already use.

Everything CASRAI publishes — this page, the dictionary, the guides and the news — stays open to read, with no account and no card.

Referenced across the research world

University of Cambridge logoColumbia University logoCrossref logoUniversity of Edinburgh logoHarvard University logoUniversity of Oxford logoPrinceton University logoStanford School of Medicine logoUniversity College London logoORCID logoUniversity of Cambridge logoColumbia University logoCrossref logoUniversity of Edinburgh logoHarvard University logoUniversity of Oxford logoPrinceton University logoStanford School of Medicine logoUniversity College London logoORCID logo
  • University of Cambridge logo
  • Columbia University logo
  • Crossref logo
  • University of Edinburgh logo
  • Harvard University logo
  • University of Oxford logo
  • Princeton University logo
  • Stanford School of Medicine logo
  • University College London logo
  • ORCID logo

View CASRAI adoption →