USGS EGIS web pages
EGIS Home
EGIS Support
Metadata
Training
Email Lists
Esri Events
External web pages
Esri Support
Esri Product Help
Esri GeoNet
GIS Stack Exchange
EGIS wiki space (here)
Anaconda is an open-source Python distribution that makes is possible to easily install and manage many pre-packaged third party Python modules. It is a competing fully open-source alternative to the Enthought Python Distribution (EPD).
It has some big advantages over using the Python Esri provides with ArcGIS:
The general workflow to make this happen is to:
Miniconda only includes the minimal Python (the main distribution now includes R and many other packages and is very large).
Download MiniConda for Python 2.7
Download links: ( x32 | x64 ) (save do not run link)
The 32-bit version works with ArcGIS Desktop (which is 32-bit)
The 64-bit version is optional, but required to use Anaconda with ArcGIS background processing (and Pro)
Run the .exe installers
Select install for a single user (Not "All Users")
Set up the Start menu shortcuts
Open a command window and enter these commands:
cd D:\Users\cprice\Anaconda32\Scripts conda install console_shortcut cd D:\Users\cprice\Anaconda64\Scripts conda install console_shortcut
At this point, you will have a nice Anaconda setup that's spiffy and new and totally useless with ArcMap.
The following workflow will demonstrate how set up a custom Python environment within Anaconda that is similar to that of ArcGIS Python, and then add a compatible version pandas module. Pandas is great for a whole variety of data processing tasks (just google "python pandas"). If you get this far, you can adapt this workflow to include any other modules you may want.
The following example is for ArcGIS 10.2.2.
The critical modules for ArcGIS compatibility can be determined from your version of ArcGIS from the command line.
(Or you can just look at the list below under B.)
C:\Users\jwpowell> C:\Python27\ArcGIS10.2\python.exe -c ^ "import sys, numpy, matplotlib;print(sys.version, numpy.__version__, matplotlib.__version__)" ('2.7.5 (default, May 15 2013, 22:43:36) [MSC v.1500 32 bit (Intel)]', '1.7.1', '1.3.0')
We'll also include a few other modules that we know are shipped in the ArcGIS Python stack.
Since this new custom environment is not the Anaconda default, you need to let it know that's what you want to use. Then, you'll ask it to tell you what's installed.
Open an Anaconda command window and load the virtual environment
C:\Users\cprice> conda info --envs # conda environments: # arc1022 D:\Users\cprice\Anaconda32\envs\arc1022 root * D:\Users\cprice\Anaconda32 D:\Users\cprice>activate arc1022 Activating environment "arc1022"... [arc1022] D:\Users\cprice> conda list # packages in environment at D:\Users\cprice\Anaconda32\envs\arc1022: # dateutil 2.4.1 py27_0 matplotlib 1.3.0 np17py27_0 numpy 1.7.1 py27_3 pip 8.1.1 py27_1 pyparsing 1.5.6 py27_0 pyside 1.2.1 py27_0 python 2.7.5 2 python-dateutil 2.4.1 <pip> pytz 2016.4 py27_0 setuptools 21.2.1 py27_0 six 1.10.0 py27_0 wheel 0.29.0 py27_0 xlrd 0.9.4 py27_0 xlwt 1.0.0 py27_0
You can add more packages using conda install, but make sure you specify version numbers for these that won't change the environment's version of python or numpy (or ArcGIS will not be able to use that environment anymore).
Let's add the pandas module.
Specifying python, numpy, and matplotlib versions makes sure the environment will still work with ArcGIS, and Anaconda determines the most recent compatible version of pandas (in our case, 0.13.0).
conda install -n arc1022 python=2.7.5 matplotlib=1.3.0 numpy=1.7.1 pandas ... The following NEW packages will be INSTALLED: pandas: 0.13.0-np17py27_0 ### this version works with python 2.7 and numpy 1.7 ...
A few of the most popular things to add to your environment is interactive python ("ipython"), in several flavors:
conda install -n arc1022 python=2.7.5 matplotlib=1.3.0 numpy=1.7.1 ipython ipython-notebook ipython-qtconsole
Here is another example, that installs both pandas and spyder, which includes a whole host of tools (including iPython and iPython notebook).
conda install -n arc1022 python=2.7.5 matplotlib=1.3.0 numpy=1.7.1 pandas spyder
You can search for more packages available in conda with conda search.
You're not limited to adding only packages to which conda has access to your new environment. Here's an example on how to install a commonly desired GIS-related package (shapely) into a conda virtual environment using the python pip utility:
http://deparkes.co.uk/2015/01/29/install-shapely-on-anaconda/
This can most easily be done (personal opinion) with a Python startup script
> C:\Python27\ArcGIS10.2\python.exe usercustomize.py
> C:\Anaconda32\envs\myenv\python.exe usercustomize.py
python -m site --user-site
C:\Users\username\AppData\Roaming\Python\Python27\site-packages
If you get an error message when you try to import, a common cause is version incompatibilities between Esri's python environment modules and the conda modules. (Condo takes care of compatibility across its environment, but it can't know about versions Esri uses in their python install.) In the pandas example, version 0.10.1 also appears to use the same 1.6.1 version of numpy used by ArcGIS 10.1.x, but some errors occur when trying to import pandas due to some other incompatibility. The solution was to modify the Anaconda environment to use an older version of pandas (0.10.0). The other critical packages are included to avoid having Anaconda install some other incompatible packages.
conda install -n arc101 python=2.7.5 matplotlib=1.3.0 numpy=1.6.1
pandas=0.10.0
:: Anaconda environment name and versions required for Arc set AEENV=arc1022 set AEVERS=python=2.7.5 matplotlib=1.3.0 numpy=1.7.1 conda config --remove channels conda-forge -f conda remove jupyter notebook ipykernel ipython ipython-notebook ipython-genutils ipwidgets jupyter_client jupyter_console jupyter_core jupyter-client jupyter-console jupyter-core widgetsnbextension matplotlib -n %AEENV% -y conda install -c defaults %AEVERS% ipykernel ipython ipython-notebook ipywidgets jupyter jupyter_client jupyter_console jupyter_core notebook matplotlib -n %AEENV% -y conda config --add channels conda-forge -f conda install %AEVERS% requests xlrd -n %AEENV% -y conda list
http://www.continuum.io/blog/conda
How to do a separate Python installation with ArcGIS? (GIS Stack Exchange)
Using ArcPy with Anaconda (PyMorton)