4

I am attempting to install QGIS 3.0 on Ubuntu 16.04 and am failing. Outlined below are the steps I've taken to install and troubleshoot this failure. If anyone has any tips on how to troubleshoot this further, I would be greatly appreciative.

I previously had QGIS 2.18 installed. Prior to my attempt to install QGIS 3.0, I uninstalled QGIS 2.18 by running sudo apt-get purge --auto-remove qgis. I then ran sudo apt-get install qgis and received the following output:

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:
 qgis : Depends: python-qgis (= 1:3.0.0+24xenial-ubuntugis) but it 
 is not going to be installed
        Depends: qgis-providers (= 1:3.0.0+24xenial-ubuntugis) but it 
        is not going to be installed
        Recommends: qgis-plugin-grass but it is not going to be installed
 E: Unable to correct problems, you have held broken packages.

I am attempting to install from http://qgis.org/ubuntugis xenial main. As I understand this is currently the only repository with a QGIS 3.0 package built. At the moment I'd be happy with a 2.x version so I did the following:

  1. Removed deb http://qgis.org/ubuntugis xenial main and deb-src http://qgis.org/ubuntugis xenial main from /etc/apt/sources.list.
  2. Added deb http://qgis.org/debian xenial main and deb-src http://qgis.org/debian xenial main to /etc/apt/sources.list.
  3. Saved /etc/apt/sources.list.
  4. sudo apt-get purge
  5. sudo apt-get update
  6. sudo apt-get install qgis

This produced a similar result as before. Some packages could not be installed... and then:

The following packages have unmet dependencies:
 qgis : Depends: python-qgis (= 1:2.18.16+24xenial) but it is not
        going to be installed
E: Unable to correct problems, you have held broken packages.

I followed the same 6-step process above to switch to deb http://ppa.launchpad.net/ubuntugis/ubuntugis-unstable/ubuntu xenial main, again with a similar result:

The following packages have unmet dependencies:
 qgis : Depends: python-qgis (= 2.14.22+dfsg-1~xenial2) but it is not 
        going to be installed
E: Unable to correct problems, you have held broken packages.

