JamesRamm / archook

Searches the system for arcgis and makes arcpy available to python (regardless of pythonpath/system path/registry settings)
GNU General Public License v2.0
81 stars 28 forks source link

ImportError: No module named numpy #8

Closed pfoppe closed 7 years ago

pfoppe commented 7 years ago

I am running a local install of Esri ArcGIS for Desktop v10.3.1 (10.3.1.4959) with an Advanced license. I've setup a local virtual environment and install archook through pip. I receive the following when I try to import arcpy from archook:

>>> import archook
>>> archook.get_arcpy()
>>> import arcpy
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "C:\Program Files (x86)\ArcGIS\Desktop10.3\arcpy\arcpy\__init__.py", line 24, in <module>
    from arcpy.toolbox import *
  File "C:\Program Files (x86)\ArcGIS\Desktop10.3\arcpy\arcpy\toolbox.py", line 359, in <module>
    from .management import Graph, GraphTemplate
  File "C:\Program Files (x86)\ArcGIS\Desktop10.3\arcpy\arcpy\management.py", line 26, in <module>
    import _management
  File "C:\Program Files (x86)\ArcGIS\Desktop10.3\arcpy\arcpy\_management.py", line 14, in <module>
    import _graph
  File "C:\Program Files (x86)\ArcGIS\Desktop10.3\arcpy\arcpy\_graph.py", line 27, in <module>
    import numpy
ImportError: No module named numpy

I've compared my sys.path when running from from the local v10.3.1 python to the virtualenv with archook. It appears that the numpy is loaded from C:\Python27\ArcGIS10.3\lib\site-packages\numpy which is NOT added to the sys.path.extend call.

I manually added the following after the sys.path.extend statement: sys.path.append(r'C:\Python27\ArcGIS10.3\lib\site-packages')

And was then able to successfully import arcpy.

Anyone else have this problem? Thanks!

JamesRamm commented 7 years ago

Numpy is an arcpy dependency and you should therefore have it installed in the python environment you want to use arcpy in. Archook does not install arcpy dependencies - it expects you to take care of these

Try pip install numpy in your virtual environment.

pfoppe commented 7 years ago

Hi James,

Thanks for the response. I've installed numpy in my local virtual env and was able to import arcpy.

I will close this issues thread.