Use the ArcGIS API for python in a disconnected enivronment.
Steps
1. While in a connected environment, download the appropriate software you'll need:
-
the latest version of the full Anaconda for Python 3x for your OS
-
the appropriate version of the API for Python package for your OS from Esri's channel on anaconda.org
-
The file names appear in this pattern:
platform/arcgis-x.x.x-py
.Z Zyyyyyyy-y.tar.bz2 Find your file by substituting:
- your operating system platform for
platform
- the API release number for
x.x.x
- your Python version for
ZZ
. - The
yyyyyyy
refers to a hash number created for each conda package uploaded to the channel_y
For instance, if you are installing the Python API 1.6.2 on Windows 64-bit for Python 3.7, download the
win-64/arcgis-1.6.2-py37h42bb103
package._633.tar.bz2 - your operating system platform for
2. Configure Anaconda for use in the disconnected enviroment:
-
Install Anaconda from your install location. 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
-
Create a new environment, including
python
andsix
packages:conda create -n <my
_env _name > python six -
Activate the environment:
conda activate <my
_env _name > -
Install the API for Python package, having downloaded the
bz2
file that matches the appropriate platform, Python version and API release you are using:conda install /path
_to _package _download _folder/platform/arcgis-x.x.x-py Z Zyyyyyyy-y.tar.bz2 The
conda
utility will pull all thearcgis
package dependencies from the installed set of Anaconda libraries instead of searching the internet.
-
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. Follow these additional steps to use the map widget
in a disconnected environment:
-
install the
jupyterlab
package for visualizing with maps in either Jupyter Notebook or Jupyter Lab:conda install jupyterlab
-
enable the
map widget
by running these 2 commands in succession:jupyter nbextension enable --py --sys-prefix widgetsnbextension
jupyter nbextension enable --py --sys-prefix arcgis
-
proceed to Test your install with the Jupyter Notebook to verify the proper installation of the
map widget
.