How To: Set up a local Conda channel for installing the ArcGIS Python API


The ArcGIS Python API is distributed via Conda - a popular package and environment management system for Python developers. The recommended way to install this API is outlined in the ArcGIS Python API Guide. For customers who want to install the API on non-networked computers or on workstations that are in an isolated network, the install instructions are provided in the Offline install section of the guide.

For advanced users who want to use the API from Miniconda (say, from ArcGIS Pro’s Python command prompt, which is powered by Miniconda) in disconnected environments, the recommended path is to create a local Conda channel in their premises and to install the API from that channel. The local channel would include a finite set of dependencies the API requires. Users may opt to download and host any number of additional Python packages in that channel.

This article describes the steps to create an offline Conda channel for the ArcGIS Python API. Please note that it is necessary to have a computer with an internet connection, Anaconda installed, and a Python 3.5 shell with the requests package installed.


Accompanying this knowledge base article are two files, arcgis_v1_dependencies (a text file listing the dependencies for the ArcGIS Python API) and download_dependencies, a Python script for downloading dependencies from the anaconda channel. Download these Supporting files before beginning the steps below.

  • arcgis_v1_dependencies.txt
  • download_dependencies.py

Setting up an environment to run the download Python script

Install Anaconda. Run the following commands in your terminal on the root environment to install the required conda-build and requests packages:

$ conda install conda-build
$ conda install requests

The new environment is now active and ready.

Downloading dependencies

Download the accompanying Python script and text file to the same location. Then, run the attached download_dependencies.py script as shown below:

$ python download_dependencies.py

The script downloads all the dependencies from anaconda.org online channel and stores it locally. Running the script creates and output similar to the following:

Using environment list file: .\ arcgis_v1_dependencies.txt
Getting  _nb_ext_conf-0.3.0-py35_0.tar.bz2
     Downloaded win-64\_nb_ext_conf-0.3.0-py35_0.tar.bz2
     Downloaded win-32\_nb_ext_conf-0.3.0-py35_0.tar.bz2
     Downloaded linux-64\_nb_ext_conf-0.3.0-py35_0.tar.bz2
     Downloaded linux-32\_nb_ext_conf-0.3.0-py35_0.tar.bz2
     Error with download: osx-32 : 
     Downloaded osx-64\_nb_ext_conf-0.3.0-py35_0.tar.bz2
Getting  anaconda-client-1.5.5-py35_0.tar.bz2
     Downloaded win-64\anaconda-client-1.5.5-py35_0.tar.bz2
     Downloaded win-32\anaconda-client-1.5.5-py35_0.tar.bz2
     Downloaded linux-64\anaconda-client-1.5.5-py35_0.tar.bz2
     Downloaded linux-32\anaconda-client-1.5.5-py35_0.tar.bz2
     Error with download: osx-32 : 
     Downloaded osx-64\anaconda-client-1.5.5-py35_0.tar.bz2

As it downloads, it creates folders with the following structure:


Indexing the local Conda channel

Once the script finishes, Conda must index this location. Conda builds a manifest file, repodata.json, in each of these folders outlining the packages present. This helps the Conda on your users' computers to treat this location as a local channel and search for and install packages from this location instead of the internet.

Build the index by typing the following commands:

$ conda index \\path\to\channel\win-64
$ conda index \\path\to\channel\win-32
$ conda index \\path\to\channel\linux-64
$ conda index \\path\to\channel\linux-32
$ conda index \\path\to\channel\osx-64
$ conda index \\path\to\channel\osx-32
$ conda index \\path\to\channel\noarch

Running the commands reports an output similar to the following:

$ conda index \\path\to\channel\win-64
  updating index in: \\path\to\channel\win-64
  updating: pywin32-220-py35_1.tar.bz2
  updating: nb_conda_kernels-2.0.0-py35_0.tar.bz2
  updating: requests-2.12.1-py35_0.tar.bz2
  updating: pyzmq-16.0.2-py35_0.tar.bz2
  updating: _nb_ext_conf-0.3.0-py35_0.tar.bz2
  updating: ipywidgets-5.2.2-py35_0.tar.bz2
  updating: decorator-4.0.10-py35_0.tar.bz2

Once this step is finished, transport the root folder into a networked location or a web server, or use it locally as your local Conda channel.

