Offline

Use the ArcGIS API for Python in a disconnected environment.

Steps

1. Download Software

While in a connected environment, you'll need to download the appropriate software you'll need:

  • the latest version of either Anaconda or Miniconda for Python 3.x for your OS:

  • the appropriate version of the API for Python package and its dependencies for your target platform. Supported target platforms are currently:

    • Windows 64-bit (win-64)
    • Linux 64-bit (linux-64)
    • macOS Intel (osx-64)
  • If your source (connected) environment is a different platform than your target platform:

    • Set the CONDA_SUBDIR environment variable to your target (disconnected) platform, either win-64, linux-64, or osx-64. For example:

      • Bash: export CONDA_SUBDIR=win-64
      • PowerShell: $env:CONDA_SUBDIR="linux-64"
      • cmd: set CONDA_SUBDIR=linux-64
  • Create an empty directory for downloads, for example:

    • Windows: mkdir C:\Users\me\Downloads\arcgis_offline
    • macOS: mkdir ~/Downloads/arcgis_offline
  • Set the CONDA_PKGS_DIRS environment variable to your empty download directory from the previous step. For example:

    • Bash: export CONDA_PKGS_DIRS=~/Downloads/arcgis_offline
    • PowerShell: $env:CONDA_PKGS_DIRS="C:\Users\me\Downloads\arcgis_offline"
    • cmd: set CONDA_PKGS_DIRS=C:\Users\me\Downloads\arcgis_offline
  • To download the ArcGIS API for Python and its dependencies, run:

    conda create --name arcgis_offline --override-channels --download-only -c esri -c defaults arcgis

    • You may see a message:

      CondaExitZero: Package caches prepared. UnlinkLinkTransaction canceled with --download-only option

      This indicates successful download.

  • Copy all files (you may skip the subdirectories) from your download directory to your disconnected environment, see below.

2. Configure Anaconda:

Install Anaconda from your location in the disconnected environment. Once installed, you can use the Anaconda Navigator GUI application or the Anaconda Prompt command line console to operate the software. The procedure below outlines using the Anaconda Prompt and the conda utility on Windows:

First, open Anaconda Prompt. All subsequent commands are run inside this prompt:

Start > Anaconda3 (64-bit) > Anaconda Prompt

  1. Configure Anaconda for offline use. See Conda Configuration for full details:

    conda config --set offline True

  2. Obtain the package cache directories in your disconnected environment

    conda config --show pkgs_dirs

  3. Copy the files from your connected environment to one of the cache directories specified in the previous step.

  4. Create a new empty environment:

    conda create -n <my_env_name>

  5. Activate the environment:

    conda activate <my_env_name>

  6. Install python:

    conda install python --offline --use-local

  7. Install ArcGIS API for Python:

    conda install arcgis --offline --use-local

3. Verify the install:

At this point, all modules, classes and functions are available in the API for use in your Python scripts or Jupyter notebooks except the Map Widget. You can verify your install by making a connection to your GIS and printing properties:

Use dark colors for code blocksCopy
1
2
  gis = GIS("url_to_your_gis", "username", "password")
  print(f"Connected to {gis.properties.portalHostname} as {gis.users.me.username}")

The map widget is only supported within Jupyter applications.

Your browser is no longer supported. Please upgrade your browser for the best experience. See our browser deprecation post for more details.