6

This morning a number of Python scripts stopped functioning after a system upgrade. libgdal is no longer available, resulting in the following exception:

ImportError: libgdal.so.1: cannot open shared object file: No such file or directory

Trying to re-install the library by hand I am getting unmet dependencies regarding the libgeos-c1 package:

$ sudo apt install libgdal1h
Reading package lists... Done
Building dependency tree       
Reading state information... Done
Some packages could not be installed. This may mean that you have
requested an impossible situation or if you are using the unstable
distribution that some required packages have not yet been created
or been moved out of Incoming.
The following information may help to resolve the situation:

The following packages have unmet dependencies.
 libgdal1h : Depends: libgeos-c1 (>= 3.4.2) but it is not going to be installed
E: Unable to correct problems, you have held broken packages.

In fact libgeos-c1 can be installed, but it would force the downgrade of libgeos, which would remove pretty much all other GIS software from the system:

$ sudo apt install libgeos-c1
[sudo] password for desouslu: 
Reading package lists... Done
Building dependency tree       
Reading state information... Done
The following extra packages will be installed:
  libgeos-3.4.2
The following packages will be REMOVED
  gdal-bin grass-core libgdal20 libgeos-c1v5 liblas-c3 liblas3 liblwgeom-2.2-5
  liblwgeom-dev libopenscenegraph100v5 libosgearth3 libosgearthannotation3
  libosgearthfeatures3 libosgearthqt3 libosgearthsymbology3 libosgearthutil3
  libqgis-analysis2.14.3 libqgis-app2.14.3 libqgis-core2.14.3
  libqgis-customwidgets libqgis-gui2.14.3 libqgis-networkanalysis2.14.3
  libqgis-server2.14.3 libqgisgrass7-2.14.3 libqgispython2.14.3 libsfcgal1
  libspatialite5 openscenegraph-plugin-osgearth postgis
  postgresql-9.3-postgis-2.2 python-gdal python-pyspatialite python-qgis
  python-qgis-common python-shapely python3-gdal qgis qgis-plugin-globe
  qgis-plugin-grass qgis-provider-grass qgis-providers
The following NEW packages will be installed
  libgeos-3.4.2 libgeos-c1
0 to upgrade, 2 to newly install, 40 to remove and 0 not to upgrade.
Need to get 0 B/454 kB of archives.
After this operation, 218 MB disk space will be freed.
Do you want to continue? [Y/n] 

I have libgeos-3.5.0 installed from the UbuntuGIS PPA:

$ apt-cache policy libgeos-3.5.0
libgeos-3.5.0:
  Installed: 3.5.0-1~trusty1
  Candidate: 3.5.0-1~trusty1
  Version table:
 *** 3.5.0-1~trusty1 0
        500 http://ppa.launchpad.net/ubuntugis/ubuntugis-unstable/ubuntu/ trusty/main amd64 Packages
        100 /var/lib/dpkg/status

If I understand correctly, I need to find a version of the libgeos-c1 package that is compatible with libgeos-3.5.0. Would anyone know where I could get it?

1

There are two packages available (see http://packages.ubuntu.com/search?keywords=libgeos-c1):

libgeos-c1 version 3.4.2 from the main ubuntu (or debian) repo for trusty

libgeos-c1v5 version 3.5.0 from the main ubuntu repo for xenial, or from the ubuntugis ppa for trusty only.

Regarding GDAL, you can have

From the debian repo

libgdal1h 1.10.1 for stable
libgdal20 2.1.2 for testing and unstable 

From the main ubuntu repo

libgdal1h 1.10.1 for trusty
libgdal1i 1.11.3 for xenial
libgdal20 2.1.1 for yakkety

From the ubuntugis ppa (stable or unstable)

libgdal20 2.1.0 for trusty and xenial (no yakkety yet).

Mixing packages from these resources will result in broken dependencies, so you have to decide to go for one of these. The versions of libgeos and libgeos-c1 should match.

There was a package libgdal1h 1.11.2 in ubuntugis unstable for trusty, but since they updated to GDAL 2.1.0, it is no longer available. GDAL 1.11.3 is now in package libgdal1i, while libgdal1h is only available for version 1.10.1.

So your problem is not getting the right libgeos-c1, but getting the right libgdal (20) for the libgeos-c1v5 you already have from the ubuntugis ppa. You might need to update other software (QGIS, PostGIS) as well afterwards.

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.