Python scripting with 64-bit processing

Last week 64-bit Background Geoprocessing was made available for download. We’ve had a few questions from keen Python scripters who want to “get out of the application” and use their big data crunching scripts in 64-bit. If you’re one of those keen scripters, all you need to do is make sure you’re executing against 64-bit Python; no other special commands or tricks needed.

64-bit Background Geoprocessing installs a 64-bit version of Python 2.7.2, NumPy and Matplotlib if they are not already installed. By default they will be installed to C:\Python27\ArcGISx6410.1 (note the x64 in the path), an additional install from the 32-bit Python (C:\Python27\ArcGIS10.1) that Desktop and Engine install and use.

Note: If you have ArcGIS for Server 10.1 installed, 64-bit Background Processing will share Server’s 64-bit Python installation.

Now typically the last version of Python installed will be the one you execute against when double clicking a script from Windows Explorer. If you last installed 64-bit Background Processing, this means you’ll probably be executing against 64-bit Python. You can always change which program executes when double clicking a file in Windows.

If you need to ensure you’re calling the 64-bit version of Python (to make use of 64-bit processing) you can qualify which version of Python you execute against. Be sure to read the 64-bit help topic that applies to both scripting and ArcMap to learn about supported tools and data types.

The following script, “” is run in the 64-bit processing space by qualifying which Python installation to execute against at command line (c:\Python27\ArcGISx6410.1\python.exe).

The above text was printed running a script with the following python code
import arcpy
import sys
print "Running against: {}".format(sys.version)
print "Intersecting parcels..."
                         "ALL", "", "INPUT")
#...continued script...

3rd party Python modules

If you’ve written a Python script tool which makes use of a 3rd party module (one that is not included in the core Python installation, NumPy or Matplotlib) you will need to download and install the 64-bit version. Whether you are inside Desktop, or executing your script at command prompt, you need to ensure the proper module is installed and ready to go. For example, if your script tool requires the popular library, SciPy, you’ve probably already downloaded and installed the 32-bit version. You will have to download and install the 64-bit version of SciPy to successfully execute your tool when using 64-bit Background inside Desktop or when using 64-bit Python scripting. If you’re distributing your tool to a wide audience and are not confident your users will have the 64-bit module, you can disable background processing by checking the Always run in foreground option on the script tool’s general property page to force your tool to run against 32-bit Python.

Happy 64-bit scripting.

Next Article

Jeffrey Sachs discusses the critical roles of GIS and storytelling in solving global challenges

Read this article