How to install hplip on Ubuntu 20.04

IMPORTANT UPDATE 2020/09/01: At the end of this process, your current Virtualbox installation may be broken. You should try to reinstall it following these steps:

1) Purge the Virtualbox packages

$ sudo apt purge virtualbox
$ sudo apt remove virtualbox-dkms
$ sudo apt autoremove

2) go to the following website https://www.ubuntuupdates.org/pm/virtualbox-dkms
3) choose and install the most appropriate deb package
4) reinstall Virtualbox

$ sudo apt install virtualbox

ORIGINAL CONTENT

If you are here, you probably tried to install hplip without success. The installation of hplip on Ubuntu 20.04 is quite hard due to the old library pyqt5 used by standard hplip package.

Anyway if you pay attention, on the developer website, there’s a section named “Advanced Option” that could help you.

Let’s try with the installation.

First of all you have to remove and purge the hplip package already installed on your system.

Then let’s install the following package to use Python3 by default on our system (pay attention if you are running old Python2 software!):

$ sudo apt install python-dev-is-python3
$ sudo apt install python-is-python3 

Then download the hplip tar package from here or run:

$ wget https://sourceforge.net/projects/hplip/files/hplip/3.20.9/hplip-3.20.9.tar.gz/download

Untar it and run the installer:

$ mv download hplip-3.20.9.tar.gz
$ tar -xvf hplip-3.20.9.tar.gz
$ cd hplip-3.20.9
$ ./hplip-install

Follow the most appropriate wizard and be patient…pay attention to each installation step and read carefully what the wizard is saying…if you face some exceptions (network or gui exceptions) please retry the command.

At the end of the wizard if you don’t find any problem the package has been installed.

Afterwards you are asked to setup the printer with the desired connection method: follow the wizard till the end. If the process fails somewhere you don’t have to reinstall the hplip package but run:

$ hp-setup

To scan a document you have to run

$ hp-scan

A window will be promped up asking for the driver installation.

Please follow the wizard and be patient….if the process fails restart it with the same command. At the end rerun the previous command and you will be ready to scan.

If you find any other problem please share it here.

HaPpy scanning!




This work is licensed under a Creative Commons Attribution-NonCommercial 4.0 International License.

