Search code examples
pythonpython-importarcpy

What other ways can python look for modules?


We have a software called ArcGIS that comes with a python environment, which has a library called arcpy

When you execute the python.exe from that environment, it imports arcpy with no issue.

But I needed to create another python enviroment that contains the same library as this one, but I just couldn't find anything named arcpy in the enviroment's folders

I even copied the whole Lib folder from the original enviroment to the one I'm trying to create, but it still won't import arcpy

I know this is kinda of a shot in the dark, as it is a proprietary library and I can't be sharing much info, but does anyone knows what could it be?

It seems they use Anaconda too


Solution

  • The python (arcpy) install with ArcGIS typicall installs to:

    C:\Python27\ArcGIS10.5
    

    Arcpy does not like to be moved, and the library is linked directly with your ArcGIS installation

    C:\Program Files (x86)\ArcGIS\Desktop10.5
    

    If you are using ArcGIS Pro rather than Desktop, it installs into Conda environment:

    C:\Program Files\ArcGIS\Pro\bin\Python\envs\arcgispro-py3\
    

    This Q&A on GIS Stack Exchange may be of some interest to you - How to set up Python/ArcPy with ArcGIS Pro 1.3