I upgraded GDAL on my ubuntu 18.04 server to GDAL 3.0.4 and downgraded Postgres from 12 to 11

After finishing GDAL upgrade (gdal installtion done according to follow link Install GDAL Packages on Ubuntu ):

ogrinfo --version

Collecting GDAL==3.0.4

Status other GDAL packages after installation :

  1. LibGDAL

dpkg -l | grep libgdal

libgdal-dev 3.0.4+dfsg-1~bionic0 amd64 libgdal26 3.0.4+dfsg-1~bionic0 amd64

ldconfig -p | grep gdal

libgdal.so.26 (libc6,x86-64) => /usr/lib/libgdal.so.26 libgdal.so (libc6,x86-64) => /usr/lib/libgdal.so

  1. GdalDATA

dpkg -l | grep gdal-data

gdal-data 3.0.4+dfsg-1~bionic0 all

Now, when I try to install PostGIS sudo apt install postgis postgresql-11-postgis-3 on my fresh installed PostgresSQL 11.8 I getting following error:

The following packages have unmet dependencies: postgis : Depends: libgdal20 (>= 2.0.1) but it is not going to be installed Recommends: postgresql-12-postgis-3 but it is not going to be installed

Then I tried:

sudo apt install libgdal20

libgdal20 : Depends: gdal-data (>= 2.4.2+dfsg-1~bionic0) but it is not going to be installed E: Unable to correct problems, you have held broken packages.

UPDATE Steps I downgraded PostrgeSQL: Completely remove PostrgeSQL

  1. sudo apt-get --purge autoremove postgresql*

  2. sudo apt purge postgresql-client-common

  3. dpkg -l | grep postgres --> remove the rest of packages: sudo apt-get --purge remove <pkg_name>

Please help me to fix the error , I'm stuck here

  • From Error you received look like latest GDAL supports Postgres 12. It is dependency of latest GDAL. How did you downgrade from Postgres 12 to Postgres 11 ?
    – KK Patel
    Jun 9, 2020 at 8:58
  • @KKPatel Please see UPDATE
    – Toren
    Jun 9, 2020 at 9:11
  • 1
    I'm encountering the exact same issue. Seems PostGIS needs libgdal2 and after installing gdal 3 we I can't install libgdal2 Jul 6, 2020 at 19:20

1 Answer 1


As an alternative, you can compile from source as follows:

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
make && sudo make uninstall && sudo make install

I haven't tested this for PostgreSQL 11, but it works for 12 and gdal 3 if I recall.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .