Create a Conda environment with the "arcpy" module.

install_arcpy(
  method = "conda",
  conda = "auto",
  version = NULL,
  envname = "r-arcpy",
  extra_packages = NULL,
  restart_session = TRUE,
  python_version = NULL,
  channel = "esri",
  forge = TRUE,
  ...,
  new_env = identical(envname, "r-arcpy")
)

Arguments

method

Installation method. By default, "auto" automatically finds a method that will work in the local environment. Change the default to force a specific installation method. Note that the "virtualenv" method is not available on Windows.

conda

The path to a conda executable. Use "auto" to allow reticulate to automatically find an appropriate conda binary. See Finding Conda and conda_binary() for more details.

version

Arcpy version to install. Note that the requested arcpy version must match your ArcGIS Pro version.

envname

The name, or full path, of the environment in which Python packages are to be installed. When NULL (the default), the active environment as set by the RETICULATE_PYTHON_ENV variable will be used; if that is unset, then the r-reticulate environment will be used.

extra_packages

Additional Python packages to install along with arcpy.

restart_session

Restart R session after installing (note this will only occur within RStudio).

python_version

Pass a string like "3.9" to request that conda install a specific Python version. Note that the Python version must be compatible with the requested arcpy version. If NULL, the latest compatible Python version will be used.

channel

An optional character vector of conda channels to include. When specified, the forge argument is ignored. If you need to specify multiple channels, including the conda forge, you can use c("conda-forge", <other channels>).

forge

Boolean; include the conda-forge repository?

...

other arguments passed to reticulate::conda_install().

new_env

If TRUE, any existing Python conda environment specified by envname is deleted first.

Value

(Invisible) TRUE if the Conda environment was created successfully.

Details

The Conda environment must be configured to match the ArcGIS Pro version currently installed. If ArcGIS Pro is updated, the Conda environment must be recreated.