Take the 2-minute tour ×
Geographic Information Systems Stack Exchange is a question and answer site for cartographers, geographers and GIS professionals. It's 100% free, no registration required.

I see a lot of threads asking how you can have a separate Python installation (e.g. the Anaconda or Python XY distribution) and get it to work with arcpy, while not 'breaking' ArcGIS at the same time.

I had this same problem, and I think I have found a 'universal' solution. So far we have done this on about 8 computers at work and it all works fine.

So the question: How to install a separate Python distribution with ArcGIS?

share|improve this question

1 Answer 1

Ok, so this answer works for the Anaconda 64bit Python distribution with ArcGIS 10.1 64bit on Windows 7/Windows Server. Some of (or all) of the tips given below may apply to any other windows distribution of python.

First, install anaconda, it should go to the directory C:\Anaconda. Check the box 'make system default python'. It may give a warning that there is another python installed, but continue. Then:

Setup Paths and Environment Variables

First thing to do is to copy over the DTBGGP64.pth file to the new distribution directory (C:\Anaconda) from C:\Python27\ArcGISx6410.1\Lib\site-packages. The naming is arbritrary, but must have the .pth extension This will allow you to import ArcPy when using the new distribution.

Note: The correct location of the DTBGGP64.pth file should be in the site-packages directory (e.g. C:\Anaconda\Libs\site-packages). I have found that with some older versions of Anaconda, it works if sat in the top level directory

Next, the environment variables must be checked: In the system variable Path, the existing path to the python directory should be replaced with the new path. (e.g. C:\Anaconda;C:\Anaconda\Scripts;) This will tell windows where the default python directory is.

Make sure the user variable PYTHONPATH is also correct. This should point to any libraries you wish to use which are not described by .pth files or are installed in site-packages. I.E this might be your own development packages, or packages such as mapnik which have a different installation location.

Check Registry Settings

On some machines, the above may be enough to ensure that you can use arcpy from the new python and that python can be used within ArcGIS. On other machines, you may need to check registry keys.

The following registry keys have python settings:

There should be one key and its’ value should be C:\Anaconda\Lib;C:\Anaconda\DLLs (Or the corresponding folders for your python installation)

The key should be C:\Anaconda

You may have other python versions installed...in which case change the version number in the above paths

HKEY_CLASSES_ROOT\Python.CompiledFile\DefaultIcon This is the location of the .ico file to use for .pyc files

HKEY_CLASSES_ROOT\Python.CompiledFile\shell\open\command This is the command to issue when opening a .pyc file from the shell. You should change the python.exe path to the location of your desired python version

HKEY_CLASSES_ROOT\Python.File The keys here are the same as those for Python.CompiledFile except that they apply to a .py file. Again, make the relevant changes. It may have an extra key for 'Edit with IDLE' or 'Edit with Pythonwin'. Again, make the relevant changes so that the paths in these keys point to your desired python version.

HKEY_CLASSES_ROOT\Python.NoConFile These are the same as for Python.File, but should point to the pythonw.exe program where appropriate.

The PythonDir key points to the python installation to use within ArcMap etc.. You may wish for this to remain as the python installation as installed by ESRI, or point it to your new installation. It may require other changes if you point ArcMap to the new python installation. There may be issues with the versions of packages (e.g. numpy) installed by the new distribution. I have not encountered any.

For the majority of my work, this is irrelevant as I typically want to use python on it's own and occasionally have access to arcpy. I rarely wish to use python from within arcmap..Therefore I have done little testing of this final step, but it seems to work for everything I have tried so far.

I imagine that the process would be similar for installing Python(x,y) etc.

Other notes

The contents of the .pth file is a list of paths pointing to the following folders in your ArcGIS installation: bin64, arcpy, ArcToolbox\Scripts

For example, my .pth file contains the following:

C:\Program Files (x86)\ArcGIS\Desktop10.2\bin64
C:\Program Files (x86)\ArcGIS\Desktop10.2\arcpy
C:\Program Files (x86)\ArcGIS\Desktop10.2\ArcToolbox\Scripts
share|improve this answer
You should also mark this as the accepted answer. –  Chad Cooper Feb 18 '14 at 13:17
Can't do that until 2 days have passed since posting :) –  James Feb 18 '14 at 13:20
hmm...when I click the tick, I get a message saying 'you can accept your own answer in 2 days'... –  James Feb 18 '14 at 13:28
Does this install all the Python dependencies ArcGIS has? matplotlib, numpy, xlrd, xlwt and dateutil? –  KHibma Feb 18 '14 at 14:41
Don't forget that ArcGIS (10.2 and 10.1) has very specific version requirements for numpy - must be 1.6.1 or you can break arcpy. –  Luke Feb 18 '14 at 23:22

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.