How do I setup Color LaserJet MFP M277dw with HPLIP on Arch Linux?

Asked by Alexander on 2020-03-05

I am trying to install HPLIP on Arch Linux. My main Problem is that I cannot find any documentation on how to build and install HPLIP.

First I tried to use the *.run File. As Arch Linux is not officially supported, I tried the "Manjaro Linux" and "Linux From Scratch" options. However, the script fails to detect pyqt5, so I can not continue the installation after the "MISSING DEPENDENCIES" step.

Next, I downloaded the source from Sourceforge. It does not come with any README file. Looking through the files, I found autotools input files and a configure script. So, after reading the help text, I tried

./configure --disable-hpijs-only-build --disable-fax-build --enable-qt5 --disable-qt4

Which gives me
checking for python... /usr/bin/python
checking for python version... 3.8
checking for python platform... linux
checking for python script directory... ${prefix}/lib/python3.8/site-packages
checking for python extension module directory... ${exec_prefix}/lib/python3.8/site-packages
checking for path to Python.h... "using /usr/include/python3.8 .... python3.8/Python.h"
checking python3.8/Python.h usability... no
checking python3.8/Python.h presence... no
checking for python3.8/Python.h... no
checking python3.8mu/Python.h usability... no
checking python3.8mu/Python.h presence... no
checking for python3.8mu/Python.h... no
checking python3.8m/Python.h usability... no
checking python3.8m/Python.h presence... no
checking for python3.8m/Python.h... no
configure: error: cannot find python-devel support

Which is wrong, /usr/include/python3.8/Python.h definitely exists! Is this even the right way to build HPLIP? If not, what am I supposed to do then?

Question information

Language:
English Edit question
Status:
Solved
For:
HPLIP Edit question
Assignee:
No assignee Edit question
Solved by:
Alexander
Solved:
2020-03-09
Last query:
2020-03-09
Last reply:
2020-03-06
Manfred Hampl (m-hampl) said : #1

There is a version in the Arch Linux repositories https://www.archlinux.org/packages/extra/x86_64/hplip/
Did you try that?

Alexander (alex-fu27) said : #2

Yes, it gives me the following errors:

When I try to use "hp-setup -i" or "hp-plugin -i":
Checking for network connection... Downloading plug-in from:
Downloading plug-in: [\ ] 0% Traceback (most recent call last):
  File "/usr/local/bin/hp-plugin", line 363, in <module>
    status, plugin_path, error_str = pluginObj.download(plugin_path, plugin_download_callback)
  File "/usr/local/share/hplip/installer/pluginhandler.py", line 254, in download
    core = core_install.CoreInstall()
  File "/usr/local/share/hplip/installer/core_install.py", line 240, in __init__
    self.passwordObj = password.Password(ui_mode)
  File "/usr/local/share/hplip/base/password.py", line 113, in __init__
    self.__readAuthType() # self.__authType
  File "/usr/local/share/hplip/base/password.py", line 135, in __readAuthType
    distro_name = get_distro_name().lower()
  File "/usr/local/share/hplip/base/password.py", line 81, in get_distro_name
    os_name = platform.dist()[0]
AttributeError: module 'platform' has no attribute 'dist'
error: Failed to install Plugin.
error: The device you are trying to setup requires a binary plug-in. Some functionalities may not work as expected without plug-ins. Please run 'hp-plugin' as normal user to install plug-ins.Visit http://hplipopensource.com for more infomation.

When I try to run it without the "-i" option:
Traceback (most recent call last):
  File "/usr/local/bin/hp-plugin", line 255, in <module>
    ui = import_module(ui_package + ".plugindialog")
  File "/usr/lib/python3.8/importlib/__init__.py", line 127, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
  File "<frozen importlib._bootstrap>", line 1014, in _gcd_import
  File "<frozen importlib._bootstrap>", line 991, in _find_and_load
  File "<frozen importlib._bootstrap>", line 961, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed
  File "<frozen importlib._bootstrap>", line 1014, in _gcd_importI would try to fix these errors in the sources.
  File "<frozen importlib._bootstrap>", line 991, in _find_and_load
  File "<frozen importlib._bootstrap>", line 973, in _find_and_load_unlocked
