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)
The challenge here is getting the ESRI-provided version of Python and associated module s to work with non-ESRI provided modules that you gain via Anaconda. Generally speaking, when you download and install Anaconda, you will get newer versions of Python-related material (including standard modules like numpy) than what is in your ArcGIS "Python Stack," which will not work. You therefore must configure Anaconda to be compatible with the version of ArcGIS "Python stack" (10.1, 10.2, 10.3, Pro) that you have installed. The instructions here describe how to install older versions of modules into Anaconda that will work with ArcGIS.
Related topic: Calling arcpy from an external virtual Python environment
Anaconda is an open-source Python distribution that makes is possible to easily install many pre-packaged third party Python modules. It is a competing alternative to the Enthought Python Distribution (EPD).
It has some big advantages over using Esri's distributions:
The general workflow to make this happen is to:
At this point, you will have full Anaconda version of the python environment that's spiffy and new and totally useless with ArcMap.
The following workflow will demonstrate how to install the Pandas module for python as an example. Pandas is great for a whole variety of data processing tasks (just google "python pandas"). It is not a standalone module; it sits on top of numpy. A version of Pandas only works with a specific version of numpy. Since we don't want to mess with the version of numpy that comes with ESRI software, we need to match the version of Pandas that will be happy with the ESRI version of numpy.
The following example is for ArcGIS 10.2.2.
A. Find the versions of numpy and matplotlib Arc is using.
Open ArcMap and its Python window, and enter these commands:
>>> 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')
B. Create an Anaconda virtual environment (including pandas) that is compatible with ArcGIS 10.2.2.
Rather than modifying the basic Anaconda installation, you can create a custom environment within Anaconda and specify the version of Pandas you want there. To do this:
C. Test the virtual environment
D:\Users\cprice>activate arc1022
Activating environment "arc1022"...
[arc1022] D:\Users\cprice>conda list
# packages in environment at D:\Users\cprice\Anaconda\envs\arc1022:
#
dateutil 2.4.1 py27_0
matplotlib 1.3.0
np17py27_0numpy 1.7.1 py27_3
pandas 0.13.0 np17py27_0
...
[arc1022] D:\Users\cprice>python
Python 2.7.5 |Continuum Analytics, Inc.| (default, Jul 1 2013, 12:41:55) [MSC v.1500 32 bit (Intel)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>>
Copy the .pth file to your Anaconda environments site-packages folder so Anaconda can "see" arcpy
[arc1022] (D:\Users\cprice>( copy c:\Python27\ArcGIS10.2\lib\site-packages\desktop10.2.pth
D:\Users\cprice\Anaconda\envs\arc1022\lib\site-packages )
[arc1022] D:\Users\cprice>python
Python 2.7.5 |Continuum Analytics, Inc.| (default, Jul 1 2013, 12:41:55) [MSC v.1500 32 bit (Intel)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> import arcpy
>>> import pandas
>>>
If you have admin access:
Navigate to "C:\Python27\ArcGIS10.2\Lib\site-packages"
If you get an error message when you try to import, the most common cause I've seen is that the version of the module is still too new. In the pandas example, version 0.10.1 also appears to use the same 1.6.1 version of numpy but for some mysterious ESRI-specific reason that we could not get support to solve or really talk about, pandas 0.10.1 does not work. The solution was to modify the Anaconda "esri" environment to hold 0.10.0 pandas and all worked. To do change this:
How to do a separate Python installation with ArcGIS? (GIS Stack Exchange)
Using ArcPy with Anaconda (PyMorton)