I am aware that this could be a duplicate topic but I am struggling for a several days. I upgraded QGIS from 2.8 to 2.18 and after that everything get broken. I couldn't use PostGIS extension on pgadmin3.

I figured out that there were a conflict with a libgdal1h: if installed, it removes other libraries used by PostGIS and vice versa.

I tried several tutorial about how to install QGIS, like for example:

How do I get and install the latest version of QGIS in Ubuntu?

Install QGIS 2.14 Essen on Ubuntu 16.04 Xenial

I tried every suggestion reported on line, like for example:



Where to find a version of libgeos-c1 compatible with libgeos-3.5.0?

QGIS install on Ubuntu 14.04 fails

Always, the reply of sudo apt-get install qgis python-qgis is:

The following packages have unmet dependencies:

python-qgis : Depends: python-qt4-sql but it is not installable
               Depends: python-qgis-common (= 1:2.14.8+20trusty-ubuntugis) but it is not going to be installed
               Depends: python-psycopg2 but it is not installable
               Depends: python-qscintilla2 but it is not installable
               Depends: python-jinja2 but it is not installable
               Depends: python-markupsafe but it is not installable
               Depends: python-pygments but it is not installable
               Depends: python-yaml but it is not installable
               Depends: python-pyspatialite but it is not installable
               Depends: libqgispython2.14.8 but it is not going to be installed
               Depends: libqgis-analysis2.14.8 but it is not going to be installed
               Depends: libqgis-core2.14.8 but it is not going to be installed
               Depends: libqgis-gui2.14.8 but it is not going to be installed
               Depends: libqgis-networkanalysis2.14.8 but it is not going to be installed
               Depends: libqgis-server2.14.8 but it is not going to be installed
               Recommends: liblwgeom-dev but it is not installable
 qgis : Depends: gdal-abi-2-1-0 but it is not installable
        Depends: libgdal20 (>= 2.0.1) but it is not installable
        Depends: libgeos-c1v5 (>= 3.4.2) but it is not installable
        Depends: libqgis-analysis2.14.8 but it is not going to be installed
        Depends: libqgis-app2.14.8 but it is not going to be installed
        Depends: libqgis-core2.14.8 but it is not going to be installed
        Depends: libqgis-gui2.14.8 but it is not going to be installed
        Depends: libqgis-networkanalysis2.14.8 but it is not going to be installed
        Depends: qgis-providers (= 1:2.14.8+20trusty-ubuntugis) but it is not going to be installed
        Depends: qgis-common (= 1:2.14.8+20trusty-ubuntugis) but it is not going to be installed
        Recommends: qgis-plugin-globe but it is not going to be installed
        Recommends: qgis-plugin-grass but it is not going to be installed
        Recommends: qgis-provider-grass but it is not going to be installed
E: Unable to correct problems, you have held broken packages.

I have removed all the packages and the libraries so I do not have any library related to postgis, postgres and QGIS with the Synaptic Package Manager and all with the commands:

sudo apt-get purge qgis
sudo apt-get autoremove qgis
sudo apt-get --purge remove qgis
sudo apt-get update

But the problem is not solved yet.

I tried to remove the repo of ubuntugis and/or debian on the file /etc/apt/sources.list.


And I do not understand why, using this source http://qgis.org/ubuntugis/ I still have issues about the dipendences.

What should I do?

I am planning to format my laptop hoping this will help me with broken packages.. for the broken packages, I have already tried:

sudo apt-get update –fix-missing
sudo apt-get install -f

but nothing fixed.

  • what version of Ubuntu are you using? – DPSSpatial_BoycottingGISSE Nov 14 '16 at 18:42
  • I have Ubuntu 14.04 trusty – Glori P. Nov 15 '16 at 8:11
  • Instead of formatting your PC, try a virtual machine with a clean copy of Ubuntu. Saves you a lot of transition work, and you can always step back. – AndreJ Nov 15 '16 at 12:53

10 Answers 10


I encountered similar problems when updating from QGIS 2.16 to 2.18.

