missing models.dat file

Bug #1744340 reported by Moses Moore
22
This bug affects 4 people
Affects Status Importance Assigned to Milestone
hplip (Ubuntu)
Invalid
Undecided
Unassigned

Bug Description

Most of the hp-* commands report "error: Unable to locate models.dat file", and are unusable. The "base/models.py" python module expects to find models.dat somewhere near /usr/share/hplip/models/models.dat"

Sample error message:

# hp-setup 002:034
error: Unable to locate models.dat file

HP Linux Imaging and Printing System (ver. 3.17.7)
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.

QStandardPaths: XDG_RUNTIME_DIR not set, defaulting to '/tmp/runtime-root'
Searching for device...
Traceback (most recent call last):
  File "/usr/share/hplip/base/models.py", line 539, in __getitem__
    return self.__cache[model]
KeyError: 'hp_laserjet_professional_p1102w'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/bin/hp-setup", line 317, in <module>
    dlg = ui.SetupDialog(None, param, jd_port, device_uri, remove)
  File "/usr/share/hplip/ui5/setupdialog.py", line 189, in __init__
    self.initUi()
  File "/usr/share/hplip/ui5/setupdialog.py", line 221, in initUi
    self.initDiscoveryPage()
  File "/usr/share/hplip/ui5/setupdialog.py", line 259, in initDiscoveryPage
    if self.manualDiscovery():
  File "/usr/share/hplip/ui5/setupdialog.py", line 339, in manualDiscovery
    device_uri, sane_uri, fax_uri = device.makeURI(self.param, self.jd_port)
  File "/usr/share/hplip/base/device.py", line 416, in makeURI
    mq = queryModelByURI(cups_uri)
  File "/usr/share/hplip/base/device.py", line 457, in queryModelByURI
    return queryModelByModel(model)
  File "/usr/share/hplip/base/device.py", line 446, in queryModelByModel
    return model_dat[model]
  File "/usr/share/hplip/base/models.py", line 545, in __getitem__
    if self.read_section(self.released_dat, model):
  File "/usr/share/hplip/base/models.py", line 455, in read_section
    fd = open(filename)
TypeError: expected str, bytes or os.PathLike object, not NoneType

ProblemType: Bug
DistroRelease: Ubuntu 17.10
Package: hplip 3.17.7+repack0-3
ProcVersionSignature: Ubuntu 4.13.0-25.29-generic 4.13.13
Uname: Linux 4.13.0-25-generic x86_64
NonfreeKernelModules: nvidia_uvm nvidia_drm nvidia_modeset nvidia
ApportVersion: 2.20.7-0ubuntu3.7
Architecture: amd64
CupsErrorLog: E [19/Jan/2018:09:33:03 -0500] [Job 175] Stopping unresponsive job.
Date: Fri Jan 19 10:40:37 2018
InstallationDate: Installed on 2016-06-05 (593 days ago)
InstallationMedia: Xubuntu 16.04 LTS "Xenial Xerus" - Release amd64 (20160420.1)
Lpstat: Error: command ['lpstat', '-v'] failed with exit code 1: lpstat: No destinations added.
MachineType: ASUSTeK Computer Inc. G73Sw
Papersize: letter
ProcEnviron:
 LANGUAGE=en_CA:en
 TERM=xterm-256color
 PATH=(custom, no user)
 LANG=en_CA.UTF-8
 SHELL=/bin/bash