Installing from the local Conda channel

Install Anaconda or Miniconda on the non-networked computer. Then, search for packages on the local channel to ensure the channel works:

$ conda search --channel file://path/to/channel --override-channels

For example, on a Windows computer, this would look like:

$ conda search --channel D:/code/arcgis_offline_downloads/channel --override-channels

The command returns a result similar to the following:

$ conda search --channel file://offline/arcgis_channel/channel --override-channels
Fetching package metadata .....
_nb_ext_conf                 0.3.0                    py35_0  file://offline/arcgis_channel/channel
anaconda-client              1.5.5                    py35_0  file://offline/arcgis_channel/channel
arcgis                       0.9                      py35_1  file://offline/arcgis_channel/channel
clyent                       1.2.2                    py35_0  file://offline/arcgis_channel/channel
colorama                     0.3.7                    py35_0  file://offline/arcgis_channel/channel
decorator                    4.0.10                   py35_0  file://offline/arcgis_channel/channel

Since ArcGIS and all its dependencies are now searchable, the installation can now proceed. Create a new Conda environment, or on the root environment, install the arcgis package:

conda create --name awesome_arcgis python [this step is optional]

Now install ArcGIS from the Conda channel:

activate awesome_arcgis
conda install --channel //offline/arcgis_channel/channel arcgis --offline --override-channels

This prints the following and proceeds with installation after asking for user confirmation:

$ conda install -c //offline/arcgis_channel/channel arcgis --offline --override-channels
Fetching package metadata .....
Solving package specifications: ..........

Package plan for installation in environment C:\Anaconda3\envs\awesome_arcgis:

The following packages will be downloaded:

      package                    |            build
      colorama-0.3.7             |           py35_0          19 KB  file://offline/arcgis_channel/channel
      decorator-4.0.10           |           py35_0          12 KB  file://offline/arcgis_channel/channel

Proceed ([y]/n)? y
Enabling notebook extension arcgis/mapview...
      - Validating: ok

Ensure that ArcGIS is installed by running a Conda list:

$ conda list
  # packages in environment at C:\Anaconda3\envs\awesome_arcgis:
  arcgis                    0.9                      py35_1    file://offline/arcgis_channel/channel
  colorama                  0.3.7                    py35_0    file://offline/arcgis_channel/channel
  decorator                 4.0.10                   py35_0    file://offline/arcgis_channel/channel

Test the offline install

If the ArcGIS package was installed in an new environment, activate it. Then, from your terminal, run the following command:

jupyter notebook

This starts a new notebook environment in the browser. Start a new notebook and type the following:

from arcgis.gis import GIS()
gis = GIS("portal url", "username", "password") #connect to the ArcGIS Enterprise in your local network

This should bring up the map widget and load the default basemap.

Tips and tricks

OS differences

  • Depending on the operating system running this script, it may be necessary to replace backslashes with forward slashes (on a Unix-based OS, like Mac, Linux, etc.)
  • The Python script downloads the packages for all OS architectures. Thus, even if the destination computers are of varying operating systems, it is not necessary to rerun the download and index build steps. Make the channel available to the destination machines either on a web server or network drive, or by physically copying over to those machines and then installing from that location.

Building an archive

If you want to archive the channel for using later or for storage, this can be done by bundling the root level channel folder and all its sub-folders into a tar file. Use the following commands to do so. If on Windows, use PowerShell as the terminal for running these commands:

$ tar -zcvf arcgis_v1_offline_channel.tar.gz path/to/channel/

Running this prints an output similar to shown below:

a channel
a channel/.DS_Store
a channel/linux-32
a channel/linux-64
a channel/osx-32
a channel/osx-64
a channel/win-32
a channel/win-64
a channel/win-64/.index.json
a channel/win-64/_nb_ext_conf-0.3.0-py35_0.tar.bz2
a channel/win-64/anaconda-client-1.5.5-py35_0.tar.bz2
a channel/win-64/arcgis-1.0-py35_1.tar.bz2
a channel/win-64/clyent-1.2.2-py35_0.tar.bz2

To unpack this archive for later use, run the following command:

$ tar -zxcf arcgis_v1_offline_channel.tar.gz -C ./arcgis_channel

Related Information