12 thoughts on “How to install hplip on Ubuntu 20.04”

  1. Hi Edoardo,
    Thanks for the page and providing me its link. Would you please mind giving simple steps as I am kind of a novice to Ubuntu. 😉 I hardly open the Terminal. If something goes wrong, I am not able to refix it. Hope, you’d understand. How to ‘untar’ and ‘jump into the directory’ as you say in step 3?

    1. Hi kamyogi, I updated the post with the information that you requested 🙂
      I would suggest you to learn more about Bash and Ubuntu, in this way you can understand exactly what you are running and how to fix any problem 😉

  2. Thank you for this method, I’ve seen others that seem to “unlink” and “link” to different directories, making it very difficult for a new user, or it might break after an update. HOWEVER, I found a different problem. By replacing the python version (so hplip can work), but now, that breaks Virtualbox! Since I use Virtualbox more than the printer, I have to re-install (fortunately, from backup image).

    So, either I test hplip / printing from INSIDE Virtualbox (and so don’t break the Host), or I have to print from Windows (e.g. old laptop). Thanks again.

    1. You are welcome!
      I’m personally running Python 3.8.5 and VirtualBox 6.1.16 without any compatibility problem. Please feel free to share with us causes and fixes about your issue 🙂

    2. Hi Chris, I tried to replicate your problem.
      I found a fix that worked for me.
      You can find it at the top of this post.
      Let me know.
      Cheers

  3. Absolutely Perfect – Thank you! I originally could not get HPlip to function or load. HP directions did not work. You solved the problem. Ubuntu 20.04 working with my HP ENVY 6055 printer wirelessly!

  4. Unfortunately I get the following errors (any hint?)
    error: A required dependency ‘libjpeg (libjpeg – JPEG library)’ is still missing.
    error: A required dependency ‘libpthread (libpthread – POSIX threads library)’ is still missing.
    error: A required dependency ‘libusb (libusb – USB library)’ is still missing.
    error: A required dependency ‘libnetsnmp-devel (libnetsnmp-devel – SNMP networking library development files)’ is still missing.
    error: A required dependency ‘libcrypto (libcrypto – OpenSSL cryptographic library)’ is still missing.
    error: A required dependency ‘sane (SANE – Scanning library)’ is still missing.
    error: Installation cannot continue without these dependencies.
    error: Please manually install this dependency and re-run this installer.

    1. Hi Flavio, it seems that are missing some dependencies on your OS.
      Please try to install all of them running:

      sudo apt install build-essential
      sudo apt install libjpeg-dev
      sudo apt install libtool-bin
      sudo apt install libpthread-stubs0-dev
      sudo apt install libusb
      sudo apt install libsnmp-dev
      sudo apt install openssl
      sudo apt install sane
      sudo apt install sane-utils

      Then try again to install hplip and let me know.

  5. while running hp-plugin I get the error reported here below.
    How to do?
    Thanks for help
    Gabriele
    ———————————————-
    P Linux Imaging and Printing System (ver. 3.20.3)
    Plugin Download and Install Utility ver. 2.1

    Copyright (c) 2001-18 HP Development Company, LP
    This software comes with ABSOLUTELY NO WARRANTY.
    This is free software, and you are welcome to distribute it
    under certain conditions. See COPYING file for more details.

    HP Linux Imaging and Printing System (ver. 3.20.3)
    Plugin Download and Install Utility ver. 2.1

    Copyright (c) 2001-18 HP Development Company, LP
    This software comes with ABSOLUTELY NO WARRANTY.
    This is free software, and you are welcome to distribute it
    under certain conditions. See COPYING file for more details.

    Checking for network connection…
    Downloading plug-in from:
    Traceback (most recent call last):
    File “/usr/share/hplip/ui5/plugindialog.py”, line 248, in NextButton_clicked
    status, download_plugin_file, error_str = self.pluginObj.download(self.plugin_path,self.plugin_download_callback)
    File “/usr/share/hplip/installer/pluginhandler.py”, line 254, in download
    core = core_install.CoreInstall()
    File “/usr/share/hplip/installer/core_install.py”, line 239, in __init__
    self.passwordObj = password.Password(ui_mode)
    File “/usr/share/hplip/base/password.py”, line 88, in __init__
    self.__readAuthType() # self.__authType
    File “/usr/share/hplip/base/password.py”, line 110, in __readAuthType
    distro_name = get_distro_name().lower()
    File “/usr/share/hplip/base/password.py”, line 78, in get_distro_name
    return distro.linux_distribution(full_distribution_name=False)[0]
    File “/usr/lib/python3/dist-packages/distro.py”, line 122, in linux_distribution
    return _distro.linux_distribution(full_distribution_name)
    File “/usr/lib/python3/dist-packages/distro.py”, line 677, in linux_distribution
    self.version(),
    File “/usr/lib/python3/dist-packages/distro.py”, line 737, in version
    self.lsb_release_attr(‘release’),
    File “/usr/lib/python3/dist-packages/distro.py”, line 899, in lsb_release_attr
    return self._lsb_release_info.get(attribute, ”)
    File “/usr/lib/python3/dist-packages/distro.py”, line 552, in __get__
    ret = obj.__dict__[self._fname] = self._f(obj)
    File “/usr/lib/python3/dist-packages/distro.py”, line 1012, in _lsb_release_info
    stdout = subprocess.check_output(cmd, stderr=devnull)
    File “/usr/lib/python3.8/subprocess.py”, line 415, in check_output
    return run(*popenargs, stdout=PIPE, timeout=timeout, check=True,
    File “/usr/lib/python3.8/subprocess.py”, line 516, in run
    raise CalledProcessError(retcode, process.args,
    subprocess.CalledProcessError: Command ‘(‘lsb_release’, ‘-a’)’ returned non-zero exit status 1.
    Error in sys.excepthook:
    Traceback (most recent call last):
    File “/usr/lib/python3/dist-packages/apport_python_hook.py”, line 153, in apport_excepthook
    with os.fdopen(os.open(pr_filename,
    PermissionError: [Errno 13] Permesso negato: ‘/var/crash/_usr_share_hplip_plugin.py.1000.crash’

    Original exception was:
    Traceback (most recent call last):
    File “/usr/share/hplip/ui5/plugindialog.py”, line 248, in NextButton_clicked
    status, download_plugin_file, error_str = self.pluginObj.download(self.plugin_path,self.plugin_download_callback)
    File “/usr/share/hplip/installer/pluginhandler.py”, line 254, in download
    core = core_install.CoreInstall()
    File “/usr/share/hplip/installer/core_install.py”, line 239, in __init__
    self.passwordObj = password.Password(ui_mode)
    File “/usr/share/hplip/base/password.py”, line 88, in __init__
    self.__readAuthType() # self.__authType
    File “/usr/share/hplip/base/password.py”, line 110, in __readAuthType
    distro_name = get_distro_name().lower()
    File “/usr/share/hplip/base/password.py”, line 78, in get_distro_name
    return distro.linux_distribution(full_distribution_name=False)[0]
    File “/usr/lib/python3/dist-packages/distro.py”, line 122, in linux_distribution
    return _distro.linux_distribution(full_distribution_name)
    File “/usr/lib/python3/dist-packages/distro.py”, line 677, in linux_distribution
    self.version(),
    File “/usr/lib/python3/dist-packages/distro.py”, line 737, in version
    self.lsb_release_attr(‘release’),
    File “/usr/lib/python3/dist-packages/distro.py”, line 899, in lsb_release_attr
    return self._lsb_release_info.get(attribute, ”)
    File “/usr/lib/python3/dist-packages/distro.py”, line 552, in __get__
    ret = obj.__dict__[self._fname] = self._f(obj)
    File “/usr/lib/python3/dist-packages/distro.py”, line 1012, in _lsb_release_info
    stdout = subprocess.check_output(cmd, stderr=devnull)
    File “/usr/lib/python3.8/subprocess.py”, line 415, in check_output
    return run(*popenargs, stdout=PIPE, timeout=timeout, check=True,
    File “/usr/lib/python3.8/subprocess.py”, line 516, in run
    raise CalledProcessError(retcode, process.args,
    subprocess.CalledProcessError: Command ‘(‘lsb_release’, ‘-a’)’ returned non-zero exit status 1.

    1. Hi Gabriele. It seems to be a permission issue (maybe could be also related with the python version??). I’ve never run into this problem and actually I cannot reproduce it (can you provide more information about the version of os, printer and python?). Anyway here I found some interesting threads where you can take a look:

      https://stackoverflow.com/questions/44967202/pip-is-showing-error-lsb-release-a-returned-non-zero-exit-status-1
      https://forum.ubuntu-it.org/viewtopic.php?f=9&t=642007&start=20
      https://developers.hp.com/hp-client-management/forum/hp-laserjet-mfp-m28-hplip-3209-notworking-scanner?language=en
      https://forums.linuxmint.com/viewtopic.php?t=271178

      What you can try to do: check that the printer is supported by hplip driver, uninstall and purge everything and reinstall trying to change the connection method during the driver setup.

      Please share here your solution if you find the fix! 🙂

Leave a Reply

Your email address will not be published. Required fields are marked *

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