[gdal-dev] Python GDAL ImportError: ... undefined symbol: CPLGetErrorCounter

Even Rouault even.rouault at spatialys.com
Fri Sep 14 07:44:47 PDT 2018


On vendredi 14 septembre 2018 09:09:17 CEST Chiara Marmo wrote:
> Hello,
> 
> I'm on Fedora28
> I'm working on a custom version of GDAL (only fitsdataset.cpp is modified),
> up to date with the last upstream version from github.
> 
> I need to test python bindings: so I've followed the instructions here[1] in
> order to have them linked with my gdal version. The build process went
> fine.
> But when I try to import gdal in my local jupyter notebook the following
> error is thrown
> 
> from osgeo import gdal
> 
> ---------------------------------------------------------------------------
> ImportError                               Traceback (most recent call last)
> <ipython-input-2-8a0c40533a07> in <module>()
>      10
>      11 from astropy.io import fits
> ---> 12 from osgeo import gdal
> 
> /usr/local/lib64/python3.6/site-packages/GDAL-2.3.0-py3.6-linux-x86_64.egg/o
> sgeo/__init__.py in <module>() 19                 fp.close()
>      20             return _mod
> ---> 21     _gdal = swig_import_helper()
>      22     del swig_import_helper
>      23 else:
> 
> /usr/local/lib64/python3.6/site-packages/GDAL-2.3.0-py3.6-linux-x86_64.egg/o
> sgeo/__init__.py in swig_import_helper() 15         if fp is not None:
>      16             try:
> ---> 17                 _mod = imp.load_module('_gdal', fp, pathname,
> description) 18             finally:
>      19                 fp.close()
> 
> /usr/lib64/python3.6/imp.py in load_module(name, file, filename, details)
>     241                 return load_dynamic(name, filename, opened_file)
>     242         else:
> --> 243             return load_dynamic(name, filename, file)
>     244     elif type_ == PKG_DIRECTORY:
>     245         return load_package(name, filename)
> 
> /usr/lib64/python3.6/imp.py in load_dynamic(name, path, file)
>     341         spec = importlib.machinery.ModuleSpec(
>     342             name=name, loader=loader, origin=path)
> --> 343         return _load(spec)
>     344
>     345 else:
> 
> ImportError:
> /usr/local/lib64/python3.6/site-packages/GDAL-2.3.0-py3.6-linux-x86_64.egg/
> osgeo/_gdal.cpython-36m-x86_64-linux-gnu.so: undefined symbol:
> CPLGetErrorCounter

Sounds like either you lack the libgdal.so in your library search path, or it 
is an older version of it. You can tune that with LD_LIBRARY_PATH for example


-- 
Spatialys - Geospatial professional services
http://www.spatialys.com


More information about the gdal-dev mailing list