5

I have been looking at this for a couple days now but I have not found a solution yet.

I am trying to install Postgresql-13-postgis-3 in my ubuntu 18.04 machine. Currently I have Postgresql 13 and libgdal26 (GDAL 3.0.4) installed; libgdal26 is compatible with my QGIS install (3.10). When I try to install Postgis, I get the following error:

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. postgis : Depends: libgdal20 (>= 2.0.1) but it is not going to be installed postgresql-13-postgis-3 : Depends: libgdal20 (>= 2.0.1) but it is not going to be installed E: Unable to correct problems, you have held broken packages.

So then I try to install libgdal20, but it asks to remove many packages, including qgis and libgdal26 (I need to work with both, qgis and postgis, so removing qgis, etc, is not an option). Is there any way to install postgis using gdal 3.x ? It seems so according to their documentation, but my system won't allow me. Other user seem to have similar problems (see install postgis on ubuntu 18.04 after upgrading gdal to 3.0.4) but no solution was posted (I tried to directly ask in this post, but by question was deleted).

In the meantime I manage to continue working using a windows machine. I was able to install everything, one shot, and work. GIS software (qGIS and GDAl particularly ) in ubuntu so far has given be much trouble with unmet dependencies... has even make me thought about switching OS! Too bad I know...

Any help is greatly appreciated!

2 Answers2

3

There is a conflict of dependency here. One solution is to wait until the maintainers update the dependencies (or maybe upgrade to newer 20.04 LTS of Ubuntu).

Another solution is to compile PostGIS from source, which isn't very complex. Using the latest version of PostGIS as an example, you can:

wget https://download.osgeo.org/postgis/source/postgis-3.1.2.tar.gz
tar xf postgis-3.1.2.tar.gz
cd postgis-3.1.2
./configure
make && sudo make uninstall && sudo make install

then restart the server.

tinlyx
  • 3,328
2

I had a similar issue. Without having to update the OS, I had to:

  1. Remove the distribution cmake and install the latest one, 3.21.3.

  2. Compile/Install CGAL 5.3.

  3. Compile/Install SFCGAL 1.4 (the latest cmake was needed to compile this).

  4. Compile/Update GEOS to 3.8.2.

  5. Install the following libs:

    sudo apt install protobuf-c-compiler libjsoncpp-dev libprotobuf-dev libprotobuf-c-dev libxml2-dev
    

    This is not a complete list of dependencies but is a pretty good start.

Cal Abel
  • 21
  • 1