4

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!

Gonzalob
  • 61
  • 2

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,132
  • 6
  • 34
  • 53
  • thank you so much! I will try these later today and let you know – Gonzalob Jun 08 '21 at 07:37
  • Hi, I have followed your advice and tried to compile from source. I get an error when compiling: `configure: error: unable to find protobuf-c/protobuf-c.h using CPPFLAGS. You can disable MVT and Geobuf support using --without-protobuf` . I have installed libprotoc10 (3.0.0-9.1ubuntu1), protobuf-c-compiler (1.2.1-2), protobuf-compiler (3.0.0-9.1ubuntu1) and protobuf-compiler-grpc (1.3.2-1.1~build1). Doesn't seem to fix the problem. Any ideas? Thanks – Gonzalob Jun 08 '21 at 13:12
  • @Gonzalob In that case, you may also need `apt install libprotobuf-dev` – tinlyx Jun 08 '21 at 14:13
  • great! that fixed it. I also had to ' sudo apt-get install postgresql-server-dev-13' looks like everything was installed fine. Thanks so much! – Gonzalob Jun 09 '21 at 17:03
  • @Gonzalob Sure, when header files such as protobuf-c/protobuf-c.h are missing, it's usually one of the dev lib's missing. – tinlyx Jun 09 '21 at 17:13
  • hi @tinlyx thanks for the tip. I didn't know .h files were headers, good to know! – Gonzalob Jun 11 '21 at 09:23
1

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.

BeastOfCaerbannog
  • 12,964
  • 10
  • 49
  • 77
Cal Abel
  • 11
  • 1