Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 643910 - app-text/calibre-3.15.0::gentoo Importing PyQt4 is not allowed as calibre uses PyQt5
Summary: app-text/calibre-3.15.0::gentoo Importing PyQt4 is not allowed as calibre use...
Status: RESOLVED UPSTREAM
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: Current packages (show other bugs)
Hardware: All Linux
: Normal normal (vote)
Assignee: Zac Medico
URL:
Whiteboard:
Keywords:
: 643908 (view as bug list)
Depends on:
Blocks:
 
Reported: 2018-01-08 16:01 UTC by Jonas Stein
Modified: 2023-10-19 23:53 UTC (History)
4 users (show)

See Also:
Package list:
Runtime testing required: ---


Attachments
emerge --info (emerge--info.txt,5.79 KB, text/plain)
2018-01-08 16:01 UTC, Jonas Stein
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Jonas Stein gentoo-dev 2018-01-08 16:01:18 UTC
Created attachment 513770 [details]
emerge --info

dev-python/PyQt4-4.12.1
and dev-python/PyQt5-5.9.2
are installed here.

calibre writes to stdout after startup:

Traceback (most recent call last):
  File "/usr/lib64/calibre/calibre/gui2/store/loader.py", line 91, in load_cache
    obj, ver = self.load_object(src, key)
  File "/usr/lib64/calibre/calibre/gui2/store/loader.py", line 178, in load_object
    exec src in namespace
  File "<string>", line 17, in <module>
  File "/usr/lib64/calibre/calibre/startup.py", line 36, in load_module
    raise ImportError('Importing PyQt4 is not allowed as calibre uses PyQt5')
Comment 1 Zac Medico gentoo-dev 2018-01-08 17:46:01 UTC
Maybe this shows something:

grep -r PyQt4 ~/.config/calibre
Comment 2 Jonas Stein gentoo-dev 2018-01-08 22:30:50 UTC
Thank you. grep -r PyQt4 ~/.config/calibre returns a hit

"kobo": "# -*-\n\nfrom __future__ import (unicode_literals, division, absolute_import, print_function)\nstore_version = 2 # Needed for dynamic plugin loading\n\n__license__ = 'GPL 3'\n__copyright__ = '2011, John Schember <john@nachtimwald.com>'\n__docformat__ = 'restructuredtext en'\n\nimport random\nimport urllib\nimport urllib2\nfrom contextlib import closing\n\nfrom lxml import html\n\nfrom PyQt4.Qt import QUrl\n\nfrom calibre import browser,
[..]

I think now that the message I saw was not two bugs, but one. So I will close the other ticket as duplicate and paste the complete output here.

----8<-----------------------------------------------------------------
$ calibre
Failed to load cached store: kobo
Traceback (most recent call last):
  File "/usr/lib64/calibre/calibre/gui2/store/loader.py", line 91, in load_cache
    obj, ver = self.load_object(src, key)
  File "/usr/lib64/calibre/calibre/gui2/store/loader.py", line 178, in load_object
    exec src in namespace
  File "<string>", line 17, in <module>
  File "/usr/lib64/calibre/calibre/startup.py", line 36, in load_module
    raise ImportError('Importing PyQt4 is not allowed as calibre uses PyQt5')
ImportError: Importing PyQt4 is not allowed as calibre uses PyQt5
Failed to load cached store: google_books
Traceback (most recent call last):
  File "/usr/lib64/calibre/calibre/gui2/store/loader.py", line 91, in load_cache
    obj, ver = self.load_object(src, key)
  File "/usr/lib64/calibre/calibre/gui2/store/loader.py", line 178, in load_object
    exec src in namespace
  File "<string>", line 15, in <module>
  File "/usr/lib64/calibre/calibre/startup.py", line 36, in load_module
    raise ImportError('Importing PyQt4 is not allowed as calibre uses PyQt5')
ImportError: Importing PyQt4 is not allowed as calibre uses PyQt5
Failed to load cached store: woblink
Traceback (most recent call last):
  File "/usr/lib64/calibre/calibre/gui2/store/loader.py", line 91, in load_cache
    obj, ver = self.load_object(src, key)
  File "/usr/lib64/calibre/calibre/gui2/store/loader.py", line 178, in load_object
    exec src in namespace
  File "<string>", line 17, in <module>
  File "/usr/lib64/calibre/calibre/startup.py", line 36, in load_module
    raise ImportError('Importing PyQt4 is not allowed as calibre uses PyQt5')
ImportError: Importing PyQt4 is not allowed as calibre uses PyQt5

----8<-----------------------------------------------------------------

My plugin settins say that no plugin is activated.
Perhaps an upstream bug that they try to load an obsolete plugin even if it is disabled?
Comment 3 Jonas Stein gentoo-dev 2018-01-08 22:31:35 UTC
*** Bug 643908 has been marked as a duplicate of this bug. ***
Comment 4 Zac Medico gentoo-dev 2018-01-09 06:59:09 UTC
Since upstream doesn't support install from source, you might try to reproduce the issue using an "isolated" install in ~/calibre-bin, as described near the end of the binary install section here:

https://calibre-ebook.com/download_linux
Comment 5 Eli Schwartz 2023-10-19 23:53:28 UTC
Current versions of calibre don't even include this error message. It was removed in 2020 as part of the bump to calibre 5.0.0

In calibre 6.x an import hook is installed that redirects these to aliased modules via `import qt.core` etc (internal calibre module).

(And for context, this isn't a binary install vs from source install issue. You should get the same issue with the upstream bins, if you have an outdated config file. I cannot remember anymore but I *think* at some point a migration tool was added that cleaned up stale references baked into config files -- you'd still get the error for plugins of course, but that's expected as the plugin would need to be updated to support PyQt5.)