Select to view content in your preferred language

Change where Arc looks for Python

1401
7
06-12-2013 05:01 PM
StacyRendall1
Frequent Contributor
I recently installed the very useful 64bit geoprocessing patch (more info here). However, the admin guy installed the new Python to C:\Python27, while the old Python was installed (by default) to D:\Python27.

To keep things tidy we would like to move the old 32bit Python to C:\Python27 as well (note that I am not intending to put both versions in the same folder, but just to have C:\Python27\ArcGIS10.1 as the location of 32bit and C:\Python27\ArcGISx6410.1 as the location of 64bit). However, I cannot find out how to do this without killing Arc. Renaming the folder of the 32bit Python, hoping that it might no longer even be necessary) causes ArcCatalog to crash on startup (no error message, just sits on splash for a while then disappears).

I thought this would be defined through a link in the Arc install folder, or in the registry, however, neither of these seem to be the case. Am I missing something?
Tags (2)
0 Kudos
7 Replies
RDHarles
Regular Contributor
My understanding is the ArcMap needs the win32 version (whether you're going to use the 64-bit version or not).  I have both the win32 (which gets installed with the ArcMap installation) and I also put on the 64-bit version on.  I run all my python scripts from a windows command line so all I needed to do to get the 64-bit version to run is to change the windows PATH Environment variable (Control Panel > System > Advanced System Settings > Environment variables).
Not sure how you'd change the drive where ArcMap is looking for python? (my guess would be the registry).
0 Kudos
ChrisSnyder
Honored Contributor
Maybe not the best/fastest answer, but in the long run, probably the easiest:

1. Uninstall everything ArcGIS and Python (including 64bitbackground, 32-bit python, 64-bit Python, any other versions of Python, etc).
2. Delete the old Python folders (under C:\ and D:\) and the ArcGIS folder under C:\Program Files\ArcGIS
3. Reinstall everything using the default folders on C:\.

A somewhat related tale: A while back, our IT people cleverly (because they are ***experts***) decided to call the primary hard drives on our Citrix Servers the M:\ drive (instead of C:\). Needless to say, this turned out to be a very bad decision...
0 Kudos
StacyRendall1
Frequent Contributor
Thanks Chris, pretty much what we figured too. Unfortunately the initial install is a silent network install in our institute, so cannot simply change where Python is installed by that!

Might just have to leave it as is - really surprised there isn't some simple way to do it!
0 Kudos
ChrisSnyder
Honored Contributor
I'm sure there is a "right" way to do this, but between the stuff in the registry and the environment variables (PATH and/or PYTHONPATH), it becomes difficult to figure out what works and what doesn't... And what works and what doesn't can depend on what software you currently have... or even what different versions you have had in the past. Of course different version of Python and/or ArcGIS have used different methods to establish this path stuff over the years, so if you have an "older" machine that has had different versions of Python and/or ArcGIS installed on it at one point, then you registry is probably chock full of all sorts of keys with reference to all sorts of different paths.

A clean reinstall has always worked to get things straightened out for me... except recently: http://forums.arcgis.com/threads/78704-Python-subprocess-module-and-64-bit-background-geoprocessing-....

Maybe just searching the registry for all the refs to your D:\Python27 install and change it to C:\Python27? Likewise, look for refs like this in the envr. variables too.
0 Kudos
StacyRendall1
Frequent Contributor
Hey Chris,

thanks for your suggestion to search "C:\Python27" - previously I had searched the registry for the full Python path (i.e. C:\Python27\ArcGIS10.1), and didn't find much. The search you suggested turned up three fruitful looking keys (ESRI ones pointing to Python), however, changing them:
- to a non-existent path didn't cause anything not to open
- to a path to which Python was manually copied, and the old one deleted, still caused ArcCatalog not to open.

So, it appears the only solution would be complete uninstall and reinstall, as you suggested...
0 Kudos
LucasDanzinger
Esri Frequent Contributor
The help might get you on the right track, but I'm pretty sure the biggest key is going to be creating the Desktop10.1.pth file, which is discussed in the above article. This is a pointer from python27 to the ArcGIS Install location, so you'll definitely need that if you haven't done so already. For me, the Desktop10.1.pth file is located here: C:\Python27\ArcGIS10.1\Lib\site-packages. It's basically a text file called "Desktop10.1" with the file extension of ".pth" and has a few paths in it:

C:\Program Files (x86)\ArcGIS\Desktop10.1\bin
C:\Program Files (x86)\ArcGIS\Desktop10.1\arcpy
C:\Program Files (x86)\ArcGIS\Desktop10.1\ArcToolbox\Scripts

Not positive this will completely take care of it for you, but it's a good place to start if you haven't done this already.
0 Kudos
StacyRendall1
Frequent Contributor
Hi Lucas,

The Desktop10.1.pth file tells Python where to look for required parts of the Arcpy library. I need to tell ArcGIS where to look for Python, which is an entirely different problem.

My current 32bit Python27, installed by ArcGIS during its install, is at D:\Python27\ArcGIS10.1, while ArcGISs' 64bit Python, installed as part of the 64bit Background Geoprocessing patch (installed by my system admin), was placed at C:\Python27\ArcGISx6410.1. We want to move the 32bit Python27 from 😧 to C:, so that both Pythons have the same root folder of C:\Python27, with 32bit in a \ArcGIS10.1\ subfolder and 64bit in a \ArcGISx6410.1\ subfolder.

The problem is that if I move the 32bit Python, or rename its folder, ArcCatalog will not start. Altering the registry keys I mentioned in an earlier post, so that they point to the modified location, makes no difference, ArcCatalog still will not start.
0 Kudos