ProcKernelCmdLine: BOOT_IMAGE=/vmlinuz-4.13.0-25-generic root=/dev/mapper/xubuntu--vg-root ro nosplash vga=773 acpi_osi=Linux
SourcePackage: hplip
UpgradeStatus: Upgraded to artful on 2017-10-22 (89 days ago)
dmi.bios.date: 02/10/2011
dmi.bios.vendor: American Megatrends Inc.
dmi.bios.version: G73Sw.205
dmi.board.asset.tag: ATN12345678901234567
dmi.board.name: G73Sw
dmi.board.vendor: ASUSTeK Computer Inc.
dmi.board.version: 1.0
dmi.chassis.asset.tag: No Asset Tag
dmi.chassis.type: 10
dmi.chassis.vendor: ASUSTeK Computer Inc.
dmi.chassis.version: 1.0
dmi.modalias: dmi:bvnAmericanMegatrendsInc.:bvrG73Sw.205:bd02/10/2011:svnASUSTeKComputerInc.:pnG73Sw:pvr1.0:rvnASUSTeKComputerInc.:rnG73Sw:rvr1.0:cvnASUSTeKComputerInc.:ct10:cvr1.0:
dmi.product.name: G73Sw
dmi.product.version: 1.0
dmi.sys.vendor: ASUSTeK Computer Inc.

Revision history for this message
Moses Moore (moses-ubuntu) wrote :
Revision history for this message
Launchpad Janitor (janitor) wrote :

Status changed to 'Confirmed' because the bug affects multiple users.

Changed in hplip (Ubuntu):
status: New → Confirmed
Revision history for this message
Till Kamppeter (till-kamppeter) wrote :

Do you have the package libsane-hpaio installed?

Check with the command

dpkg -l | grep libsane-hpaio

Check also:

ls -l /usr/share/hplip/models/models.dat
ls -l /usr/share/hplip/data/models/models.dat

If you have only the latter and not the former, do

mkdir -p /usr/share/hplip/models/
ln -s /usr/share/hplip/data/models/models.dat /usr/share/hplip/models/

Does this solve your problem?

Changed in hplip (Ubuntu):
status: Confirmed → Incomplete
Revision history for this message
Till Kamppeter (till-kamppeter) wrote :

Did you always have only the Ubuntu packages of HPLIP installed? Or did you also install HPLIP from HP directly?

Revision history for this message
Till Kamppeter (till-kamppeter) wrote :

Please also attach your files

/etc/hp/hplip.conf
~/.hplip/hplip.conf

Do not compress them and do not pack them together.

Revision history for this message
Moses Moore (moses-ubuntu) wrote :

I upgraded to hplip 3.17.10+repack0-5 (as part of upgrading to Ubuntu 18.04 LTS) and the problem's gone away. This package depends on libsane-hpaio 3.17.10+repack0-5 , which comes with /usr/share/hplip/data/models/models.dat , and the hp-* commands are able to find it:

$ hp-setup
stat("/usr/share/hplip/data/models/models.dat", {st_mode=S_IFREG|0644, st_size=1178923, ...}) = 0
openat(AT_FDCWD, "/usr/share/hplip/data/models/models.dat", O_RDONLY) = 23

oversight on my part not to come back to this bug and say "fixed in a newer version"

Revision history for this message
Till Kamppeter (till-kamppeter) wrote :

Thanks. I will close it then.

Changed in hplip (Ubuntu):
status: Incomplete → Invalid
Revision history for this message
JoJo Circus (home2mars) wrote :

I do not know if I should just comment here or open a new post.
I have Ubuntu 18.04 with hplip package 3.17.10+repack0-5 installed.
However I can not run hp-setup and my Hp Toolbox icon did not launch the program as expected.

Error when doing hp-setup:
-------------------------------------------------
error: Unable to locate models.dat file

HP Linux Imaging and Printing System (ver. 0.0.0)
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.

(Note: Defaults for each question are maked with a '*'. Press <enter> to accept the default.)

Using connection type: usb

error: No device selected/specified or that supports this functionality.

-------------------------------------------------

Revision history for this message
JoJo Circus (home2mars) wrote :
Download full text (3.2 KiB)

