English
Continue in the app
Be The First To Get Support Updates
Want to know about the latest technical content and software updates?

Error: ImportError: No module named arcpy

Error Message

When attempting to import arcpy using 64-bit Python that comes with an ArcGIS Server installation, the following error message appears:

Error: 
"ImportError: No module named arcpy"

Cause

The arcpy module's location probably is not specified correctly within the Server10.x.pth file. This file is in the following location:

 <install-drive>\python27\Lib\site-packages

Solution or Workaround

  1. Ensure that the following locations are specified in the Server10.3.pth file (the version of ArcGIS Server determines the name of the .pth file):
C:\Program Files\ArcGIS\Server\arcpy
C:\Program Files\ArcGIS\Server\bin
C:\Program Files\ArcGIS\Server\ArcToolbox\Scripts
The ArcGIS Server Installer also utilizes the sys.path functions and adds the following location to the system path:
C:\Program Files\ArcGIS\Server10.3\arcpy
  1. From the main toolbar in ArcMap, open the Python window and run the following commands:
>>> import sys
>>> print sys.path
  1. Verify that arcpy is in the system path.
['', u'c:\\program files\\arcgis\\server\\arcpy', 'C:\\windows\\system32', 'C:\\Python27\\ArcGISx6410.3\\Lib\\idlelib', 
'C:\\windows\\system32\\python27.zip', 'C:\\Python27\\ArcGISx6410.3\\DLLs', 'C:\\Python27\\ArcGISx6410.3\\lib', 
'C:\\Python27\\ArcGISx6410.3\\lib\\plat-win', 'C:\\Python27\\ArcGISx6410.3\\lib\\lib-tk', 'C:\\Python27\\ArcGISx6410.3', 
'C:\\Python27\\ArcGISx6410.3\\lib\\site-packages', 'C:\\Program Files\\ArcGIS\\Server\\bin', 
'C:\\Program Files\\ArcGIS\\Server\\ArcPy', 'C:\\Program Files\\ArcGIS\\Server\\ArcToolBox\\Scripts']

Python checks both 'sys.path' and the 'Server10.3.pth' file for a module named 'arcpy' when importing arcpy. As long as the location of arcpy is specified, importing arcpy is successful:

>>> import arcpy
>>>
Note:
Python 3 is installed in the latest ArcGIS Server to the following location by default: C:\Program Files\ArcGIS\Server\framework\runtime\ArcGIS\bin\Python\Scripts\propy.bat. Refer to ArcGIS Server: ArcGIS Server and ArcPy. Alternatively, refer to Problem: Unable to use the ArcPy module for more information on the issue.

Related Information

Last Published: 5/26/2022

Article ID: 000012627

Software: ArcGIS GIS Server 10.3.1, 10.3, 10.2.2, 10.2.1, 10.2, 10.1 ArcGIS Server 10.9.1, 10.9, 10.8.1, 10.8, 10.7.1, 10.7, 10.6.1, 10.6, 10.4.1, 10.4, 10.3.1, 10.3, 10.2.2, 10.2.1, 10.2, 10.1, 10