Error: ImportError: no module named WeightsUtilities
Error Message
In some instances, when running Spatial Statistics tools such as the Hot Spot Analysis (Getis-Ord Gi*) and Cluster and Outlier Analysis (Anselin Local Moran's I) tools in Python, the following error message is received:
Error:
ImportError: no module named WeightsUtilities
Cause
Below are some of the possible causes for the issue:
- The path, C:\Program Files (x86)\ArcGIS\Desktop10.x\ArcToolbox\Scripts is not appended to the system PYTHONPATH variable.
- ArcGIS Desktop and the Python instance are not installed on the same drive.
Note: This issue can also occur due to incomplete installation of ArcGIS for Desktop. To fix this, perform a clean uninstallation and reinstallation of ArcGIS for Desktop. Refer to the following Help documents for more information, ArcMap: Uninstalling ArcGIS for Desktop and ArcMap: Installing ArcGIS for Desktop on your computer.
Solution or Workaround
Depending on the cause, use one of the following options to resolve the issue:
Option A
Add the path to the system PYTHONPATH variable:
- Right-click My Computer > Properties.
- On the Control Panel Home sidebar, click the Advanced system setting option.
- In the System Properties window, open the Advanced tab, and click the Environment Variables button.
- Under the System variables section, highlight the PYTHONPATH variable, and click the Edit button.
- Enter the following path in the Variable value section.
C:\Program Files (x86)\ArcGIS\Desktop10.x\ArcToolbox\Scripts
- Click OK.
- Click OK on the Environment Variables window.
- Click OK on the System Properties window.
Option B
Install ArcGIS Desktop and Python on the same drive. For more information, refer to the following Help document: ArcMap: Python, NumPy, and MatPlotlib.
Related Information
- Problem: Unable to import arcpy
- ArcMap: Adding toolboxes in Python
- ArcMap: ImportToolbox
- ArcMap: Using tools in Python
Last Published: 2/1/2017
Article ID: 000012889
Software: ArcMap 10.1