3

I just reinstalled my python environment (and my whole Ubuntu).

In python (or IPython), when loading geopandas:

import geopandas as gpd

or when I import fiona:

import fiona

I get this error message:

ImportError: /usr/lib/libgdal.so.1: undefined symbol: sqlite3_column_table_name

I have found quite similar requests (here, or here) but none answered my problem. Any advice?

0

There are two problems:

1) you import Fiona twice because GeoPandas use Fiona for reading/writing shapefiles

grep -nr "fiona" *.py
geocode.py:4:from fiona.crs import from_epsg
geodataframe.py:259:        >>> import fiona
geodataframe.py:260:        >>> fiona.supported_drivers
geodataframe.py:269:        The *kwargs* are passed to fiona.open and can be used to write 
geodataframe.py:272:        import fiona
geodataframe.py:302:        with fiona.open(filename, 'w', driver=driver, crs=self.crs, 
geoseries.py:67:            http://toblerity.github.io/fiona/README.html#usage
geoseries.py:70:            These arguments are passed to fiona.open, and can be used to 
geoseries.py:75:        import fiona
geoseries.py:77:        with fiona.open(filename, **kwargs) as f:
geoseries.py:222:        from fiona.crs import from_epsg

2) GeoPandas use also Shapely

$ grep -nr "shapely" *.py
base.py:3:from shapely.geometry import MultiPoint, MultiLineString, MultiPolygon
base.py:4:from shapely.geometry.base import BaseGeometry
base.py:5:from shapely.ops import cascaded_union, unary_union
base.py:6:import shapely.affinity as affinity
base.py:308:        See shapely manual for more information:
base.py:309:        http://toblerity.org/shapely/manual.html#affine-transformations
base.py:333:        See shapely manual for more information:
base.py:334:        http://toblerity.org/shapely/manual.html#affine-transformations
base.py:356:        See shapely manual for more information:
base.py:357:        http://toblerity.org/shapely/manual.html#affine-transformations
base.py:381:        See shapely manual for more information:
base.py:382:        http://toblerity.org/shapely/manual.html#affine-transformations
geocode.py:7:from shapely.geometry import Point
geodataframe.py:13:from shapely.geometry import mapping, shape
geodataframe.py:14:from shapely.geometry.base import BaseGeometry
geoseries.py:7:from shapely.geometry import shape, Polygon, Point
geoseries.py:8:from shapely.geometry.collection import GeometryCollection
geoseries.py:9:from shapely.geometry.base import BaseGeometry
geoseries.py:10:from shapely.ops import transform
geoseries.py:29:    """A Series object designed to store shapely geometry objects."""

And with the older versions of the modules, there is an error if you import Fiona before Shapely. This problem has been solved.

What happens if you import only GeoPandas or only Fiona ?

New

There are posts in the Fiona issues. You need to recompile Fiona with the adequate tags (Fiona import error: undefined symbol: __intel_sse2_strlen

It seems that your system does not recognise the results of gdal_config

You need :

gdal-config --libs
-L/usr/lib/libgdal.so.1 -lgdal 
gdal-config --cflags
-I/usr/include/gdal

1) compile the extensions

python setup.py build_ext -I/usr/include/gdal -L/usr/lib/libgdal.so.1 -lgdal 

2) (build and) install Fiona

python setup.py build
python setup.py install

If that does not work, it is problem of GDAL/OGR

5
  • 1
    My problem happens if I import only one of the two packages. Whatever the package. It is not about the tow packages. I will rephrase my question accordingly. – user2076688 Jun 22 '16 at 15:24
  • look above (New) – gene Jun 22 '16 at 15:39
  • The Fiona issues are not solved but only closed as "not a Fiona issue". I recompiled Fiona with python setup.py build_ext -I /usr/include/gdal -L /usr/lib/libgdal.so.1 -lgdal install --prefix=~/.local/ Now the error has moved from: ImportError: /usr/lib/libgdal.so.1: undefined symbol: sqlite3_column_table_name to: ImportError: /usr/lib/libgdal.so.20: undefined symbol: sqlite3_column_table_name (changing only libgdal.so.1 to libgdal.so.20). Any advice ? – user2076688 Jun 22 '16 at 16:40
  • again look above – gene Jun 22 '16 at 17:07
  • Thanks a lot for your help! I reinstalled it with conda instead of pip and now it works... – user2076688 Jun 23 '16 at 10:01
0

I had previously installed fiona using pip.

I just reinstalled it using conda :

 conda install -c anaconda fiona=1.6.0

It solved my problem.

0

I had the same issue just recently, 1 year after this post has been published and I though it might be because of geopandas versions being very longterm and stable while fiona being upgraded very often.

So, I installed a bit later version, as I had the version Fiona-1.7.11.post2, I simply checked one without extra letters.

pip install --upgrade fiona==1.7.11

It did the job. Though not sure if that is the solution, but I didn't have conda and didn't want to get it only for that.

0

As a note for spack/module users: after installing fiona

spack install py-fiona

You should load both the modules for py-fiona and gdal (if using module load) to avoid getting the ImportError: libgdal.so.26.

gdal should also have been automatically installed as a dependency of fiona.

-1

Try the following which worked for me when I had the same problem.

anaconda3/bin/pip install --upgrade fiona

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.