[gdal-dev] ModuleNotFoundError: No module named 'osgeo._gdal_array'

Lorenzo Di Giacomo loridigia at gmail.com
Fri Sep 24 05:53:05 PDT 2021

Hi everyone, basically i build from source GDAL 3.2.2 and install the
python bindings via pip3 install gdal==3.2.2

Later i install numpy, i have read online that the numpy must be installed
before GDAL python bindings.
So i tried to uninstall python gdal and than reinstall it, but the problem
still persists.

Do you have any suggestions about it?

Python3 libraries:
GDAL 3.2.2
NUMPY 1.21.2

SWIG 4.0.2


ModuleNotFoundError: No module named 'osgeo._gdal_array'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "temp-1544239507789228725main.py", line 98, in <module>
    SSRD,gtSSRD = tiff2array(path_to_tiff, band_SSRD)
  File "/hadoop/yarn/local/usercache/dispatcher/appcache/application_1628674283442_0030/container_e33_1628674283442_0030_01_000001/61a5101c-d78d-494d-b0d6-ef16719143719035222534140350861632485975806.zip/utility/rasterutils.py",
line 58, in tiff2array
  File "/usr/local/lib/python3.7/site-packages/osgeo/gdal.py", line
3832, in ReadAsArray
    from osgeo import gdalnumeric
  File "/usr/local/lib/python3.7/site-packages/osgeo/gdalnumeric.py",
line 2, in <module>
    from osgeo.gdal_array import *
  File "/usr/local/lib/python3.7/site-packages/osgeo/gdal_array.py",
line 17, in <module>
    _gdal_array = swig_import_helper()
  File "/usr/local/lib/python3.7/site-packages/osgeo/gdal_array.py",
line 16, in swig_import_helper
    return importlib.import_module('_gdal_array')
  File "/usr/local/lib/python3.7/importlib/__init__.py", line 127, in
    return _bootstrap._gcd_import(name[level:], package, level)
ModuleNotFoundError: No module named '_gdal_array'
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/gdal-dev/attachments/20210924/14362d28/attachment.html>

More information about the gdal-dev mailing list