Try this workaround, that finally worked for me:

In the error message, look out for the lines

Depends: ... but it is not installable

Before installing qgis, you may need to install those packages manually one by one. If they install, try again to install QGIS, with some or all broken dependencies solved.

It might help to stick to the debian or ubuntugis repo, but avoid to install packages from both.

In my case, it was gdal that blocked the proper installation of QGIS.

UPDATE from comments

It seems that GDAL version conflicts avoid the proper installation.

According to http://postgis.net/install/ you have three choices for Postgis on Ubuntu:

This gives you postgis 2.2 compiled for Postgres 9.3. You can get QGIS 2.14.3 from the same repo, or use http://qgis.org/ubuntugis for QGIS 2.18.0 or 2.14.8. You will get GDAL 2.1.0 with that. This seems to be the best choice currently.

The one you used, but not compatible with QGIS from ubuntugis.

They offer Postgis 2.1.4, 2.2.2 and 2.3.0. You can get QGIS LTR from there too, or use http://qgis.org/debian for 2.18.0, compiled against GDAL 1.10 for trusty and GDAL 1.11.3 for xenial.

They offer Postgis 2.1.2 for Postgres 9,3, built with libgdal1h (GDAL 1.10.1) for trusty. The xenial package is Postgis 2.2.1 compiled against libgdal1i (GDAL 1.11.3). If you install QGIS from http://qgis.org/debian or http://qgis.org/debian-ltr, you get QGIS 2.18.0 or 2.14.8 compiled against the same GDAL versions for trusty and xenial.

You get broken dependencies if you try to combine packages from different sources, so DON'T DO IT.

  • I have problems with gdal too: which repo did you use for installing this library? – Glori P. Nov 15 '16 at 9:24
  • I have Linux Mint and Ubuntu running in parallel, using debian and ubuntugis unstable ppa. You can watch packages.debian.org/cgi-bin/… and launchpad.net/~ubuntugis/+archive/ubuntu/ubuntugis-unstable for current packages. – AndreJ Nov 15 '16 at 12:19
  • BTW debian repo on Linux Mint 18 is running with GDAL 1.11.3, and ubuntugis ppa on Ubuntu 16.04 with GDAL 2.1.0. Both use the xenial dist repo. You might run apt list --installed | grep gdal to see what is installed on your computer. – AndreJ Nov 15 '16 at 12:43
  • Just checked QGIS LTR 2.14.5 on Linux Mint 17.3: Ubuntu repo, trusty distro with ubuntugis unstable ppa running with GDAL 2.1.0. Update to 2.14.8 requires to update the key, and running sudo apt-get install qgis manually after sudo apt-get update and upgrade. – AndreJ Nov 15 '16 at 13:44
  • So It'd be better to not use the ppa but only stable version repos available here qgis.org/en/site/forusers/alldownloads.html#debian-ubuntu ? and it'd be better to install qgis from the terminal and not from Synaptic Package Manager ? – Glori P. Nov 15 '16 at 16:13

I had faced a similar problem installing qgis. I finally got it installed using aptitude package manager.

Try this first:

sudo apt-get update then sudo apt-get -f install.

If that doesn't work try the higher level package manager aptitude.

sudo aptitude install qgis python-qgis qgis-plugin-grass

It gives multiple solutions like this and you can select one.

Accept this solution? [Y/n/q/?] n
The following actions will resolve these dependencies:

      Downgrade the following packages:                                                                    
