pythonpython-2.7anacondagdalosgeo

Unable import gdal into python installed with anaconda (MacOSX)


Getting the following when I try to import osgeo gdal on Mac. I have installed gdal etc via anaconda.

>>> from osgeo import gdal
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/Users/ste/anaconda/lib/python2.7/site-packages/osgeo/__init__.py", line 21, in <module>
_gdal = swig_import_helper()
File "/Users/ste/anaconda/lib/python2.7/site-packages/osgeo/__init__.py", line 17, in swig_import_helper
_mod = imp.load_module('_gdal', fp, pathname, description)
ImportError: dlopen(/Users/ste/anaconda/lib/python2.7/site- packages/osgeo/_gdal.so, 2): Library not loaded:  @loader_path/./libgssapi_krb5.2.2.dylib
Referenced from: /Users/ste/anaconda/lib/libgdal.20.dylib
Reason: image not found

Solution

  • Looks like krb5 is a dependency but not installed automatically by anaconda:

    conda install krb5
    

    This fix the problem for me!