Is it possible to install other Python distributions on top of the ArcGIS?

2423
3
07-09-2011 03:41 AM
wernerrolf
New Contributor
I'm using ArcGIS 10 and would like to use various additional libraries that are not included in the delivered version of ArcGIS (esp. numpy and matplotlib).
First I tried to install them manually as described here: http://matplotlib.sourceforge.net/users/installing.html

But because this seem not to work
-
I tried various different mailing lists and forums but so far it seems that this problem cannot be solved; see also my post here: http://forums.arcgis.com/threads/33772-Matplotlib-for-Python-scripting-in-ArcGIS-10-does-not-work?p=...
-
I'm wondering if it may work if I just install the distribution PYTHON(X,Y) which has all packages I need for development. (see http://www.pythonxy.com/)

Does anyone have experience and knows if I can just install another distribution simply on top of the existing version installed by ArcGIS 10 without loosing my ArcGIS Python functionalities. Maybe someone did even try this and installed the PYTHON(X,Y) distribution to use with ArcGIS already? What version would be best? The newest one runs with Python 2.6.6.

Thanks! Werner
Tags (2)
0 Kudos
3 Replies
JasonScheirer
Occasional Contributor III
It is unsupported and not recommended.
0 Kudos
StacyRendall1
Occasional Contributor III
As stated by the previous poster, you should not install another Python distribution on top of the one installed by ArcGIS. However, you do have a couple of options (see below for instructions):

  1. Install another (separate) Python to which you can add your extensions (but you won't be able to use them at the same time as you use Arcpy, and vice versa).

  2. Add the ArcGIS Python installation to your system Path (then installing libraries, e.g. Numpy and Matplotlib, to your current Python will work).



Method 1

How to:

  1. Download something like [URL="http://www.activestate.com/activepython/downloads"]ActiveStates Active Python [/URL (make sure you get a version that is supported by all the libraries you wish to use - i.e. Numpy or Matplotlib)

  2. Install it to the default path (i.e. 'C:\Python26\') or similar, DO NOT overwrite the ArcGIS installation of Python. The ActiveState installer will set the system Path to the install directory during the installation.

  3. Install the libraries you require. As the Path is now set to the new Python installation, the libraries will find it and install there.

Issues:

  • The ArcGIS installation and the new installation will be seperate; i.e. you will not be able to use Numpy and Arcpy within the same scripts...



Method 2

How to:
NOTE: Doing this requires administrator rights on the computer you are using.

  1. Add the ArcGIS Python installation to your systems Environment Variable Path. To do this you need to know where ArcGIS has installed its Python - search your system for python.exe and write down the path and folder it lives in. For example, on my system, it is C:\Python26\ArcGIS10.0\

  2. [INDENT]  WARNING: Donâ??t make any mistakes here (like deleting things), or your system might not workâ?¦
    [INDENT]Now, on Windows XP: 
    [INDENT]Right click on My Computer, select Properties, go to the Advanced tab, then click Environment Variables[/INDENT][/INDENT] 

    [INDENT]On Windows 7 (and, I presume, Vista): 
    [INDENT]Right click on Computer, click on Advanced system settings on the left, then click Environment Variables[/INDENT][/INDENT] 

    [INDENT]In the â??System variablesâ?? pane, scroll the box down and select the â??Pathâ?? variable, then go to Edit. Place the cursor in the box, and hit End to get the cursor at the end, add a semi-colon ( ; ) and then enter the path to the Python installation that you wrote down earlier. So, on my computer, I added this: 
    ;C:\Python26\ArcGIS10.0\

    Click OK, then close the other dialog boxes... To test you didn't make any mistakes, go to Run, enter   cmd and hit enter (this brings up the command prompt), then type   python and hit enter. If you have done everything right, this will start the Python interpreter. If you get an error, make sure that you entered the Path correctly. If you have entered the Path correctly but still get an error, try restarting your computer then testing again.[/INDENT][/INDENT] 
  3. Install the libraries you require; just note that the version of Python included with ArcGIS is relatively old, so make sure to get the right installers (when you start the Python interpreter it will tell you what your installed version is). As the Path is now set to the Python installation, the libraries will find it and install there.

Issues:

  • It is a bit more technical and risky if you make a mistake, like deleting things in your Path.



It is up to you which method you use, but if you need to use numpy/matplotlib and arcpy in the same scripts, you will have to use Method 2...


Installing Python(x,y) would be the same thing as doing Method 1 (it will be separate from your ArcGIS version of Python), but it also installs a bunch of other programs and an IDE (fancy editor) for Python...
0 Kudos
NickMiller1
New Contributor II

I managed to get PythonXY to utilise the ArcPy module by copying the desktop10.2.pth file from c:\Python27\ArcGIS10.2\Lib\site-packages\ and pasting it into C:\Python27\Lib\site-packages\

In this way I was able to do a vanilla install of ArcGIS (including Python) as well as a vanilla install of PythonXY. In this secnario, PythonXY can call the ArcPy module so if you want to use Spyder to author and run python scripts that perform spatial functions you can. It also means you can write python scripts that do spatial functions and also leverage other PythonXY scientific modules as well.

0 Kudos