How to Install the Latest HPLIP Driver in Ubuntu 20.04 [Fix Dependency Issue]

Last updated: November 5, 2021 — 13 Comments

Need the most recent HPLIP to get your HP printer or scanner working in Ubuntu? Here’s how to install guide as well as workaround to fix the python-pyqt5 dependency issue.

HPLIP is an open-source Linux drivers for HP’s inkjet and laser printers. The project is initiated and led by HP Inc. While the package in Ubuntu repositories is always old, you can install the official binary to get new devices support.

However, the most recent releases refuse to install in my Ubuntu 20.04 due to python-pyqt5 dependency issue. If you’re facing with the similar issue, then this tutorial may help!

Download & Install HPLIP in Ubuntu 20.04

1.) Firstly, download the latest binary from the link below. It’s ‘‘ at the moment.

2.) Next, add executable permission by pressing Ctrl+Alt+T on keyboard to open terminal. Then run command:

chmod u+x ~/Downloads/hplip*.run

And try to install it via command:


Follow the terminal output and answer some questions to start installing the driver.

3.) Fix python-pyqt5 dependency issue.

As I said, it refuse to install in Ubuntu 20.04 because it tries to install old Python 2 binding for Qt5 as dependency in my case.

Thanks to Christoph Mueller, I found it has something to do with python symbolic links.

As you may know, python2 and python3 in /usr/bin are symbolic links. While python2 is python2.7, python3 links to python3.8 (or 3.9 depends on Ubuntu edition), python is not exist out-of-the-box. However, it will be created in some cases and links to either python2 or python3.

And the point is when Python links to Python2, HPLIP will mistakenly try to install Python 2 libraries as dependency.

Until HPLIP fixed the issue, the solution is either remove /usr/bin/python if you don’t need it or make it link to Python3.

Make Python to be Python3:

There are two choices to create symlink for python: install python-is-python3 or use update-alternatives command.

Option 1. Open terminal and run command to install ‘python-is-python3’:

sudo apt install python-is-python3

Option 2. Use ‘update-alternatives’ to choose which to link to. Firstly, add both python2 and python3 as alternatives:

sudo update-alternatives --install /usr/bin/python python /usr/bin/python2 1
sudo update-alternatives --install /usr/bin/python python /usr/bin/python3 2

You can then choose which to use anytime via command:

sudo update-alternatives --config python

Finally, re-do step 2.) to install the HPLIP-*.run file.

4.) Fix make command failed issue:

This seems to be HPLIP 3.21.6 only issue, that it outputs ‘error: make command failed with status code 2‘.

By re-running ‘make’ command from the source folder (see Uninstall section), it tells that “/usr/bin/ld: cannot find -lavahi-core”.

And it can be fixed by installing libavahi-core-dev package via command:

sudo apt install libavahi-core-dev

How to Remove HPLIP from Ubuntu:

While installing HPLIP via step 2.), it extracts the .run package into the source folder. And you can find it in Downloads folder.

NOTE: HPLIP 3.21.10 somehow does not create source folder. Run ~/Downloads/hplip*.run --target ~/Downloads/hplip to generate it manually if required.

The folder contains an uninstall script allows to remove HPLIP from your computer.

To do so, go to the source folder, right-click on blank area and select ‘Open in Terminal’.

Finally, run the uninstall script in pop-up terminal window:

sudo python3

That’s all.


I'm a freelance blogger who started using Ubuntu in 2007 and wishes to share my experiences and some useful tips with Ubuntu beginners and lovers. Please comment to remind me outdated tutorial! And, notify me if you find any typo/grammar/language mistakes. English is not my native language. Contact me via [email protected] Buy me a coffee:

