ModuleNotFoundError:No module named "gdal _array"

I have been running Invest SDR and I have the same problem.
Traceback (most recent call last):
File “site-packages\osgeo\gdal_array.py”, line 25, in swig_import_helper
File “imp.py”, line 296, in find_module
ImportError: No module named ‘_gdal_array’

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File “site-packages\taskgraph\Task.py”, line 697, in add_task
File “site-packages\taskgraph\Task.py”, line 1174, in _call
File “site-packages\pygeoprocessing\geoprocessing.py”, line 749, in align_and_resize_raster_stack
File “site-packages\pygeoprocessing\geoprocessing.py”, line 1949, in warp_raster
File “site-packages\pygeoprocessing\geoprocessing.py”, line 3029, in mask_raster
File “site-packages\pygeoprocessing\geoprocessing.py”, line 881, in new_raster_from_base
File “site-packages\osgeo\gdal.py”, line 2648, in WriteArray
File “C:\hostedtoolcache\windows\Python\3.7.7\x86\lib\site-packages\PyInstaller\loader\pyimod03_importers.py”, line 627, in exec_module
File “site-packages\osgeo\gdalnumeric.py”, line 2, in
File “C:\hostedtoolcache\windows\Python\3.7.7\x86\lib\site-packages\PyInstaller\loader\pyimod03_importers.py”, line 627, in exec_module
File “site-packages\osgeo\gdal_array.py”, line 35, in
File “site-packages\osgeo\gdal_array.py”, line 27, in swig_import_helper
ModuleNotFoundError: No module named ‘_gdal_array’
2020-09-07 15:11:34,247 model._logged_target(1635) ERROR Exception while executing <function execute at 0x173EDA08>
Traceback (most recent call last):
File “site-packages\osgeo\gdal_array.py”, line 25, in swig_import_helper
File “imp.py”, line 296, in find_module
ImportError: No module named ‘_gdal_array’

My python version is:natcap.invest installed is 3.8.4.

Do you have any suggestion? Thanks!

Hi @liqi1, welcome to the forums!

I’m sorry you’re experiencing this issue, and I’m not immediately sure what’s causing it. Here are a couple things to try, though, which will get us started with debugging this:

  1. Could you upload the full logfile for the model run? It should be located within the workspace you selected in the mode’s user interface.
  2. Could you try running SDR within the latest version of InVEST? InVEST 3.8.8 is the latest version and can be downloaded from https://naturalcapitalproject.stanford.edu/software/invest.
  3. Do you know if you have another GDAL installation on your computer?
  4. Related, do you have a GDAL_DATA environment variable defined? That can sometimes cause related issues.

Thanks,
James