Tuesday, 19 November 2019

ImportError: DLL load failed with error code when I try to import GDAL from the Python console


I've installed GDAL from the wheel files available here on Python 3.4. I'm using an old version of Python because one of the packages I need doesn't work yet on Python 3.6.



When I try to import gdal in Python with a simple from osgeo import gdal, I get the following error:


Traceback (most recent call last):
File "", line 1, in
File "C:\Python34\lib\site-packages\osgeo\__init__.py", line 41, in
_gdal = swig_import_helper()
File "C:\Python34\lib\site-packages\osgeo\__init__.py", line 37, in swig_import_helper
_mod = imp.load_module('_gdal', fp, pathname, description)
File "C:\Python34\lib\imp.py", line 243, in load_module
return load_dynamic(name, filename, file)
ImportError: DLL load failed with error code -1073741795


I'm not sure this question is a duplicate of this question which suggests to install the pre-compiled GDAL from GIS internals.



Answer



This issue was solved by sticking with the version 3.6.5 (latest as of this answer) of Python. It turns out that I didn't have to downgrade to Python 3.4 since all the libraries I was using are compatible with Python 3.6.


No comments:

Post a Comment

arcpy - Changing output name when exporting data driven pages to JPG?

Is there a way to save the output JPG, changing the output file name to the page name, instead of page number? I mean changing the script fo...