Summary
The ArcGIS API for Python package comes pre-installed as the arcgis package with the ArcGIS Pro and ArcGIS Enterprise Python environments (named arcgispro-py3 for both products). However users who require this package on a standalone Python or conda installation can do so by installing the package via Python, or conda using Anaconda or Miniconda.
Miniconda is a minimal installer for the Anaconda distribution, which is a popular platform for managing and deploying data science and machine learning packages.
This article describes the steps to install Miniconda, create a new Python environment, and install the ArcGIS Python package on Windows. Some points of failure are also considered and the steps to mitigate them are included as well.
Procedure
Install Miniconda
- Download Miniconda: Go to the official Miniconda website and download the installer for Windows: Miniconda Installer.
- Run the installer: Double-click the downloaded installer and follow the on-screen instructions. During installation, ensure that the option to add Miniconda to your system PATH is selected.
- If not added to system PATH environment variable, you may face an error running conda commands. The error looks as follows: ‘conda is not recognized as internal or external command, operable program or batch file.’
- In this case, one should manually add the condabin path to the PATH variable. The default location is under: C:\ProgramData\miniconda3\condabin
Create a new Python environment
- Open the Anaconda prompt: Search for "Anaconda Prompt" in the Start menu and open it. If the Miniconda install location is added to the PATH variable,
- Create a new environment: Use the following command to create a new Python environment:
conda create --name myenv
(Replace myenv with your desired environment name)
- Activate the environment the new environment with this command:
conda activate myenv
Install the ArcGIS Python package
- Install the ArcGIS package: Using the following command:
conda install -c esri arcgis
-
- This command installs the ArcGIS Python API from the esri channel.
- However, if the esri channel is not added to the conda configuration file, then you may need to add it manually as the install above would fail. Follow the steps below to add the esri channel to the conda config.
- To add the esri channel to conda configuration, run the following command.
conda config --add esri
- Verify the installation: After installation, verify that the package is installed by running the following command:
python -c "import arcgis; print(arcgis.__version__)"