I just did a fresh install of Anaconda3 and am trying to add GDAL/OGR. I've tried installing with both conda install gdal and conda install -c conda-forge gdal. In both cases, the install completes successfully, but when I import gdal, it raises the error:

Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "C:\Users\Jhook\AppData\Local\Continuum\miniconda3\lib\site-packages\gdal.py", line 2, in <module>
    from osgeo.gdal import deprecation_warn
  File "C:\Users\Jhook\AppData\Local\Continuum\miniconda3\lib\site-packages\osgeo\__init__.py", line 21, in <module>
    _gdal = swig_import_helper()
  File "C:\Users\Jhook\AppData\Local\Continuum\miniconda3\lib\site-packages\osgeo\__init__.py", line 17, in swig_import_helper
    _mod = imp.load_module('_gdal', fp, pathname, description)
  File "C:\Users\Jhook\AppData\Local\Continuum\miniconda3\lib\imp.py", line 243, in load_module
    return load_dynamic(name, filename, file)
  File "C:\Users\Jhook\AppData\Local\Continuum\miniconda3\lib\imp.py", line 343, in load_dynamic
    return _load(spec)
ImportError: DLL load failed: The specified module could not be found.

I've found several workarounds out there, but most date back a few years and don't reflect more recent updates or changes. Is there a fix for this problem that works in 2018?

  • What OS are you running this on? How did you call import gdal, via a terminal or an IDE? – Aaron Aug 28 '18 at 15:16
  • Running on Windows 10. Result is the same for import gdal from a terminal and from PyCharm. – triphook Aug 28 '18 at 15:19
  • Try ‘from osgeo import gdal’ – Aaron Aug 28 '18 at 16:58
  • 1
    from osgeo import gdal results in the same message – triphook Aug 28 '18 at 17:28
  • Can you please confirm you are running Python 3? – Aaron Aug 28 '18 at 18:06

There seems to be an incompatibility between the latest version of conda and vs2015_runtime and conda-forge gdal.

If I create a conda-forge env and specify vs2015_runtime=14, everything works:

conda create -n testgdal -c conda-forge gdal vs2015_runtime=14 

activate testgdal 

(testgdal) python 

Python 3.6.6 | packaged by conda-forge | (default, Jul 26 2018, 11:48:23) [MSC v.1900 64 bit (AMD64)] on win32 
Type "help", "copyright", "credits" or "license" for more information.  

>>> from osgeo import gdal


  • Thanks for this. Was going crazy for a while. Shouldn't this get done automatically by anaconda? – user32882 Jun 26 at 9:41
  • It should, but conda-forge is not Anaconda. It's a separate community led channel and occasionally things get out of sync – user2856 Jun 26 at 9:44

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.