There are multiple ways in which you can experience the ArcGIS API for Python and its SDK. You can either install the API and SDK using conda or try it using the live sandbox or get it as a Docker image.
Try it live¶
The API is now available in a live sandbox. You may choose to experience it in the sandbox before going ahead with the installation. Click the link below to launch a temporary Jupyter notebook environment.
Note, these are temporary environments which are erased after you close the browser tab. If you would like to save your changes, download your notebooks from the
File menu of the Jupyter notebook IDE.
Install using Conda¶
The ArcGIS API for Python is distributed via conda. Conda is a popular package and environment manager application that helps you install and update packages such as the ArcGIS Python API and their dependencies. You can install the API through two main workflows - install through anaconda or install using ArcGIS Pro. Both are outlined below.
Step: 1 Get Conda¶
Install the latest version of Anaconda for Python (for Python 3x), if you don't already have conda. The ArcGIS API for Python requires Python 3.5 or higher. If you have installed ArcGIS Pro 1.4 or later, you already have conda.
Step: 2 Install
To download and install the API in your conda environment, type the following command in your terminal.
conda install -c esri arcgis
If you are running a Windows OS, you can type this into your command prompt or PowerShell. If you are running a Mac or Linux OS, you can type this into your terminal application. The screen shot below shows this command being typed into the Windows command prompt.
Install using ArcGIS Pro¶
ArcGIS Pro 1.4 and later gives you a Python Package Manager interface that can be used to download and install the ArcGIS API for Python. As shown in the screen shot below, from your Pro backstage, click on the 'Python' tab. Then click on 'Add Packages' button and type
arcgis into the search bar. You may have to click on the 'refresh' button to ensure you are getting the latest version of the package. Then click 'Install' and accept the terms and conditions.
Alternately, if you would like to install through the command line, you can use the Python Command Prompt shortcut within the ArcGIS Pro program group in Windows start menu and type the conda install command explained earlier. Depending on how you installed Pro, you might have to start this prompt with elevated privileges.
You can now start using the API in your Python IDE of choice, or from the Jupyter Notebook environment.
ArcGIS API for Python requires Pro 1.4 or later. If you are using Pro 1.3, please upgrade to 1.4 or later. If you cannot upgrade, you can still install the API by creating a new environment in conda with Python 3.5 or higher and install the API in that environment. However, if you follow this approach, you cannot use ArcPy and the API from the same Python environment. Instructions for this approach is below, type them one at a time in the Python Command Prompt:
conda create --name my_new_pro_env python=3.6 activate my_new_pro_env conda install -c esri arcgis
You can have both anaconda and ArcGIS Pro installed on the same computer and have the API installed in both. Thus if you have Pro 1.3, you can either install the API by creating a new environment (explained above) or by installing anaconda.
Upgrade from older arcgis package¶
If you are upgrading from an older version of the arcgis package, run the following command in your terminal:
conda upgrade -c esri arcgis
If you are using ArcGIS Pro 1.4 or later to install the API, you can use the Update Packages tab in the screen shot above to update. An alternate way to upgrade is to use the Python Command Prompt and type the above command.
If you would like to install the API on a machine without internet or, if your workstation is in a disconnected network, you can do so in three steps.
- First, install the latest version of Anaconda for Python (for Python 3x). It is preferable you install full anaconda and not miniconda.
- Next download the latest version of the API from Esri's channel on anaconda.org for your OS. For instance, if you are installing on Linux 64-bit, then download the package titled
linux-64/arcgis-1.0.1-py36_1.tar.bz2into a known location.
Run conda from your terminal and install the API using the following command
conda install /path_to_package_download_folder/linux-64/arcgis-1.0.1-py36_1.tar.bz2
If you find yourself installing the API in multiple machines or, if you need to use miniconda in your workflow, it might be beneficial to set up an offline conda channel. Refer to the Esri Knowledge Base article for instructions.
Start jupyter notebook¶
To use the API in the Jupyter Notebook environment, use the following command in your terminal:
Refer to this doc for more help on how to use the notebook environment
Test your install¶
From the Jupyter Notebook dashboard, create a new Python 3 notebook and type these lines of code:
from arcgis.gis import GIS my_gis = GIS() my_gis.map()
You should see a map come up as shown below:
Install as a Docker image¶
Docker is a popular containerization technology. Docker containers bundle software in a complete file system with everything that is needed to run it. Docker containers run the same regardless of your operating system. To learn more about docker, refer to the official documentation.
The ArcGIS API for Python is shipped as a Docker image which you can download and power up whenever you want to use the API. These images when spun up into containers, run in an isolated environment without making any changes to your local file system.
Follow the steps below to get Docker on your computer and run the API:
- Download docker and install it on your computer.
Once installed, run the following command in terminal to pull Docker image
docker pull esridocker/arcgis-api-python-notebook
Then spin the image into a container using the following command in terminal. Replace the
<localport>with an available port number, for instance
docker run -it -p <localport>:8888 esridocker/arcgis-api-python-notebook
- When the container starts, it will provide a URL (with a one time token) to open your local Notebook instance. Copy the URL and paste it in your browser's address bar to use the notebooks.
Feedback on this topic?