LDanzinger-esristaff

64-bit vs. 32-bit Python explained

Blog Post created by LDanzinger-esristaff Employee on Jul 29, 2013
Since ArcGIS for Server 10.1 was released, the ArcPy library has been accessible through a 64-bit platform. In addition, the 64-bit Background Geoprocessing patch was released at 10.1 Service Pack 1, which allows ArcGIS for Desktop users to utilize geoprocessing in 64-bit. This means that if you have ArcGIS for Desktop and either ArcGIS for Server or the Background 64-bit Geoprocessing Patch installed, you have two different installs of Python 2.7.



The default paths for those are:

C:\Python27\ArcGIS10.1 - (32-bit)

C:\Python27\ArcGISx6410.1 - (64-bit)

This ArcGIS Resource Center blog post explains how to go about utilizing 64-bit geoprocessing in Python, and the ArcGIS Desktop Help has a very informative article on what the advantages are of running geoprocessing operations in 64-bit, as well as some of the limitations. Very briefly, one major advantage is that with 64-bit Background Geoprocessing, you are able to utilize larger amounts of RAM for large geoprocessing jobs that may have failed in 32-bit. However, some limitations that should be noted include processing with certain data types (such as personal geodatabase, Excel tables, and OLEDB) and using certain tools (Metadata conversion tools, geodatabase administration tools, to name a few).

The implications of this are that you must be aware of the 64-bit limitations when determining what version of Python you want to use. When running geoprocessing tools in ArcGIS for Desktop, the application knows that if you have the 64-bit patch installed and are using Background Geoprocessing on a tool or data type that does not support it, to just run in 32-bit instead. However, running a standalone script in 64-bit that calls for unsupported data types or tools results in an error.

Here are a few different scenarios to be aware of that may cause you some confusion with the two versions of Python, especially if you are executing the script against the 64-bit version unknowingly.
  • If the most recent version of Python that was installed was 64-bit, then the file association of the .py file will be with that 64-bit version. This means that if you double-click a Python script, or call a script from the command line/scheduled task without specifying which version of Python to use, it will run in 64-bit. This is due to how Windows assigns file associations. However, if the script uses any unsupported data types or tools, it will fail. Esri Knowledge Base Article 40838 explains this scenario, along with how to change the file association or explicitly call the version of Python that you want to use. I recommend that if you are going to set up your scripts to run as scheduled tasks, you first review the help documentation to determine if you should utilize the 32-bit or 64-bit version of Python, then create a Windows batch file to call whichever version of Python you wish to use. The scheduled task can then point to the .bat file instead of the Python script to avoid any confusion. This is explained in the above referenced KB article.
  • If running a Python script from an IDE, make sure to check what version of Python it (or its shortcut) is pointing to. For example, the 32-bit version of IDLE can be found at: C:\Python27\ArcGIS10.1\Lib\idlelib\idle.bat, and the 64-bit version can be found here: C:\Python27\ArcGISx6410.1\Lib\idlelib\idle.bat. Other IDEs such as PythonWin or PyScripter have different downloads for the 32-bit and 64-bit version, so be aware of the version of Python that the IDE you are working from uses. Just as mentioned in the above scenario, using the 64-bit version of Python on unsupported data or tools will result in an error. The version of Python can be checked by using the following command:

import sys

print(sys.version)

  • In some cases, uninstalling ArcGIS for Server or 64-bit Background Processing could result in the Python files (.py) not being associated with Python. If you do not specify to run your scripts with the 32-bit Python executable through the command line or a schedule task, there could be issues successfully running that script. Esri Knowledge Base Article 41185 discusses this scenario, along with how to resolve it.

There are undoubtedly more scenarios that could cause confusion with the 32-bit vs. 64-bit versions of Python. However, one thing to remember is that if your script works in ArcMap or ArcCatalog, but fails with an error in an IDE or as a schedule task, make sure to check the version of Python to be sure you are not using an unsupported data type or geoprocessing tool with 64-bit Python.Lucas D. - Desktop Support Analyst

Outcomes