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
)
- Windows 64-bit (
-
If your source (connected) environment is a different platform than your target platform:
-
Set the
CONDA
environment variable to your target (disconnected) platform, either_SUBDIR win-64
,linux-64
, orosx-64
. For example:- Bash:
export CONDA
_SUBDI R=win-64 - PowerShell:
$env
:CONDA _SUBDI R="linux-64" - cmd:
set CONDA
_SUBDI R=linux-64
- Bash:
-
-
Create an empty directory for downloads, for example:
- Windows:
mkdir C
:\ Users\me\ Downloads\arcgis _offline - macOS:
mkdir ~/
Downloads/arcgis _offline
- Windows:
-
Set the
CONDA
environment variable to your empty download directory from the previous step. For example:_PKGS _DIRS - Bash:
export CONDA
_PKGS _DIR S=~/ Downloads/arcgis _offline - PowerShell:
$env
:CONDA _PKGS _DIR S=" C :\ Users\me\ Downloads\arcgis _offline" - cmd:
set CONDA
_PKGS _DIR S= C :\ Users\me\ Downloads\arcgis _offline
- Bash:
-
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:
Conda
Exit Zero : Package caches prepared. Unlink Link Transaction 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
-
Configure Anaconda for offline use. See Conda Configuration for full details:
conda config --set offline True
-
Obtain the package cache directories in your disconnected environment
conda config --show pkgs
_dirs -
Copy the files from your connected environment to one of the cache directories specified in the previous step.
-
Create a new empty environment:
conda create -n <my
_env _name > -
Activate the environment:
conda activate <my
_env _name > -
Install python:
conda install python --offline --use-local
-
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:
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.
- proceed to Test your install with the Jupyter Notebook to verify the proper installation of the
map widget
.