Other Resources‎ > ‎

Accessing Anaconda-installed modules from ArcGIS's python

An advantage of using Anaconda as the primary python on a system is that Anaconda simplifies managing some dependencies, and is independent of the ArcGIS installation on the computer. That Anaconda is separated from ArcGIS means that ArcGIS upgrades, uninstallations, and other events will not affect the python install and an installed dependencies.

However, a disadvantage to this separation is that ArcGIS still uses it's version of python, and any dependencies installed to your Anaconda python will not be available to python code running under ArcGIS. Thus, if you create a toolbox tool using python, and it relies on something like GDAL, which has been installed to Anaconda but not the ArcGIS python, the tool will fail to execute.

The good news is that we can fix this! We can easily give our ArcGIS python a path to our Anaconda packages, and use them from ArcGIS. To do so, navigate to the site-packages directory in the ArcGIS python install (likely something like C:\Python27\ArcGIS10.2\Lib\site-packages). In that folder, create a new text file, and name it AnacondaPath.pth. Open this file in Notepad.

In your Explorer window, navigate to the Anaconda site-packages folder (likely C:\Anaconda\Lib\site-packages). One there, click in the address bar of the Explorer window and copy the path. Paste this path in the Notepad window of the AnacondaPath.pth file, and save the change. Now, open the ArcGIS python interpreter, and try to import a dependency known only to be available to Anaconda (scipy, for instance). If the import statement does not result in an error, then everything should be setup properly.