1)      libqt4-declarative [4:4.8.7+dfsg-7ubuntu1~xenialoverlay1~1 (now) -> 4:4.8.7+dfsg-5ubuntu2 (xenial)]
2)      libqt4-network [4:4.8.7+dfsg-7ubuntu1~xenialoverlay1~1 (now) -> 4:4.8.7+dfsg-5ubuntu2 (xenial)]    
3)      libqt4-opengl [4:4.8.7+dfsg-7ubuntu1~xenialoverlay1~1 (now) -> 4:4.8.7+dfsg-5ubuntu2 (xenial)]     
4)      libqt4-script [4:4.8.7+dfsg-7ubuntu1~xenialoverlay1~1 (now) -> 4:4.8.7+dfsg-5ubuntu2 (xenial)]     
5)      libqt4-sql [4:4.8.7+dfsg-7ubuntu1~xenialoverlay1~1 (now) -> 4:4.8.7+dfsg-5ubuntu2 (xenial)]        
6)      libqt4-sql-sqlite [4:4.8.7+dfsg-7ubuntu1~xenialoverlay1~1 (now) -> 4:4.8.7+dfsg-5ubuntu2 (xenial)] 
7)      libqt4-svg [4:4.8.7+dfsg-7ubuntu1~xenialoverlay1~1 (now) -> 4:4.8.7+dfsg-5ubuntu2 (xenial)]        
8)      libqt4-xml [4:4.8.7+dfsg-7ubuntu1~xenialoverlay1~1 (now) -> 4:4.8.7+dfsg-5ubuntu2 (xenial)]        
9)      libqt4-xmlpatterns [4:4.8.7+dfsg-7ubuntu1~xenialoverlay1~1 (now) -> 4:4.8.7+dfsg-5ubuntu2 (xenial)]
10)     libqtcore4 [4:4.8.7+dfsg-7ubuntu1~xenialoverlay1~1 (now) -> 4:4.8.7+dfsg-5ubuntu2 (xenial)]        
11)     libqtdbus4 [4:4.8.7+dfsg-7ubuntu1~xenialoverlay1~1 (now) -> 4:4.8.7+dfsg-5ubuntu2 (xenial)]        
12)     libqtgui4 [4:4.8.7+dfsg-7ubuntu1~xenialoverlay1~1 (now) -> 4:4.8.7+dfsg-5ubuntu2 (xenial)]         

Accept this solution? [Y/n/q/?] y
The following packages will be DOWNGRADED:
  libqt4-declarative libqt4-network libqt4-opengl libqt4-script libqt4-sql libqt4-sql-sqlite libqt4-svg libqt4-xml libqt4-xmlpatterns libqtcore4 libqtdbus4 libqtgui4 
The following NEW packages will be installed:
  libdrm-dev{a} libfcgi0ldbl{a} libgl1-mesa-dev{a} libglade2-0{a} libglu1-mesa-dev{a} libjs-jquery-ui{a} libjs-leaflet{a} liblwgeom-dev{a} libqca2{a} libqca2-plugin-ossl{a} libqca2-plugins{a} 
  libqgis-analysis2.18.3{a} libqgis-app2.18.3{a} libqgis-core2.18.3{a} libqgis-customwidgets{a} libqgis-gui2.18.3{a} libqgis-networkanalysis2.18.3{a} libqgis-server2.18.3{a} libqgisgrass7-2.18.3{a} 
  libqgispython2.18.3{a} libqjson0{a} libqt4-dbus{a} libqt4-designer{a} libqt4-dev{a} libqt4-dev-bin{a} libqt4-help{a} libqt4-opengl-dev{a} libqt4-qt3support{a} libqt4-scripttools{a} libqt4-test{a} 
  libqtassistantclient4{a} libqwt5-qt4{a} libspatialindex4v5{a} libx11-xcb-dev{a} libxcb-dri2-0-dev{a} libxcb-dri3-dev{a} libxcb-glx0-dev{a} libxcb-present-dev{a} libxcb-randr0-dev{a} libxcb-render0-dev{a} 
  libxcb-shape0-dev{a} libxcb-sync-dev{a} libxcb-xfixes0-dev{a} libxdamage-dev{a} libxext-dev{a} libxfixes-dev{a} libxshmfence-dev{a} libxxf86vm-dev{a} mesa-common-dev{a} python-cycler{a} python-dateutil{a} 
  python-future{a} python-gdal{a} python-glade2{a} python-httplib2{a} python-jinja2{a} python-markupsafe{a} python-matplotlib{a} python-matplotlib-data{a} python-pygments{a} python-pyparsing{a} 
  python-pyspatialite{a} python-qgis python-qgis-common{a} python-qscintilla2{a} python-qt4{a} python-qt4-sql{a} python-shapely{a} python-sip{a} python-tz{a} python-yaml{a} qdbus{a} qgis qgis-common{a} 
  qgis-plugin-grass qgis-plugin-grass-common{a} qgis-provider-grass{a} qgis-providers{a} qgis-providers-common{a} qt4-designer{a} qt4-linguist-tools{a} qt4-qmake{a} x11proto-damage-dev{a} 
  x11proto-dri2-dev{a} x11proto-fixes-dev{a} x11proto-gl-dev{a} x11proto-xext-dev{a} x11proto-xf86vidmode-dev{a} 
