[GIS] ModuleNotFoundError: No module named ‘_gdal’ … but I have GDAL

gdalimporterrorinstallationmacqgis-processing

I'm really at my wit's end with this. I'm on a Macbook running Sierra 10.12, so I used the KyngChaos installation of QGIS 3.8. I followed the instructions in the ReadMe (added the PATH variable), and installed python (though I already had it on my machine), GDAL and then QGIS. Here's a screenshot showing that I have the GDAL framework in the proper place:

enter image description here

And yet, QGIS continues to say that it can't find '_gdal' and therefore can't load the processing plugin. Does this have something to do with the underscore? Here's a snipped of the error message I'm seeing.

Couldn't load plugin 'processing' 

ModuleNotFoundError: No module named '_gdal' 
Traceback (most recent call last):
  File "/Applications/QGIS3.8.app/Contents/MacOS/../Resources/python/osgeo/__init__.py", line 11, in swig_import_helper
    fp, pathname, description = imp.find_module('_gdal', [dirname(__file__)])
  File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/imp.py", line 297, in find_module
    raise ImportError(_ERR_MSG.format(name), name=name)
ImportError: No module named '_gdal'

Best Answer

Same problem with Mac Os Sierra; but I copy manually from osgeo (in the python framework folder), the gdal.py and gdal.so files to the path where the error is occurring. I also duplicate them and named as _gdal.py and _gdal.so.

You should try also with gdalconst.py, ogr.py, and osr.py (and correspondent *.so files).

Related Question