Python – Troubleshooting Python 3.6, Django 1.11, Windows 10, and GDAL 2.2.4 Compatibility Issues

djangogdalpythonwindows 10

I've been trying to find a solution to this issue, but couldn't find anything.
I've installed OS4GEOW using the Django Docs

But I get the following error:

File "C:\Python36\lib\site-packages\django\contrib\gis\gdal\libgdal.py", line 49, in <module>
lgdal = CDLL(lib_path)
File "C:\Python36\lib\ctypes\__init__.py", line 348, in __init__
self._handle = _dlopen(self._name, mode)
OSError: [WinError 127] The specified procedure could not be found

I've modified the C:\Python36\lib\site-packages\django\contrib\gis\gdal\libgdal.py file, so it contains this line:
lib_names = [str('gdal201'), str('gdal202'), str('gdal111'), str('gdal110'), str('gdal19')]

instead of:

lib_names = [str('gdal201'), str('gdal20'), str('gdal111'), str('gdal110'), str('gdal19')]

gdalinfo --version returns: GDAL 2.2.4, released 2018/03/19

I also have GDAL=="2.2.4" python package installed.

My path contains:

C:\Python36\Scripts\
C:\Python36\
C:\OSGeo4W\bin

My C:\OSGeo4W\bin folder contains gdal202.dll which in details says 2.2.4 version.

But it still doesn't run, would be glad for anykind of pointers/help because I'm kind of lost with GDAL Python 3.6 combo.

Best Answer

According to the Docs, GDAL 2.2 is not supported for Django 1.11.

Try upgrading Django to Version >= 2.0 or downgrade GDAL to 2.1.

Related Question