I hope someone can help me with this issue with gdal_calc.py. When I call gdal_calc.py from the command line, I get the following error (after displaying the error message I will describe my current environment):
C:\Users\xx> gdal_calc.py RuntimeError: module compiled against API version 9 but this version of numpy is 7 Traceback (most recent call last): File "C:\Anaconda2\Scripts\gdal_calc.py", line 46, in <module> from osgeo import gdalnumeric File "C:\Python27\ArcGIS10.3\lib\site-packages\osgeo\gdalnumeric.py", line 1, in <module> from gdal_array import * File "C:\Python27\ArcGIS10.3\lib\site-packages\osgeo\gdal_array.py", line 26, in <module> _gdal_array = swig_import_helper() File "C:\Python27\ArcGIS10.3\lib\site-packages\osgeo\gdal_array.py", line 22, in swig_import_helper _mod = imp.load_module('_gdal_array', fp, pathname, description) ImportError: numpy.core.multiarray failed to import
I am running Windows 7, installed Anaconda and the command line calls Anaconda's python version, and I have installed ArcGIS (my employer requires to script in ArcGIS from time to time).
When I call gdal from the command line, it runs without problems. Also, whenever I run gdal_polygonize.py there is no issue. So far, I have only run into problems when running gdal_calc.py as it seems to access the osgeo installation in ArcGIS and not the osgeo installation in Anaconda.
The osgeo path in Anancondo is: C:\Anaconda2\Lib\site-packages\osgeo
The osgeo path in ArcGIS is: C:\Python27\ArcGIS10.3\Lib\site-packages\osgeo
Also, to confirm the Python installation accessed:
Python 2.7.11 |Anaconda 4.0.0 (32-bit)| (default, Mar 4 2016, 15:18:41) [MSC v. 1500 32 bit (Intel)] on win32 Type "help", "copyright", "credits" or "license" for more information. Anaconda is brought to you by Continuum Analytics.