0

I am trying to run HP's printer software which was upgraded recently and broke all my printing. I run a constantly upgraded Arch (which is 5.10.14 as of Feb 28, 2021). Apparently they use Qt now so it is some kind of requirement so I spent 2 hours building all this Qt stuff. It seems crazy that HP is requiring linux users to spend hours building obscure packages just so they can print. lpstat -a says the printers are ready and working/idle, but nothing can print to them. The cups log says the print failed to a "backend error".

Anyway, hp-setup now just hangs on startup and hp-check gives an error that PyQt4 cannot import QtCore, which is the standard way PyQt users try to verify the version of Qt they are running under. So, apparently there is some kind of version conflict between the two. Here is the relevant section of my pip list:

PyOpenGL              3.1.5
pyOpenSSL             20.0.1
pyparsing             2.4.7
PyQt3D                5.15.2
PyQt4-sip             4.19.24
PyQt5                 5.15.2
PyQt5-sip             12.8.1
PyQtChart             5.15.2
PyQtDataVisualization 5.15.2
PyQtPurchasing        5.15.2
PyQtWebEngine         5.15.2

So, is the problem that I have PyQt5 on my system and the HP software wants PyQt4? If so, can I have both on the same system? What is the procedure to diagnose this?

$ sudo find /usr -name "PyQt*"
/usr/share/qt/qsci/api/python/PyQtDataVisualization.api
/usr/share/qt/qsci/api/python/PyQtPurchasing.api
/usr/share/qt/qsci/api/python/PyQtWebEngine.api
/usr/share/qt/qsci/api/python/PyQt3D.api
/usr/share/qt/qsci/api/python/PyQt5.api
/usr/share/qt/qsci/api/python/PyQtChart.api
/usr/lib/qt/plugins/PyQt5
/usr/lib/python3.9/site-packages/PyQtChart-5.15.3.dist-info
/usr/lib/python3.9/site-packages/PyQt5_sip-12.8.1-py3.9.egg-info
/usr/lib/python3.9/site-packages/PyQtPurchasing-5.15.3.dist-info
/usr/lib/python3.9/site-packages/PyQt4
/usr/lib/python3.9/site-packages/PyQt5
/usr/lib/python3.9/site-packages/PyQt3D-5.15.3.dist-info
/usr/lib/python3.9/site-packages/PyQtDataVisualization-5.15.3.dist-info
/usr/lib/python3.9/site-packages/PyQt4_sip-4.19.24.dist-info
/usr/lib/python3.9/site-packages/PyQt5-5.15.3.dist-info
/usr/lib/python3.9/site-packages/PyQtWebEngine-5.15.3.dist-info
/usr/lib/python2.7/site-packages/PyQt4
/usr/lib/python2.7/site-packages/PyQt4_sip-4.19.24.dist-info

The output from HPLIP_DEBUG=1 hp-setup:


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

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-setup[711208]: debug: param=
hp-setup[711208]: debug: selected_device_name=None
hp-setup[711208]: debug: Using PyQt5
hp-setup[711208]: debug: Sys.argv=['/usr/bin/hp-setup'] printer_name=None param= jd_port=1 device_uri=None remove=False
hp-setup[711208]: debug: Starting GUI Event Loop...
Searching... (bus=net, timeout=5, ttl=4, search=(None) desc=0, method=slp)
error: No devices found on bus: net
error:  HPLIP cannot detect printers in your network.  This may be due to existing firewall settings blocking the required ports.
                When you are in a trusted network environment, you may open the ports for network services like mdns and slp in the firewall. For detailed steps follow the link.
                 http://hplipopensource.com/node/374 
1
  • 2
    Does the version of hplip that’s packaged in whatever distribution you’re using work? Is that good enough for the printer you have? – Stephen Kitt Feb 12 at 15:40
1

On e.g. Ubuntu 20.10 the hplip package will actually run with PyQt5 (python3-pyqt5). Same on Arch, the hplip package version 3.21.2-1 uses Qt 5. So, no need to install Qt 4.

The used Qt version is actually configured in /etc/hp/hplip.conf:

[configure]
ui-toolkit=qt5
qt3=no
qt4=no
qt5=yes

When I run hp-check it does mention that PyQt4 could not be found, but it does not list it at the end under Missing Required Dependencies. If you ask me, this tool is not very trustworthy.

To understand what is going on Python-wise, I would first try to find out where the Qt bindings were installed:

$ find /usr -name "PyQt*"

You might have multiple Python versions on your system where each has a different directory for its packages. Try calling the tool explicitly with the Python interpreter you think has all the dependencies installed, e.g.:

$ export HPLIP_DEBUG=1
$ python3.9 $(where hp-setup)

I would expect some hints on what is going wrong in the console output.

One step further could be to run a Python debugger.

If it turns out that the wrong Python interpreter was used, make sure that python is pointing to the correct version with:

$ python --version

However, I don't thing that this is in any way related to PyQt/Qt when looking at the additional console output that you have provided now, especially due to:

error: No devices found on bus: net

This somehow seems to be related to networking as discovery (SLP) is failing.

9
  • I updated the question with the results of the find command. I run Arch. – Tyler Durden Feb 28 at 13:48
  • @TylerDurden I've added some more information. If that does not help, maybe you want to remove Qt4/PyQt4 just to be sure. – Ezra Bühler Mar 1 at 15:01
  • When I use python3.9 /usr/sbin/hp-check I get the same error "File /usr/share/hplip/installer/dcheck.py, line 303 in getPyQt4_version from PyQt4 import QtCore, ImportError: cannot import name 'QtCore' from 'PyQt4' (unknown location) – Tyler Durden Mar 1 at 15:56
  • 1
    FWIW, lpstat -a on my system lists a printer that's currently switched off as "accepting requests since" [timestamp 6 months into the past]. How is your printer connected? The debug output from hp-setup suggests it's using the net transport. What does hp-probe -g -b net produce? If your printer is connected via USB, what does hp-probe -g -b usb produce? – i336_ Mar 5 at 10:16
  • 1
    The probe says it cannot find any printers. My printers are on a local ethernet network that has no firewall. Programs that do not use CUPS have no problem accessing and using the printers. For example, I have a Windows laptop on the network and it has no problem printing. Also, I have non-CUPS programs running on my linux boxes that have no problem printing. It is only CUPS/HP that have a problem finding the printers. I have given the static IPs of the printers to the HP discovery and it still cannot "find" the printers. – Tyler Durden Mar 5 at 12:29

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.