Maaz Zindani

Loading the index…

↑↓ move↵ openesc close4072 pages
Servers, nginx and Docker

apt cannot install qt5-default on Ubuntu 22.04 and later

ErrorE: Package 'qt5-default' has no installation candidate

Short answer

qt5-default no longer exists in Ubuntu 22.04 or later, so apt cannot install it. Install the development package for the Qt version you need instead: qtbase5-dev for Qt 5 or qt6-base-dev for Qt 6. Both live in the universe repository, so universe must be enabled.

  • Applies to Ubuntu 22.04, Ubuntu 24.04
  • Updated
  • By Maaz Zindani, Senior Software Engineer

Fix it fast

  1. 1Find out which cause you have

    Ask apt whether it knows the Qt 5 base development package. If it does, the old package name was the whole problem.

    apt-cache policy qtbase5-dev qt6-base-dev
  2. 2Match what you see, then jump to its fix

    1. 1The same command worked on Ubuntu 20.04 or in an old tutorialqt5-default was removed from UbuntuFix
    2. 2The build files or README mention Qt6, find_package(Qt6) or qt6The project is meant for Qt 6, not Qt 5Fix

What does the error look like?

  • E: Package 'qt5-default' has no installation candidate
  • Problem installing qt5-default on Ubuntu 22.04

Cause 1 of 2

qt5-default was removed from Ubuntu

1Check

Search the Ubuntu package archive for the name. For every Ubuntu release it returns no result, including 22.04 (jammy). The Qt 5 development files are in qtbase5-dev, version 5.15.3 on 22.04.

apt-cache search qtbase5-dev

2Fix

Install the package that matches the tool you build with. qtbase5-dev gives the Qt 5 base development files, and qtbase5-dev-tools the Qt 5 base development programs.

sudo apt install qtbase5-dev qtbase5-dev-tools

3Verify

apt reports both packages as installed.

dpkg -s qtbase5-dev | head -n 3

Confirmed by packages.ubuntu.com

Did this fix it?

Cause 2 of 2

The project is meant for Qt 6, not Qt 5

1Check

Installing Qt 5 for a Qt 6 project only moves the error. Ubuntu 22.04 provides Qt 6 development files in qt6-base-dev, version 6.2.4.

grep -ri 'qt6\|Qt5' CMakeLists.txt *.pro 2>/dev/null | head

2Fix

Install the Qt 6 base development package for a Qt 6 project.

sudo apt install qt6-base-dev

3Verify

apt reports the package as installed.

dpkg -s qt6-base-dev | head -n 3

Confirmed by packages.ubuntu.com

Did this fix it?

How do I stop it coming back?

  • Read the Qt major version a project targets before choosing packages.
  • Treat install lines in older tutorials as hints and check each name with apt-cache policy.
  • Both Qt development packages are in the universe component, so keep universe enabled on Ubuntu.

Sources

How was this page made?

I drafted this page with AI assistance from the official documents listed under Sources. Every cause above names the document that confirms it. I have not reproduced this fix on a machine of my own yet, so read it as documented guidance, not a test report. Found a mistake? Tell me.

Which stack is behind this page?

Related fixes

Servers

dnf cannot install MySQL on Amazon Linux 2023

dnf cannot find a mysql-server package on Amazon Linux 2023

Amazon Linux 2023 documents MariaDB, not MySQL, as its database server, with packages named mariadb105 and mariadb105-server.

3 causes, each with a fix

Next step

Want this handled for good?

I look after servers, apps and releases end to end. Tell me what keeps breaking.