0

After deleting and reinstalling everything related to hplip and hplip-gui several times but when executing hplip-gui I get the following errors:

error: Unable to load DBus libraries. Please check your installation and try again.
error: Please upgrade your python installation to the latest available version.

I have have been able to update python, but the error still appears.

My goal really is to be able to control my HP printer with “HP Device Manager” like shown on this page https://www.cyberciti.biz/faq/how-to-install-networked-hp-printer-and-scanner-on-ubuntu-linux/

either by solving these errors or by reinstalling everything needed from scratch. But I've ran out of ideas. Any suggestions?

N0rbert
  • 99,918
  • 1
    Indicate the Ubuntu version you are using. Might be that the program you attempt to install does not support your current version. On the other hand, there should be no need to install external drivers for your HP printer. Keep with the drivers of your Ubuntu version, and you will stay out of trouble. – vanadium Jan 02 '20 at 11:57
  • 2
  • Sorry @vanadium, I'm using Ubuntu 19.04. And it was working fine (although I remember I had to install the driver myself) until some configurations got weird, so I tried to clean up everything related to HPLIP and start again. – Raphael Lopez Jan 12 '20 at 10:38
  • And @N0rbert, I think that is exactly what I have tried a few times. It was working one month ago but now this error appears when I try to execute hplip-gui, which should open the HP Device Manager. – Raphael Lopez Jan 12 '20 at 10:44
  • Do you have any error output on launch of hp-toolbox? Also see this answer to reduce number of warnings. Are you using hplip installed from deb-package? – N0rbert Jan 12 '20 at 10:54

1 Answers1

0

I'm not sure this will apply to your 19.04 as I'm now debugging this on ubuntu 16.04.

First, it's useful to run hp-check, which tests many things about your installation of hplip. It was telling me I'm missing 2 python libraries:

 error: python3-notify2 Python libnotify - Python bindings for the libnotify Desktop notifications OPTIONAL        -               -               MISSING    'python3-notify2 needs to be installed'
...
 error: python3-pyqt4-dbus PyQt 4 DBus - DBus Support for PyQt4                         OPTIONAL        4.0             4.11.4          MISSING    'python3-pyqt4-dbus needs to be installed'

OK, sudo apt install python3-notify2 was easy enough, but there was no python3-pyqt4-dbus in 16.04. However further down it says the same thing but suggest a different package name:

Missing Optional Dependencies
-----------------------------
error: 'python3-notify2' package is missing/incompatible 
error: 'python3-dbus.mainloop.qt' package is missing/incompatible 

and sudo apt install python3-dbus.mainloop.qt worked for me (fixing both messages)!


We can also find it in the code:

$ ag --before=5 'Unable to load DBus libraries.' /usr/share/hplip/
/usr/share/hplip/ui4/devmgr5.py
48-try:
49-    import dbus
50-    from dbus.mainloop.qt import DBusQtMainLoop
51-    from dbus import lowlevel
52-except ImportError:
53:    log.error("Unable to load DBus libraries. Please check your installation and try again.")

so your error message must be coming from one of those import lines. By opening python3 interpreter and pasting these lines one by one (without leading whitespace!), I confirmed which one was failing:

$ python3
Python 3.5.2 (default, Apr 16 2020, 17:47:17) 
[GCC 5.4.0 20160609] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import dbus
>>> from dbus.mainloop.qt import DBusQtMainLoop
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
ImportError: No module named 'dbus.mainloop.qt'
>>> from dbus import lowlevel
>>> exit()

I then did apt search dbus.mainloop.qt and arrived at same conclusion that I need sudo apt install python3-dbus.mainloop.qt. (I actually did this before noticing the latter hint from hp-check :-)

Try this analysis on your ubuntu.


Now hp-toolbox launches successfully.