5

How can I import anaconda-installed modules from arcgis's python shell? I have tried the method described in https://sites.google.com/site/advancedgisprog/other-resources/arcgis-anaconda-packages.

Steps I followed:

  1. navigate to the site-packages directory in the ArcGIS python install (C:\Python27\ArcGIS10.3\Lib\site-packages). In that folder, I created a new text file, and named it AnacondaPath.pth. Opened this file in Notepad.

  2. navigate to the Anaconda site-packages folder (C:Users\anwar\Anaconda3\Lib\site-packages). Once there, Paste this path in the Notepad window of the AnacondaPath.pth file, and save the change. Now, open the ArcGIS python interpreter, and try to import a dependency known only to be available to Anaconda. For example, I want to import pandas which is installed into my anaconda. But it showed me the error:

    import pandas

    Runtime error

    Traceback (most recent call last):

       File "<string>", line 1, in <module>
    

    ImportError: No module named pandas

Also I followed the same process I did for importing arcpy into spyder:

Importing arcpy into spyderI copied the arcpy folder from 'C:\Program Flies(x86)\ArcGIS\Desktop10.3' and pasted that into my 'C:\Users\anwar\Anaconda3\Lib\site-packages'. Now I can import arcpy into spyder of Anaconda3.

Importing pandas into arcgis's python I copied the pandas folder from 'C:\Users\anwar\Anaconda3\Lib\site-packages' and pasted that into 'C:\Program Flies(x86)\ArcGIS\Desktop10.3'. Also added this path into Desktop10.3 from 'C:\Python27\ArcGIS10.3\Lib\site-packages'. Still I am unable to import pandas from arcgis's python.

2

I think your issue is that you are trying to mix Python 2.7 with Python 3.x. They aren't the same.

ArcGIS Pro and the arcgis module go together (Python 3). If you are stuck in Python 2.7 land, them try using ArcREST.

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.