hp-setup gives python error and fails

Asked by MountainX on 2018-02-23

I just started getting this error on Arch Linux. hp-setup has been working well until now. I don't understand the error message.


    HP Linux Imaging and Printing System (ver. 3.17.11)
    Printer/Fax Setup Utility ver. 9.0

    Copyright (c) 2001-15 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.

    Traceback (most recent call last):
      File "/usr/bin/hp-setup", line 313, in <module>
        ui = import_module(ui_package + ".setupdialog")
      File "/usr/lib/python3.6/importlib/__init__.py", line 126, in import_module
        return _bootstrap._gcd_import(name[level:], package, level)
      File "<frozen importlib._bootstrap>", line 994, in _gcd_import
      File "<frozen importlib._bootstrap>", line 971, in _find_and_load
      File "<frozen importlib._bootstrap>", line 955, in _find_and_load_unlocked
      File "<frozen importlib._bootstrap>", line 665, in _load_unlocked
      File "<frozen importlib._bootstrap_external>", line 678, in exec_module
      File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed
      File "/usr/share/hplip/ui5/setupdialog.py", line 31, in <module>
        from base import device, utils, models, pkit
      File "/usr/share/hplip/base/pkit.py", line 38, in <module>
        from gi import _gobject as gobject
    ImportError: cannot import name '_gobject'

After seeing this error, I have reinstalled hplip (which is the package that owns the hp-setup file).

    pacman -Qo /usr/share/hplip/setup.py
    /usr/share/hplip/setup.py is owned by hplip 3.17.11-1

That did not resolve the issue. I appreciate any suggestions. Thanks

Question information

English Edit question
HPLIP Edit question
No assignee Edit question
Solved by:
Last query:
Last reply:
Afshan F (afshan) said : #1

Hi MountainX,

Arch-linux distro is yet to be supported by HPLIP. Were you able to install on this distro and do the printing functionalities before?
If so , can you please provide the logs by typing the following command in the terminal and post the log file here?

hp-check -t


MountainX (dave-mountain) said : #2

Hi Afshan,
Yes, hplip works fine on Arch Linux. We've been using Arch Linux and HP printers for years. We exclusively buy HP printers because the HP Linux tools / drivers work very well in our experience. We have around a dozen networked HP printers, all working well with all Arch Linux computers.

Prior to using Arch Linux we used Ubuntu for about ten years. In our experience, hplip on Arch works as well or better than it did on Ubuntu. You should consider adding Arch Linux to the list of "working" distributions.

The error described here doesn't prevent printing and it also doesn't prevent running hp-setup in interactive mode. It only affects hp-setup in GUI mode. This is only happening on one Arch Linux computer, not all.

I ran hp-check -t on a computer without the error and the one with the error. All required dependencies are installed on both of these computers. However, there is one difference. The computer with the error doesn't have xsane installed. It should be optional, but I wonder if this line gives a clue:

(xsane:4085): Gtk-WARNING **: cannot open display:
 error: xsane xsane - Graphical scanner frontend for SANE OPTIONAL 0.9 - INCOMPAT 'xsane needs to be installed'

If you look at the python error I posted in the OP, taken together with this, does it provide any clues? It seems to be a GTK issue because the problem is not seen in the interactive (text) mode of hp-setup. Thank you.

MountainX (dave-mountain) said : #3

I have it resolved. The solution was simple:

    pacman -S --needed python-gobject

and indeed it needed to be installed. Once installed, the issue was resolved.