Could you help with importing numpy and arcpy on Pycharm?

1507
13
02-03-2019 10:34 PM
TshepoHlako
New Contributor II

I'm struggling with running/importing 'numpy and arcpy' on pycharm, which points to python.exe in the Python 27 directory where ArcGIS 10.4 is installed. How else can i try importing the two modules as it gives the errors "ImportError: No module named arcpy" for both arcpy and numpy.

Thanks,
Charlie

0 Kudos
13 Replies
TshepoHlako
New Contributor II

I've tried all suggestions to avail. What seems to be working is 'archook', which according to github "Searches the system for arcgis and makes arcpy available to python (regardless of pythonpath/system path/registry settings)". Below is how i've managed to allow import for 'arcpy':

import archook
archook.get_arcpy()
import arcpy

curtvprice
MVP Esteemed Contributor

I'm guessing your registry settings or PYTHONPATH variable (which were set by the 3.7 install) are polluting your sys.path.

This archook module must clean up your sys.path. Neat idea.

To see your sys.path:

import sys
print "\n".join(sys.path)‍‍
TshepoHlako
New Contributor II

Will do, thanks Curtis

0 Kudos
DanPatterson_Retired
MVP Emeritus

Unless you don't have arcmap installed, the location of the salient registry files may differ

0 Kudos