Python 64-bit in Desktop 10.1

648
6
Jump to solution
05-21-2013 08:28 AM
Elvis_de_JesúsDurán_Sierra
New Contributor
Hello!

I'm having trouble in trying to execute the Python 2.7.2 64-bit inside the Arcmap.
I've already installed the 64-bit background geoprocessing.
When I open the Python command window inside Arcmap and I type sys.version I get the following output:
'2.7.3 (default, Apr 10 2012, 23:31:26) [MSC v.1500 32 bit (Intel)]'
And that is the Python 32-bit version.
How can I run the Python 64-bit version whose path is C:\Python27\ArcGISx6410.1\python.exe, inside ArcMap?????
I need to execute a script inside Arcmap but it only works for Python 64-bit version because it requieres too much memory
and I get a ???memory error??? in Python 32-bit.

Regards.
Elvis Durán
Tags (2)
0 Kudos
1 Solution

Accepted Solutions
by Anonymous User
Not applicable
You cannot run the 64 bit Python inside ArcMap/Catalog because both of these applications are 32 bit.  That is why it is 64 bit for background processing.  If you want to run 32 bit background processing from inside ArcMap, you would need to uninstall 64 bit background processing. But to use the 64 bit processing it must be done in a stand alone environment.  Check out this [url=http://resources.arcgis.com/en/help/main/10.1/index.html#/Background_Geoprocessing_64_bit/0021000000...] for more info.

View solution in original post

0 Kudos
6 Replies
by Anonymous User
Not applicable
You cannot run the 64 bit Python inside ArcMap/Catalog because both of these applications are 32 bit.  That is why it is 64 bit for background processing.  If you want to run 32 bit background processing from inside ArcMap, you would need to uninstall 64 bit background processing. But to use the 64 bit processing it must be done in a stand alone environment.  Check out this [url=http://resources.arcgis.com/en/help/main/10.1/index.html#/Background_Geoprocessing_64_bit/0021000000...] for more info.
0 Kudos
Elvis_de_JesúsDurán_Sierra
New Contributor
Thanks for your answers.
I have another questions relative to 64-bit background processing:
When I run a Python script inside Arcmap in background mode and try to import a 3rd party module (like scipy), I get the following
output: "No module named scipy".
I'm confused beacause I've already installed scipy for 64-bit inside C:\Python27\ArcGISx6410.1\Lib\site-packages.
But in the error details I've realized that Arcmap is pointing to the folder C:\Python27\ArcGIS10.1\Lib\site-packages in wich I
dont have installed scipy and I guess that's the reason why it can't be found.

1. Why is Arcmap pointing to C:\Python27\ArcGIS10.1 given that I'm using 64-bit background processing and it should be pointing to
C:\Python27\ArcGISx6410.1?????????

2. How can I configure Arcmap to search for the 64-bit 3rd party modules in C:\Python27\ArcGISx6410.1\Lib\site-packages?????

Best regards!
Elvis Durán
0 Kudos
by Anonymous User
Not applicable
No matter what, whenever you run python from within ArcMap or ArcCatalog it will be using the 32 bit Python (C:\Python27\ArcGIS10.1).  The 64 bit python IDLE can only be used as a stand alone script outside of ArcMap/Catalog, therefore, when you try to import modules from the ArcGISx6410.1 folder the modules will not be found.  If you want to use scipy in the Python Window inside ArcMap, you must install the 3rd party module in the "C:\Python27\ArcGIS10.1\Lib\site-packages" folder as well.

you can Check where your PYTHONPATH is with a simple test:
>>> import sys
>>> for pypath in sys.path:
 print pypath

 
C:\Windows\system32
C:\Python27\ArcGIS10.1\Lib\idlelib
C:\Windows\system32\python27.zip
C:\Python27\ArcGIS10.1\DLLs
C:\Python27\ArcGIS10.1\lib
C:\Python27\ArcGIS10.1\lib\plat-win
C:\Python27\ArcGIS10.1\lib\lib-tk
C:\Python27\ArcGIS10.1
C:\Python27\ArcGIS10.1\lib\site-packages
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
>>> # To see what version of Python you are running use:
>>> print 'Running against: %s' %sys.version
Running against: 2.7.2 (default, Jun 12 2011, 15:08:59) [MSC v.1500 32 bit (Intel)]
>>> 


How can I configure Arcmap to search for the 64-bit 3rd party modules in C:\Python27\ArcGISx6410.1\Lib\site-packages


You cannot configure ArcMap to search these 64-bit 3rd party modules because ArcMap can only use the 32 bit Python.  Therefore, you must use the 64 bit IDLE whose paths are in the C:\Python27\ArcGISx6410.1 folder.

Here is my 64 bit PYTHONPATH:
>>> import sys
>>> for pypath in sys.path:
 print pypath

 
C:\Users\GIS\Desktop
C:\Python27\ArcGISx6410.1\Lib\idlelib
C:\Python27\ArcGISx6410.1\lib\site-packages\setuptools-0.6c11-py2.7.egg
C:\Windows\system32\python27.zip
C:\Python27\ArcGISx6410.1\DLLs
C:\Python27\ArcGISx6410.1\lib
C:\Python27\ArcGISx6410.1\lib\plat-win
C:\Python27\ArcGISx6410.1\lib\lib-tk
C:\Python27\ArcGISx6410.1
C:\Python27\ArcGISx6410.1\lib\site-packages
C:\Program Files (x86)\ArcGIS\Desktop10.1\bin64
C:\Program Files (x86)\ArcGIS\Desktop10.1\arcpy
C:\Program Files (x86)\ArcGIS\Desktop10.1\ArcToolbox\Scripts
C:\Python27\ArcGISx6410.1\Lib\CalebsTools
>>> print 'Running against: %s' %sys.version
Running against: 2.7.2 (default, Jun 12 2011, 14:24:46) [MSC v.1500 64 bit (AMD64)]
>>> 


You can always see what version of python you are running with:

import sys
print 'Running against: %s' %sys.version

I hope this helps!
Elvis_de_JesúsDurán_Sierra
New Contributor
So, if I understood, Desktop 10.1 is only 32 bits and it can't run a 64bit python to execute my scripts.
Then, what is the utility of the 64bit background processing???? I thought this service pack could execute
my scripts in a 64bit python version.

Regards.
0 Kudos
by Anonymous User
Not applicable
So, if I understood, Desktop 10.1 is only 32 bits and it can't run a 64bit python to execute my scripts.


Correct, inside Desktop 10.1 it will use call the 32 bit Python by default. If you want to use 64 bit Python IDLE you must do so as a stand alone script outside of ArcMap/ArcCatalog.


my scripts in a 64bit python version.

Your script is not a 64 bit python version. It is simply a .py file that can be executed by either the 32 bit or 64 bit interpreter. It does not matter if you use the 32 bit IDLE or 64 bit IDLE to create the script; it is still just a .py file not specific to any version (unless you write it to be). It DOES matter when you are importing modules (any python script is a module) because each version of IDLE: the one shipped with ArcGIS Desktop 10.1 (C:\Python27\ArcGIS10.1) and the 64 bit IDLE shipped with SP1 64 bit background processing (C:\Python27\ArcGISx6410.1) will have different PYTHONPATH's.

Imports called from within the 32 bit environment can only search out modules within it's PYTHONPATH; same for 64 bit.

It is not good practice to save your normal geoprocessing scripts in these folders unless you have created custom classes or functions that you wish to import into other modules. About 99% of my scripts live on my GIS Server, and I have about 10 or so custom modules I have written that I have saved in both C:\Python27 folders so I can import their functions into other modules.

One thing you can do as a work around if you are wanting to use modules that are in your 64 bit folder and not 32 bit is a temporary sys.path.append(r'some\path'). This will temporarily add the path you supply to the PYTHONPATH of the current version of Python you are using. Once the script is finished executing, the path will no longer be in the PYTHONPATH. So if you want to search out modules in your 64 bit folder from within 32 bit python you can do something like this:
import sys
sys.path.append(r'C:\Python27\ArcGISx6410.1\Lib\site-packages')


and here is an example of this in action...take a look at the difference in PYTHONPATH's before and after the sys.path.append()

>>> import sys
>>> print 'Running against: %s' %sys.version
Running against: 2.7.2 (default, Jun 12 2011, 15:08:59) [MSC v.1500 32 bit (Intel)]
>>> for pypath in sys.path:
 print pypath

 
C:\Windows\system32
C:\Python27\ArcGIS10.1\Lib\idlelib
C:\Windows\system32\python27.zip
C:\Python27\ArcGIS10.1\DLLs
C:\Python27\ArcGIS10.1\lib
C:\Python27\ArcGIS10.1\lib\plat-win
C:\Python27\ArcGIS10.1\lib\lib-tk
C:\Python27\ArcGIS10.1
C:\Python27\ArcGIS10.1\lib\site-packages
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
>>> 
>>> # Add a temporary path to PYTHONPATH
>>> sys.path.append(r'C:\Python27\ArcGISx6410.1\Lib\site-packages')
>>> for pypath in sys.path:
 print pypath

 
C:\Windows\system32
C:\Python27\ArcGIS10.1\Lib\idlelib
C:\Windows\system32\python27.zip
C:\Python27\ArcGIS10.1\DLLs
C:\Python27\ArcGIS10.1\lib
C:\Python27\ArcGIS10.1\lib\plat-win
C:\Python27\ArcGIS10.1\lib\lib-tk
C:\Python27\ArcGIS10.1
C:\Python27\ArcGIS10.1\lib\site-packages
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
C:\Python27\ArcGISx6410.1\Lib\site-packages
>>> 


Of course, if you do not want to have to worry about this, you could also just install scipy into your 32 bit folder as well then you can always have access to it whether you are using 32 bit or 64 bit. I hope all this makes sense...imports are definitely a tricky concept at first!