Skip to content

Edoardo Vignati ๐Ÿ‘จ๐Ÿปโ€๐Ÿ’ป

› Always looking for awesome things

Menu
  • Studies
  • Publications
  • Skills
  • Portfolio
  • Projects
  • Career
  • Blog
  • ๐Ÿ‡ฎ๐Ÿ‡น Servizi
Menu

How to install hplip on Ubuntu

Posted on 06/11/202019/11/2022 by Edoardo

Latest update: august 2022 for Ubuntu 22.04. and hplip version 3.22.6.

If you are here, you probably tried to install hplip without success.

Prerequisite: make sure you are using Python3.x running

$ python --version  

If you are using Python2.x you should switch to Python3. Pay attention to old software you are running with Python2…this operation may break something!

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

Old hplip packages can be removed during the installation process in the “DEPENDENCY AND CONFLICT RESOLUTION” phase.

Let’s start with the installation.

Go to the developer website and take a look to the section named “Advanced Option“.

…or if you want to download the package directly you can run:

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

Unpack it and run the installer:

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

Follow the most suitable wizard and be patient…pay attention to each installation step and read carefully what the wizard is saying. In most cases you can simply confirm the default choice suggested by the wizard. Retry the command if you face some exceptions and wait if the process takes a little bit longer.

At the end of the wizard if you don’t find any problem the package has been installed. In case hp-plugin cannot be installed, you are asked to do it manually:

error: hp-plugin command failed. Please run hp-plugin manually.
$ hp-plugin

Let’s now add the printer. Run the following command and follow the instructions:

$ hp-setup

Now to scan a document you have to run

$ hp-scan

In some cases you need to restart the OS to make it work after the installation.

If you find any problem please share it here.

Cheers


Buy Me A Coffee


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

19 thoughts on “How to install hplip on Ubuntu”

  1. kamyogi says:
    22/12/2020 at 22:53

    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?

    Reply
    1. Edo says:
      23/12/2020 at 15:35

      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 ๐Ÿ˜‰

      Reply
  2. kamyogi says:
    24/12/2020 at 17:26

    Hi Edo, it works! Thank you very much indeed.

    Reply
  3. Chris says:
    27/12/2020 at 08:25

    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.

    Reply
    1. Edo says:
      27/12/2020 at 19:21

      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 ๐Ÿ™‚

      Reply
    2. Edo says:
      09/01/2021 at 15:16

      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

      Reply
  4. Rodger says:
    07/01/2021 at 06:37

    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!

    Reply
    1. Edo says:
      07/01/2021 at 13:39

      You are welcome Rodger ๐Ÿ™‚

      Reply
  5. Flavio Sartoretto says:
    19/01/2021 at 21:02

    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.

    Reply
    1. Edo says:
      20/01/2021 at 10:17

      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.

      Reply
  6. Gabriele says:
    29/09/2021 at 11:54

    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.

    Reply
    1. Edoardo says:
      01/10/2021 at 01:14

      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! ๐Ÿ™‚

      Reply
  7. klleshi says:
    01/11/2022 at 16:00

    Hi Edo
    On ubuntu 22.04 the printer works fine but scanner doesn’t.
    I get this message:
    error: SANE: Error during device I/O (code=9).
    It seems starts to scanning but cannot saves the output.
    Thanks

    Reply
    1. Edoardo says:
      02/11/2022 at 16:07

      Hi, I’ve never run into this problem, anyway I can suggest you to reinstall the hplip plugin -> https://developers.hp.com/sites/default/files/hplip-3.22.10-plugin.run

      Reply
  8. klleshi says:
    02/11/2022 at 19:09

    Hi Edo
    I resolved it. The problem was chosing the wrong option:
    SELECT DEVICE

    0* hpaio:/net/HP_LaserJet_MFP_M28-M31?ip=192.168.1.10
    1 escl:https://192.168.1.10:443
    2 airscan:e0:HP LaserJet MFP M28w (CFCE6D).

    The right one for me is just option (1).

    Now the printer and scann work very well. Thanks very much.

    Reply
  9. m.capurso says:
    22/11/2022 at 15:46

    I am installing HPLIP on UBUNTU 22.04 . I have used HPLIP 3.22.xx because older versions are not able to find a qt library .

    With HPLIP 3.22.6 and 3.22.10 I am able to install the software but the plugin keeps reinstalling because does not find a python library. I have found a turnaround:

    I have installed apparmor utilities and permitted access to the net to plugin.py

    sudo apt-get install apparmor-utils

    sudo aa-disable /usr/share/hplip/plugin.py

    and then I run

    hp-pluginย ย 

    This solves the problem but it is necessary a patch to hplip

    Reply
    1. Edoardo says:
      24/11/2022 at 12:09

      Thank you very much for this hint. It could be very useful for other users! ๐Ÿ™‚

      Reply
  10. Alex K says:
    28/11/2022 at 12:06

    Hi Edorado,
    I’m impressed by your expertise.
    As a novice Linux Ubunto user [Pop!_OS 22.04 LTS Ubunto] and trying to configure HP LJ Pro MFP M281fdw printer].
    I am too uncomfortable with all options [and scared to death] that I might break my system.
    Now somehow it seems to work however printing slowly.
    What tests do suggest I perform to see if it is all installed correctly?

    Reply
    1. Edoardo says:
      28/11/2022 at 21:57

      Hello Alex and thank you very much! I’m happy you installed everything and now it seems that everything is working correctly. Anyway, if you want to test the printer I can simply suggest you to print and scan some documents! If everything works as expected you don’t have to worry about anything! ๐Ÿ™‚

      Reply

Leave a Reply Cancel 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.

© 2025 Edoardo Vignati ๐Ÿ‘จ๐Ÿปโ€๐Ÿ’ป | Powered by Minimalist Blog WordPress Theme