ModuleNotFoundError: No module named 'ui5'

I don't know about the second one, but the first one is because the Arch Linux python is python3.8, and that function "platform.dist" has been deprecated for some time and was removed in python 3.7. So I thought that if I built it from source, I could fix that.

Manfred Hampl (m-hampl) said : #3

You shouldn't use hp-setup (which is from the HPLIP installer that does not know about Arch Linux), but the Arch Linux package management to install the package that has been prepared for Arch Linux (with pacman or yaourt, ...)
(Similar with hp-plugin which is in aur)

brian_p (claremont102) said : #4

Is there any particular device you want to use HPLIP with?

Alexander (alex-fu27) said : #5

Manfred,
the instructions say I must use hp-setup to setup my printer.
I tried installing the hplip and hplip-plugin packages and running "hp-setup -i", which more or less seems to work. At the hp-plugin step I chose "q" to skip the installation because it is already installed by the package. Now my printer is configured in CUPS, but when I try to print a test page it only prints a line of random characters.

brian,
Yes, it is a Color LaserJet MFP M277dw.

brian_p (claremont102) said : #6

Hello Alexander,

If I had an M277dw I would read

  https://wiki.debian.org/CUPSDriverlessPrinting

and put the device on the network. The driverless command and setting up an everywhere queue would have me printing in 5 minutes.

Alexander (alex-fu27) said : #7

Thank you, that works. I would like to use duplex printing, which is not supported with driverless printing.

What I tried now is: Running "hp-setup" with PYTHONPATH=/usr/share/hplip/ That way it is able to import the required python packages. I repeatedly re-ran the printer setup and removed the failing lines from the Python scripts. That way, I was able to setup the printer queue. It uses the "hp-color_laserjet_pro_mfp_m277-ps.ppd.gz" PPD File.

I successfully printed the test page from hp-setup, however it printed three more sheets containing garbage.
When I try to print from a different application, e.g. evince, it prints only garbage.

brian_p (claremont102) said : #8

> Thank you, that works. I would like to use duplex printing, which is > not supported with driverless printing.

I am very, very surprised by that. Isn't it shown in the output of

 lpoptions -p EVERYWHERE_PRINT_QUEUE_NAME -l ?

Alexander (alex-fu27) said : #9

The output was something along the lines of
lpoptions: Unable to get PPD file for test1: Not Found

So I had a look at /var/log/cups/error_log
E [09/Mar/2020:08:37:06 +0100] [CGI] Unable to create PPD file: Could not poll sufficient capability info from the printer (ipp://HP%20Color%20LaserJet%20MFP%20M277dw%20(064534)._ipp._tcp.local/, ipp://NPI064534.local:631/ipp/print) via IPP!
E [09/Mar/2020:08:37:06 +0100] copy_model: empty PPD file
E [09/Mar/2020:08:37:06 +0100] [Client 701] Returning IPP server-error-internal-error for CUPS-Add-Modify-Printer (ipp://localhost/printers/test_dnssd) from localhost.

and I googled these messages, but only found the CUPS source files.

I had set up the everywhere queue using the CUPS web interface, which apparently doesn't display error messages. I did this because using lpadmin did not work, but now I retried:
`lpadmin -p test2 -v "ipp://HP%20Color%20LaserJet%20MFP%20M277dw%20(064534)._ipp._tcp.local/" -E -m everywhere`
which gave me something along the lines of "NPI064534.local:631: name or service not known." NPI064534 is the printer's host name. I had disabled hostname resolution using avahi because I had never needed it. So I followed https://wiki.archlinux.org/index.php/Avahi#Hostname_resolution . Then I set up the printer using `lpinfo -v` which gave me the URI and `lpadmin -p hp_printer -v "ipp://HP%20Color%20LaserJet%20MFP%20M277dw%20(064534)._ipp._tcp.local/" -E -m everywhere` to create the queue. This one now has all options I will ever need.

Thanks for your help!

brian_p (claremont102) said : #10

Nicely done, Alexander. With an everywhere queue you now have future-proof printing.

--
Brian.