Select to view content in your preferred language

ImportError: No module named arcpy

7330
11
Jump to solution
01-14-2016 11:33 AM
KennethKirkeby
Deactivated User

So ..... I been working with ArcMap for 3 semesters and it went well so far. I enrolled in a Python programming class. 

ARCGIS wis installed in C:\Program Files (x86)\ArcGIS\Desktop10.3.

I downloaded Python 2.7.xx and installed it to C:\Python27.

>>> print("\n".join(sys.path))

C:\Python27\Lib\idlelib

C:\WINDOWS\SYSTEM32\python27.zip

C:\Python27\DLLs

C:\Python27\lib

C:\Python27\lib\plat-win

C:\Python27\lib\lib-tk

C:\Python27

C:\Python27\lib\site-packages

C:\Python27\lib\site-packages\win32

C:\Python27\lib\site-packages\win32\lib

C:\Python27\lib\site-packages\Pythonwin

How do I add the ARCGIS modules to this sys.path (IF that's what my problem is). Please be nice to the noob

0 Kudos
11 Replies
AshleyStalzer
Deactivated User

Hi Kenneth,

You may wish to add the Desktop10.3.pth file. See Importing ArcPy.

The installation of ArcGIS 10.3.1 products will install Python 2.7 if it isn't already installed. The installation will also add the file Desktop10.3.pth (or Engine10.3.pth or Server10.3.pth) into python27\Lib\site-packages. The contents of this file include two lines containing the paths to your system's ArcGIS installation's arcpy and bin folders. These two paths are required to import ArcPy successfully in Python version 2.7.


If importing ArcPy produces either of the following errors, the required modules could not be found:

    • ImportError: No module named arcpy
    • ImportError: No module named arcgisscripting

To address this, browse using Windows Explorer to the python27\Lib\site-packages folder and add or edit the Desktop10.3.pth file. The file should contain the three lines shown below (corrected to your system's path if they do not match):

c:\Program Files (x86)\ArcGIS\Desktop10.3\arcpy

c:\Program Files (x86)\ArcGIS\Desktop10.3\bin

c:\Program Files (x86)\ArcGIS\Desktop10.3\ArcToolbox\Scripts

If that fails, try this:

1. Go to C:\ and rename the Python27 folder to Python27_Old.

2. Go to Control Panel\Programs\Programs and Features

3. Right-click on ArcGIS 10.3.1 for Desktop > Uninstall/Change

4. Click Repair and then proceed through the rest of the wizard accepting the defaults.

The repair will reinstall Python and adjust paths.


I hope this helps!

KennethKirkeby
Deactivated User

I ended up uninstalling and reinstalling per Mr. Patterson's comments. Took the defaults this time rather than trying to customize.