The following packages are RECOMMENDED but will NOT be installed:
0 packages upgraded, 88 newly installed, 12 downgraded, 0 to remove and 57 not upgraded.

The following worked for me on Ubuntu 16.04 and QGIS 2.18:

sudo apt remove *qgis*
sudo apt purge *qgis*


sudo apt update
sudo apt install qgis python-qgis 

Following the Answer by AndreJ, which mentions the conflicts from different reps, I deleted the lines deb http://qgis.org/ from the sources.list, you can do that through nano, which is an editor you run on the terminal, and leave only the following linesdeb http://ppa.launchpad.net/ubuntugis/ubuntugis-unstable/ubuntu trusty main:

sudo nano /etc/apt/sources.list

this opens the editor, just delete the qgis.org lines, exit through "Ctrl + x" and save; the file should look like this

#deb cdrom:[Linux Mint 17.1 _Rebecca_ - Release i386 20141126]/ trusty contrib $
deb http://ppa.launchpad.net/ubuntugis/ubuntugis-unstable/ubuntu trusty main

then sudo apt-get update and sudo apt-get install qgis

  • The ubuntugis way does not work anymore, because the ubuntugis unstable ppa has dropped any trusty packages. – AndreJ May 21 '19 at 5:50
  • This is the only approach that worked for me in early 2021, though I did also run sudo apt remove *qgis* and sudo apt purge *qgis*. After that, not only did I get an updated version, 2.8 to 3.4, but all my add-ons and recent projects were still in place (which makes you wonder about the purge step above :-)). – John Powell Feb 23 at 9:25

I think the trick is to have both ubuntugis and ubuntugis-unstable added to your repositories list.