13 responses to How to Install the Latest HPLIP Driver in Ubuntu 20.04 [Fix Dependency Issue]

  1. This was an immense help, thank you.
    Where you say:
    “Before HPLIP fixed the issue, the solution is either …”
    you maybe meant to say
    “Until HPLIP fixes the issue, the solution is either …”

  2. I’m trying to install HPLIP in ZorinOS 16 (Ubuntu 20.04.3) and it fails because it can’t find cups-devel. I’ve tried to install cups-devel but can’t find it in any repository. Any suggestions?

    • Try manually installing the dependencies:

      For the python-pyqt5 dependency issue, see this how to tutorial. Or, you can manually install the dependencies via command:

      sudo apt-get install libcups2 cups libcups2-dev cups-bsd cups-client libcupsimage2-dev libdbus-1-dev build-essential ghostscript openssl libjpeg-dev libsnmp-dev libtool-bin libusb-1.0-0-dev wget python3-pil policykit-1 policykit-1-gnome python3-pyqt5 python3-dbus.mainloop.pyqt5 python-gi-dev python3-dev python3-notify2 python3 python3-reportlab libsane libsane-dev sane-utils xsane libavahi-client-dev libavahi-core-dev

      And compile it from source folder (generated automatically once you run the .run file) via configure, make, sudo make install.

      • Many thanks. I am with Zorin 16. However I still have a problem with python 3.

        Here is what I need:
        Following dependencies are not installed. HPLIP will not work if all REQUIRED dependencies are not installed and some of the HPLIP features will not work if OPTIONAL dependencies are not installed.
        Package-Name Component Required/Optional
        python3-pyqt4-dbus gui_qt4 OPTIONAL
        python3-pyqt4 gui_qt4 REQUIRED
        python3-pyqt5-dbus gui_qt5 OPTIONAL
        python3-pyqt5 gui_qt5 REQUIRED

        Here is what is in the file:
        ~$ ll /usr/bin/python*
        lrwxrwxrwx 1 root root 24 sep 26 02:48 /usr/bin/python -> /etc/alternatives/python*
        lrwxrwxrwx 1 root root 9 sep 3 23:37 /usr/bin/python3 -> python3.8*
        -rwxr-xr-x 1 root root 5490352 jun 2 06:49 /usr/bin/python3.8*
        lrwxrwxrwx 1 root root 33 jun 2 06:49 /usr/bin/python3.8-config -> x86_64-linux-gnu-python3.8-config*
        lrwxrwxrwx 1 root root 16 mar 13 2020 /usr/bin/python3-config -> python3.8-config*
        -rwxr-xr-x 1 root root 384 mar 27 2020 /usr/bin/python3-futurize*
        -rwxr-xr-x 1 root root 388 mar 27 2020 /usr/bin/python3-pasteurize*

        • The .run installer won’t work for ZorinOS 16 since it’s not officially supported. However, you may manually compile it from the source folder which is generated in Downloads folder when you run the “.run” installer. See HERE for details.

  3. Hi Ji
    Thank you for your article.

    I followed your advice as regards python:

    sudo apt install python-is-python3

    This and updated

    chmod u+x ~/Downloads/

    allowed the install to go ahead.

    Kind regards

  4. Hello
    I Have trouble with install
    Ubuntu 20.04.3.LTS

    Python install – ok
    libavahi – ok

    but instal stop run on the :

    sudo apt-get remove libhpmud0 libsane-hpaio printer-driver-postscript-hp

    and circle /-\-/…..

    • Since it didn’t output any error, it may be waiting for some other process to be done… or stuck due to post script. Try running the command manually in terminal to see what’s going on:

      sudo apt-get remove libhpmud0 libsane-hpaio printer-driver-postscript-hp
  5. Matt / Upland, CA., USA December 31, 2021 at 12:11 am

    Thanks for this post and your Nov 2021 update! All worked as described. I run Linux Mint 20.2 and Ubuntu 20.04.3 here. On two machines, the HP Device Manager GUI didn’t pop up after the restart, but that’s easily fixed. The HP .py executables are located in /bin. The Device Manager can be executed by /bin/hp-toolbox, and from there you can pin it to the taskbar or make a “shortcut” to the panel (Mint terminology).

  6. Ji –

    Thank you so much for this concise, complete and very useful assistance and support.

    Ned Evans (experienced but new to Linux)

  7. Hi. I use the official hplip package from the standard repository in Ubuntu 20.04, and this is what did the trick:

    sudo apt install python-is-python3
    sudo hp-setup -i

    The system is a headless server and had been upgraded from 18.04.

  8. /media/robert/900 GB Shared/Users/Shared/Downloads/hplip-3.16.7/base/ SyntaxWarning: “is” with a literal. Did you mean “==”?
    if weburl is “” or weburl is None:
    Current hplip source directory path has space character in it. Please update path by removing space characters. Example: Change /media/robert/900 GB Shared/Users/Shared/Downloads/ to /media/robert/900GBShared/Users/Shared/Downloads/
    rm: cannot remove ‘../hplip-3.16.7’: Directory not empty

    Obviously code is very immature and buggy. Result is that it will not install on my system.

Leave a Reply

Text formatting is available via select HTML.

<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong> 


This site uses Akismet to reduce spam. Learn how your comment data is processed.