AnsweredAssumed Answered

ImportError: No module named '_base' when importing arcpy

Question asked by pkundu on May 28, 2015
Latest reply on May 28, 2015 by Dan_Patterson

Hello all,

 

I have been running into some configuration errors while trying to import arcpy module into a simple Python script file, and I suspect that the errors might have something to do with the environment variables settings. Prior to the error above, I was running into a "ImportError: No module named 'arcpy'" error, which was related to incorrect environment variables. I have both Python 2.7 and Python 3.4 installed on my computer, and I would like to be able to use both of them in my code, but I'm not sure if that's possible.

 

Operating System: Windows 7

Application: ArcGIS for Desktop version 10.2.1

Path to ArcGIS: C:\Program Files (x86)\ArcGIS\Desktop10.2

Path to Python 2.7: C:\Python27

Path to Python 3.4: C:\Python34

Python IDE: PyCharm Community Edition 4.5.1

 

 

Environment Variables:

PATH: C:\Python27\;C:\Python34\;D:\Documents and Settings\pkundu\AppData\Roaming\npm;C:\Program Files (x86)\Java\jre7\bin

PYTHONPATH: C:\Program Files (x86)\ArcGIS\Desktop10.2\bin;C:\Program Files (x86)\ArcGIS\Desktop10.2\arcpy;C:\Program Files (x86)\ArcGIS\Desktop10.2\ArcToolbox\Script

 

When I try to run a very basic command:

 

import arcpy

 

I get the following error:

 

Traceback (most recent call last):

  File "D:/Documents and Settings/pkundu/Desktop/pytest/testpy2.py", line 6, in <module>

    import arcpy

  File "C:\Program Files (x86)\ArcGIS\Desktop10.2\arcpy\arcpy\__init__.py", line 21, in <module>

    from arcpy.geoprocessing import gp

  File "C:\Program Files (x86)\ArcGIS\Desktop10.2\arcpy\arcpy\geoprocessing\__init__.py", line 14, in <module>

    from _base import *

ImportError: No module named '_base'

 

 

Process finished with exit code 1

 

Would greatly appreciate a solution to this problem as I have not seen any other posts regarding this error. Most other posts have to do with the "ImportError: No module named 'arcpy'" error I was experiencing before I edited my environment variables to the ones listed above. When I followed the error code, I found that the geoprocessing folder contains both the "__init__.py" file and the "_base.py" file.

Outcomes