Additional info, this is the text when I reinstall the hplip package
-------------------------------------------------
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following packages were automatically installed and are no longer required:
  g++-6 libaccinj64-9.1 libcublas9.1 libcudart9.1 libcufft9.1 libcufftw9.1 libcuinj64-9.1 libcurand9.1 libcusolver9.1 libcusparse9.1 libnppc9.1 libnppial9.1
  libnppicc9.1 libnppicom9.1 libnppidei9.1 libnppif9.1 libnppig9.1 libnppim9.1 libnppist9.1 libnppisu9.1 libnppitc9.1 libnpps9.1 libnvblas9.1 libnvgraph9.1
  libnvidia-cfg1-418 libnvrtc9.1 libnvtoolsext1 libnvvm3 libstdc++-6-dev libthrust-dev libvdpau-dev nvidia-cuda-doc nvidia-cuda-gdb nvidia-opencl-dev nvidia-profiler
  nvidia-visual-profiler ocl-icd-opencl-dev opencl-c-headers
Use 'sudo apt autoremove' to remove them.
The following additional packages will be installed:
  hplip-data printer-driver-postscript-hp
Suggested packages:
  hplip-doc
The following NEW packages will be installed:
  hplip hplip-data hplip-gui printer-driver-postscript-hp
0 upgraded, 4 newly installed, 0 to remove and 38 not upgraded.
Need to get 0 B/8,289 kB of archives.
After this operation, 13.1 MB of additional disk space will be used.
Do you want to continue? [Y/n] y
Selecting previously unselected package hplip-data.
(Reading database ... 195270 files and directories currently installed.)
Preparing to unpack .../hplip-data_3.17.10+repack0-5_all.deb ...
Unpacking hplip-data (3.17.10+repack0-5) ...
Selecting previously unselected package hplip.
Preparing to unpack .../hplip_3.17.10+repack0-5_amd64.deb ...
Unpacking hplip (3.17.10+repack0-5) ...
Selecting previously unselected package hplip-gui.
Preparing to unpack .../hplip-gui_3.17.10+repack0-5_all.deb ...
Unpacking hplip-gui (3.17.10+repack0-5) ...
Selecting previously unselected package printer-driver-postscript-hp.
Preparing to unpack .../printer-driver-postscript-hp_3.17.10+repack0-5_all.deb ...
Unpacking printer-driver-postscript-hp (3.17.10+repack0-5) ...
Setting up hplip-data (3.17.10+repack0-5) ...
Setting up hplip (3.17.10+repack0-5) ...
Creating/updating hplip user account...
dpkg-statoverride: warning: --update given but /var/run/hplip does not exist
Can't open /etc/hp/hplip.conf: No such file or directory.
Can't open /etc/hp/hplip.conf: No such file or directory.
Setting up printer-driver-postscript-hp (3.17.10+repack0-5) ...
Setting up hplip-gui (3.17.10+repack0-5) ...
Processing triggers for desktop-file-utils (0.23-1ubuntu3.18.04.2) ...
Processing triggers for cups (2.2.7-1ubuntu2.7) ...
Processing triggers for man-db (2.8.3-2ubuntu0.1) ...
Processing triggers for gnome-menus (3.13.3-11ubuntu1.1) ...
Processing triggers for dbus (1.12.2-1ubuntu1.1) ...
Processing triggers for mime-support (3.60ubuntu1) ...
-----------------------------------------------------

This is might be the error:
Can't open /etc/hp/hplip.conf: No such file or directory.
Can't open /etc/hp/hplip.conf: No such file or directory.

Also everytime I ran hp-setup or hp-check (etc) it tells that the version is 0.0.0
------------------------------
HP Linux Imaging and Printing System ...

Read more...

Revision history for this message
Graham White (graham-o) wrote :

I have an HP Laserjet Pro M102a printer, and I cannot get it to work with my Ubuntu
machine: the error message is always some variant of "models.dat not found" (and, indeed,
I cannot find any models.datfile in any of the obvious places). This is very like the
previous problems described in this thread.

Revision history for this message
Concrete Gannet (paul-cohsoft) wrote :

I had the same problem.

For some reason, the Debian package wasn't installing /etc/hp/hplip.conf.

Adding that file with the following contents fixed the error, so the HPLIP utilities could find the models.dat file.

--------
[hplip]
version=3.21.2

[dirs]
home=/usr/share/hplip
--------

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.