0

This questions has been asked before too and I did go through most of the suggestions. Things I have tried so far: setting up correct path variable environment, installing anaconda 32 bits, python 2.7, or even switching to python 2.7 in cmd while initially using Anaconda 3 , adding Desktop 10.4.pth file with following path.

C:\Program Files (x86)\ArcGIS\Desktop10.4\bin
C:\Program Files (x86)\ArcGIS\Desktop10.4\ArcPy
C:\Program Files (x86)\ArcGIS\Desktop10.4\ArcToolBox\Scripts

I also added those paths in environment variable

These suggestions help me to reduce the error. But Now I am getting a different error. Looks like python can find arcpy but missing another package.

Getting this error while trying to import arcpy in python 3.6.

File "C:\Program Files (x86)\ArcGIS\Desktop10.4\ArcPy\arcpy\__init__.py", line 22, in <module>
    from arcpy.geoprocessing import gp

  File "C:\Program Files (x86)\ArcGIS\Desktop10.4\ArcPy\arcpy\geoprocessing\__init__.py", line 14, in <module>
    from _base import *

ModuleNotFoundError: No module named '_base'

Any suggestions?

1

I think the problem is in the Anaconda version that you are using. You should install Anaconda 2 (32 bit) not Anaconda 3 (32 bit). ArcGIS 10.4 works with python 2 which is 2.7 which is included in Anaconda 2. ArcGIS 10.4 does not work with Python 3.6 which is included in Anaconda 3 which you already use and stated in your question.

I am using Anaconda 2 (32 bit) and specifically Spyder and I do not have any problem in importing arcpy module. I am setting up the following path in the environment:

C:\Program Files (x86)\ArcGIS\Desktop10.4\bin
C:\Program Files (x86)\ArcGIS\Desktop10.4\arcpy
C:\Program Files (x86)\ArcGIS\Desktop10.4\ArcToolBox\Scripts 

Also please note that in this path: C:\Program Files (x86)\ArcGIS\Desktop10.4\arcpy, arcpy should starts with small a and p not capital A and P as in your question.

  • @ahmadhand Paths are correct. I did installed Anaconda 2 too. But when I open spyder I call for arcpy in python 3.6. Not sure if that is the problem. – Wisconsin Nov 14 '17 at 15:47
  • @Wisconsin I think you need to call arcpy from python 2.7. As far as I know, arcpy in ArcGIS 10.4 is not compatible with python 3. – ahmadhanb Nov 14 '17 at 15:55
0

Thanks for help. I solved my problem making following change Rename the desktop.pth file to desktop.txt. desktop.pth in following location C:\Python27\ArcGISx6410.4\Lib\site-packages

I agree arcpy is working in python 2.7. Not py 3.6

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.