I then installed gdal 2.1.0 (I needed GeoPackage support, so I don't know if this is essential), from that starting point I can install postgis-2.2.2 and qgis 2.18 quite happily.

  • 1
    Just to clarify, you propose http://qgis.org/ubuntugis and http://ppa.launchpad.net/ubuntugis/ubuntugis-unstable/ubuntu. There is currently some work on moving ubuntugis unstable content to ubuntugis stable, so future users may stumble over this. – AndreJ Nov 15 '16 at 12:51

As @AndreJ suggested, I created a new Virtual machine completely clean. I successfully installed QGIS 2.14 and Postgresql 9.6.

All the steps and the comments are reported on that gist:


The issue seems to be related only with PostGis: trying to install these packages:


one by one unistalled QGIS: it seems to be an issue with libgdal1h and libgdal1 (see libgdal1 and libgdal1h conflict) and I remember that these 3 libraries brought me to the initial conflict between qgis postgresql and postgis.

I found an interesting repo about that:


What should I do to fix that problem? what do you suggest?

  • launchpad.net/~ubuntugis/+archive/ubuntu/ubuntugis-unstable/… has postgis 2.2 available. Why do you try version 2.3, and from where? – AndreJ Nov 17 '16 at 6:51
  • is it that one: deb ppa.launchpad.net/ubuntugis/ubuntugis-unstable/ubuntu trusty main ? if it is I used that one for the fetch – Glori P. Nov 17 '16 at 10:26
  • No, look into your gist under sudo apt-cache policy postgis. It is taken from http://apt.postgresql.org/pub/repos/apt/ trusty-pgdg/main amd64 Packages. – AndreJ Nov 17 '16 at 10:48
  • you are right, I uncommet that repo and I did: sudo add-apt-repository ppa:ubuntugis/ubuntugis-unstable & sudo apt-get update & sudo apt-get install postgresql-9.3-postgis-2.2 . But the output was The following packages have unmet dependencies: postgresql-9.3-postgis-2.2 : Depends: libgdal1h (>= 1.9.0) but it is not going to be installed Depends: libgeos-c1 (>= 3.4.2) but it is not going to be installed E: Unable to correct problems, you have held broken packages. – Glori P. Nov 17 '16 at 10:55
  • That package seems still to be the wrong one. In the ppa folder ppa.launchpad.net/ubuntugis/ubuntugis-unstable/ubuntu/dists/… Packages.gz file I see : Version: 2.2.2+dfsg-2~trusty0 and Depends: libc6 (>= 2.14), libgdal20 (>= 2.0.1). – AndreJ Nov 17 '16 at 11:06

I am planning to format my laptop hoping this will help me with broken packages.. for the broken packages

... If you are prepared to go this far, you might as well try to upgrade first to the latest Ubuntu LTS 16.04, which has more update repositories for many GIS packages. In 16.04, I tested the following to upgrade to the latest QGIS 2.18 without a problem:

  1. remove QGIS & remove anything existing GIS-related entries in /etc/apt/sources.list

    sudo apt-get remove qgis --purge
    sudo apt-get autoremove --purge
  2. add the following two lines to /etc/apt/sources.list:

    deb http://qgis.org/debian xenial main
    deb-src http://qgis.org/debian xenial main
  3. add QGIS repository

    sudo apt-key adv --keyserver keyserver.ubuntu.com --recv-keys 073D307A618E5811
    #note, 073D307A618E5811 is the public key for the specific qgis repo here.
    sudo apt-add-repository add  http://qgis.org/debian
    #note, may require `sudo apt-get install software-properties-common` first
  4. install QGIS:

    sudo apt-get update
    sudo apt-get install qgis
  • He's not using Xenial. He's using 14.04 (trusty) – Evan Carroll Nov 14 '16 at 19:50
  • @EvanCarroll The OP also mentions Xenial. – tinlyx Nov 14 '16 at 21:27
  • only in reference to another question, he's not using xenial. He tells you explicitly what he's using. – Evan Carroll Nov 14 '16 at 21:55
  • @EvanCarroll But it is not only in reference to another question. Quoting the OP, I tried several tutorial about how to install QGIS ... Install QGIS 2.14 Essen on Ubuntu 16.04 Xenial. – tinlyx Nov 15 '16 at 1:02
  • @EvanCarroll Yes, I have Ubuntu 14.04. I followed some tutorial for Xenial too changing the reference from Xenial to Trusty and trying a way to install all the softwares I needed. – Glori P. Nov 15 '16 at 8:19

Its very simple... make sure you uncomment the sources repositories from the source list. etc/apt/sources/sourcelists

Make sure you only comment the CDROM option only and leave the other lists uncommented.


@AndreJ's answer is still correct, but here is a summarized (and perhaps more current) version for those who just want to install qgis 2.18 with a specific gdal version:

Use/enable only one of the following ppas:

# Option A: contains qgis 2.18.25 but locks you to gdal 1.x
deb http://qgis.org/ubuntu-ltr trusty main

# Option B: contains qgis 2.18.16 and gdal 2.2 - this is probably what most people are looking for
deb http://qgis.org/ubuntugis trusty main

Explanation: If both ppas are enabled (as of today), the dependencies associated with Option A will be picked (since it has the slightly more updated version of qgis 2.18), making it very difficult to install gdal 2.x (which really has to be done via Option B). It is not easy to upgrade directly from one option to the other since they really represent two rather different sets of dependencies that are mutually exclusive.


Try to install via flatpak

flatpak install --user https://flathub.org/repo/appstream/org.qgis.qgis.flatpakref

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.