I have attempted to attack this using the recommendations found here:

  • sudo apt-get clean
  • sudo apt-get autoclean
  • Attempt to fix broken dependencies:
    • sudo apt-get -f install
    • sudo dpkg --configure -a
    • sudo apt-get -f install
    • Result: 0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.
      • I understand this to mean that no broken dependencies were fixed.
  • Remove held packages:
    • sudo apt-get -u dist-upgrade
      • Result: 0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.
    • sudo apt-get -o Debug::pkgProblemResolver=yes dist-upgrade
      • Result: `0 upgraded, 0 newly installed, 0 to remove and 0 not
    • I understand these results to mean that no held packages were found or removed.

I also attempted to find the broken held packages by running dpkg --get-selections | grep hold. This returned nothing which I understand might mean this is not actually a broken held packages issue.

Does anyone have a recommendation on how to resolve this broken held records issue or any tips on how to troubleshoot this problem further?

UPDATE 1 I did manage to get QGIS 2.8 installed via aptitude but have been unable to upgrade to QGIS 3.

UPDATE 2 Tried to follow the guide that brianbancroft posted and am still getting the same error about held broken packages. I have also just tried installing the packages listed in the error individually, but I just keep running into a chain of unmet dependencies until I eventually get to a point where a package has no installation candidate. For example, in my latest error, after running sudo apt-get install python-qgis-common, I get:

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:
python-qgis-common : Depends: python3-gdal but it is not going to be 
installed
E: Unable to correct problems, you have held broken packages.

So I tried running sudo apt-get install python3-gdal. This yielded:

The following packages have unmet dependencies:
 python3-gdal : Depends: gdal-abi-2-2-1
E: Unable to correct problems, you have held broken packages.

I then ran sudo apt-get install gdal-abi-2-2-1, which finally yielded:

Package gdal-abi-2-2-1 is a virtual package provided by:
  libgdal20 2.2.1+dfsg-2build3 [Not candidate version]

E: Package 'gdal-abi-2-2-1' has no installation candidate

Interestingly, I went through this process of trying to install dependencies for python-qgis and qgis and eventually ended up at E: Package 'gdal-abi-2-2-1' has no installation candidate.

I have to admit, I'm a bit lost on this...

  • You did not remove the unwanted packages: askubuntu.com/questions/187888/… – AndreJ Feb 26 '18 at 18:16
  • Thanks for your suggestion. I followed the suggestions from the link you included and am getting the same results. – maptastik Feb 28 '18 at 4:42
  • You definitely need deb http://qgis.org/ubuntugis xenial main and deb http://ppa.launchpad.net/ubuntugis/ubuntugis-unstable/ubuntu xenial main together in your sources list, and debian xenial removed. – AndreJ Feb 28 '18 at 7:17
  • 1
    From your update2, I guess you are now on Ubunzu 17.10 artful. That has a package gdal 2.2.1 in the main repo. If you have libgdal20 version 2.2.2 from ubuntugis xenial, you have to remove and purge that, and downgrade to 2.2.1. – AndreJ Mar 3 '18 at 6:21
  • 1
    @AndreJ: That was it! I did just what you said and now I am happily using QGIS 3.0 on my Ubuntu machine. – maptastik Mar 3 '18 at 6:29
1

Currently, deb https://qgis.org/ubuntugis xenial main is the only option that worked for me to get QGIS 3.0 on Ubuntu 16.04. See, e.g. my related question installing QGIS 3.0 on Ubuntu? and the discussions therein.

Debian repo stopped updating a long time ago due to dependency issues (about GDAL).

  • Got it. It seems then there's some overarching dependency issue, because regardless of what version I try to install or what repo I try to install from, I get some version of: qgis : Depends: python-qgis (= <some version of python-qgis>) but it is not going to be installed E: Unable to correct problems, you have held broken packages. – maptastik Feb 26 '18 at 13:31
  • What do you get if you run sudo apt-cache policy python-qgis and sudo apt-get install python-qgis? – AndreJ Feb 28 '18 at 7:10
  • $ sudo apt-cache policy python-qgis python-qgis: Installed: (none) Candidate: 1:3.0.0+27artful Version table: 1:3.0.0+27artful 500 500 https://qgis.org/debian artful/main amd64 Packages 2.14.18+dfsg-1 500 500 http://us.archive.ubuntu.com/ubuntu artful/universe amd64 Packages – maptastik Mar 3 '18 at 6:13
  • $ sudo apt-get install python-qgis ... 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: – maptastik Mar 3 '18 at 6:18
  • (Continued from previous response) The following packages have unmet dependencies: ` python-qgis : Depends: python-qgis-common (= 1:3.0.0+27artful)` but it is not going to be installed Depends: libqgis-analysis3.0.0 but it is not going to be installed Recommends: liblwgeom-dev but it is not going to be installed E: Unable to correct problems, you have held broken packages. – maptastik Mar 3 '18 at 6:18
1

While this isn't a solution for 16.04, I was able to install QGIS 3 this morning after I upgraded to Artful Aardvark (17.10) out of frustration. The following from is the instruction set which I used:

First, update the list of repositories. From terminal, use vim (or your favourite editor) to update the list:

sudo vi /etc/apt/sources.list

In vim, add the following lines:

deb http://qgis.org/debian artful main

deb-src http://qgis.org/debian artful main

Yes, use the debian as opposed to ubuntugis. ubuntugis doesn't contain what you need for artful. At this point, install the public key (unless you really want version 2.18) from the default Ubuntu repository. In terminal:

wget -O - https://qgis.org/downloads/qgis-2017.gpg.key | gpg --import

gpg --fingerprint CAEB3DC3BDF7FB45

gpg --export --armor CAEB3DC3BDF7FB45 | sudo apt-key add -

At this point, you should be ready to install. In terminal:

sudo apt-get update

sudo apt-get install qgis python-qgis qgis-plugin-grass

At some point without further prompt, you should have QGIS installed. Happy mapping!

Note that I copied this instruction set in the event that the blog which outlined this solution may shut down in the future. I did not come up with the solution myself.

  • If you don't want to upgrade your OS, you can put ubuntu artful in a virtual box, and install QGIS in there. With shared folders you can still access your data on the host OS. – AndreJ Mar 2 '18 at 12:36
  • Thanks for sharing this. Tried upgrading, but still getting the same errors :-/ – maptastik Mar 3 '18 at 5:40
0

Despite implementing many tips found on the Internet I couldn't get QGIS to install on Ubuntu 16.04 until I came across this short and helpful video: https://www.youtube.com/watch?v=hmJwYaYmRDU

Until then I was also struggling with messages about various "unmet dependencies" and "missing/broken packages" (hat tip to the video creator: Linux Enthusiast)

Here are the steps you need to follow in the terminal:

Step 1. Type in:

sudo nano /etc/apt/sources.list [press enter]

Step 2. Type in:

deb https://qgis.org/ubuntugis-ltr xenial main

deb-src https://qgis.org/ubuntugis-ltr xenial main    

deb http:/ppa.launchpad.net/ubuntugis-unstable/ubuntu/ubuntu xenial main

[Press Enter, and when prompted to "Save modified buffers", press y key]

Step 3. Type in:

wget -O - https://qgis.org/downloads/qgis-2017.gpg.key | gpg --import [press enter]

Type in:

gpg --fingerprint CAEB3DC3BDF7FB45 [press enter]

Step 4. Type in:

sudo apt-get update [press enter]

Step 5. Type in:

sudo apt-get install qgis-server python-qgis [press enter]

Do you want to continue? - [press y key]

Install these packages without verification? [press y key]

QGIS will then install and thereafter you will find it amongst your list of programs. Good luck, hope this helped.**

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.