ArcGIS10.5, Python

Resolving “No module named arcpy”

If “ImportError: No module named arcpy” looks familiar, you’ve come to the right place!

(°□°)╯ ┻━┻

My recent endeavors using arcpy resulted in aimless time spent following workaround steps proposed by other ArcGIS users. The typical “pip install <module>” workflow is not a viable solution to utilize Esri’s proprietary arcpy module, which ships with the ArcGIS software package. After having read many different routes users had taken to get this working, I figured I’d add my own workaround to the conversation (and hopefully save someone out there some time as well).

Currently, I have a license for ArcGIS 10.5. I am using Python 2.7.14 to develop a solution to handle data collected at the Canadian forward sortation area (FSA) level. This is my first experience with arcpy, so I checked to see if I could simply import it first:

After attempting to make additions to my PATH environment variable, I learned that I was missing PYTHONPATH. Adding PYTHONPATH to my environment variables, the variable value I assigned was the following:

C:\Program Files (x86)\ArcGIS\Desktop10.5\arcpy; C:\Program Files (x86)\ArcGIS\Desktop10.5\bin; C:\Python27\ArcGIS10.5\Lib\site-packages;

I restarted Python and first checked my sys.path to ensure my changes were detected. Printing the sys.path function results shows the list of strings that have been specified in the PYTHONPATH.  I could then import arcpy successfully!


If you have any other questions or comments about getting arcpy working in your development environment, feel free to comment below!

Useful References & Additional Resources:

Fixing ArcGIS10.1 Numpy Import Error From Python Console

ImportError: No module named numpy:

Documentation for sys library:

Leave a Reply