Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!

Bug 676664

Summary: app-text/calibre does not show cover images and can't obtain them
Product: Gentoo Linux Reporter: Paweł Ciechomski <ciechomke>
Component: Current packagesAssignee: Ian Stakenvicius (RETIRED) <axs>
Severity: normal CC: zmedico
Priority: Normal    
Version: unspecified   
Hardware: AMD64   
OS: Linux   
Package list:
Runtime testing required: ---
Attachments: Point no 1 and 2
Log from built in cover lookup tool
emerge --info

Description Paweł Ciechomski 2019-01-28 21:15:35 UTC
Created attachment 563140 [details]
Point no 1 and 2

Calibre in every available version has some problems with displaying covers.
1. It show generic Calibre cover in main window instead of the one used in book, cover is even without title and author.
2. Generating cover in calibre does nothing - new cover is not generated, always shows generic one.
3. Obtaining covers also does not work. Log says that it found covers and download them but it does not show them.

For me looks like some missing image processing related dependency since same versions works perfecly for me on other distros.
Comment 1 Paweł Ciechomski 2019-01-28 21:17:11 UTC
Created attachment 563142 [details]
Log from built in cover lookup tool
Comment 2 Paweł Ciechomski 2019-01-28 21:18:11 UTC
Created attachment 563144 [details]
emerge --info
Comment 3 Paweł Ciechomski 2019-02-02 09:01:54 UTC
Spend some time analyzing Calibre code and finally found a solution.
Calibre uses PyQt5 with USE=gui necessary to install. This flag pulls dev-qt/qtgui but Calibre ebuild does not enforce user to set USE=jpeg to dev-qt/qtgui which is needed to display and generate images, because Calibre uses QtImageWriter class and internally operates on jpeg images.

Adding USE=jpeg to dev-qt/qtgui solves the problem, tested on stable and newest version available in official overlay.

Proposed fix: require USE=jpeg for dev-qt/qtgui in Calibre ebuild
Comment 4 Nick 2020-07-17 19:02:49 UTC
Can confirm that this is still an issue with a fresh install of Calibre.  Attempting to manually apply cover art to a book yields the unhandled exception below.  Applying USE="jpeg" to dev-qt/qtgui rectifys the error.

calibre, version 4.9.1
ERROR: Unhandled exception: <b>ValueError</b>:Failed to export image as JPEG with error: Unsupported image format

calibre 4.9.1  embedded-python: False is64bit: True
Linux-4.19.66-gentoo-x86_64-Intel-R-_Core-TM-_i7-8550U_CPU_@_1.80GHz-with-gentoo-2.6 Linux ('64bit', 'ELF')
('Linux', '4.19.66-gentoo', '#8 SMP Thu Jul 9 10:40:18 EDT 2020')
Python 3.7.8
Linux: ('Gentoo Base System', '2.6', '')
Interface language: None
Traceback (most recent call last):
  File "/usr/lib64/calibre/calibre/gui2/metadata/", line 639, in accept
    if not self.apply_changes():
  File "/usr/lib64/calibre/calibre/gui2/metadata/", line 614, in apply_changes
    widget.commit(self.db, self.book_id)
  File "/usr/lib64/calibre/calibre/gui2/metadata/", line 1268, in commit
    db.set_cover(id_, self.current_val, notify=False, commit=False)
  File "/usr/lib64/calibre/calibre/db/", line 714, in set_cover
  File "/usr/lib64/calibre/calibre/db/", line 62, in call_func_with_lock
    return func(*args, **kwargs)
  File "/usr/lib64/calibre/calibre/db/", line 1253, in set_cover
    self.backend.set_cover(book_id, path, data)
  File "/usr/lib64/calibre/calibre/db/", line 1456, in set_cover
    save_cover_data_to(data, path)
  File "/usr/lib64/calibre/calibre/utils/", line 251, in save_cover_data_to
    f.write(image_to_data(img, compression_quality, fmt, compression_quality // 10) if changed else data)
  File "/usr/lib64/calibre/calibre/utils/", line 163, in image_to_data
    raise ValueError('Failed to export image as ' + fmt + ' with error: ' + w.errorString())
ValueError: Failed to export image as JPEG with error: Unsupported image format
Comment 5 Larry the Git Cow gentoo-dev 2020-07-17 19:52:54 UTC
The bug has been closed via the following commit(s):

commit 108b5f0b6207ccf5bb485c95e16869829f4422a0
Author:     Zac Medico <>
AuthorDate: 2020-07-17 19:48:03 +0000
Commit:     Zac Medico <>
CommitDate: 2020-07-17 19:52:47 +0000

    app-text/calibre: Require qtgui[jpeg]
    Package-Manager: Portage-2.3.103, Repoman-2.3.23
    Signed-off-by: Zac Medico <>

 app-text/calibre/calibre-4.9.1-r3.ebuild | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)