I am trying to get GDAL running under the following environment:
- Win 10
- Miniconda3 (this is just Anaconda with fewer modules loaded by default)
- Python 3.6.6
I installed GDAL with
conda install -c conda-forge gdal
When I try to import osgeo.gdal, I get this error:
(base) C:\Users\askov>conda activate geoprocessing
(geoprocessing) C:\Users\askov>python
Python 3.6.6 |Anaconda, Inc.| (default, Jun 28 2018, 11:27:44) [MSC v.1900 64 bit (AMD64)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> from osgeo import gdal
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "C:\Users\askov\AppData\Local\conda\conda\envs\geoprocessing\lib\site-packages\osgeo\__init__.py", line 21, in <module>
_gdal = swig_import_helper()
File "C:\Users\askov\AppData\Local\conda\conda\envs\geoprocessing\lib\site-packages\osgeo\__init__.py", line 17, in swig_import_helper
_mod = imp.load_module('_gdal', fp, pathname, description)
File "C:\Users\askov\AppData\Local\conda\conda\envs\geoprocessing\lib\imp.py", line 243, in load_module
return load_dynamic(name, filename, file)
File "C:\Users\askov\AppData\Local\conda\conda\envs\geoprocessing\lib\imp.py", line 343, in load_dynamic
return _load(spec)
ImportError: DLL load failed: The specified module could not be found.
I saw some articles (for example) suggesting I install GDAL from GIS Internals, which I did. The GIS Internals version I used was gdal-203-1900-x64-core.msi
. I also updated the PATH, GDAL_DATA, and GDAL_DRIVER_PATH, but that had no effect. I checked those variables in my Conda environment, and they are different from the system settings. Even after I manually set them (via the DOS set
command), I get the same result.
Another article suggested installing the krb5 module, which I installed via conda, with no change in the result.
How can I get gdal working in from a clean python environment (i.e.: not via QGIS or OSGeo4W)?