原创

[linux]解决Calibre 在manjaro中运行不了

前言

最近升级了python3,然后发现Calibre 运行不了了,现象是点击桌面图标没有反应.使用命令行:calibre-debug -g
提示如下:


[ya@ya-PC ~]$ calibre-debug -g
Traceback (most recent call last):
  File "/usr/bin/calibre-debug", line 20, in <module>
    from calibre.debug import main
  File "/usr/lib/calibre/calibre/__init__.py", line 22, in <module>
    initialize_calibre()
  File "/usr/lib/calibre/calibre/startup.py", line 103, in initialize_calibre
    set_translators()
  File "/usr/lib/calibre/calibre/utils/localization.py", line 270, in set_translators
    q = translator_for_lang(lang)
  File "/usr/lib/calibre/calibre/utils/localization.py", line 217, in translator_for_lang
    mpath = get_lc_messages_path(lang)
  File "/usr/lib/calibre/calibre/utils/localization.py", line 110, in get_lc_messages_path
    if lang in available_translations():
  File "/usr/lib/calibre/calibre/utils/localization.py", line 23, in available_translations
    stats = msgpack_loads(f.read())
  File "/usr/lib/calibre/calibre/utils/serialize.py", line 106, in msgpack_loads
    import msgpack
ModuleNotFoundError: No module named 'msgpack'

解决

不说废话,直接上脚本

pip3 install msgpack zeroconf pyqt5 apsw regex mechanize html5_parser css_parser

修改

sudo vim /usr/share/applications/calibre-gui.desktop

TryExec=python3 /usr/bin/calibre --detach %U
Exec=python3 /usr/bin/calibre --detach %U
TryExec=calibre,改为TryExec=python3 /usr/bin/calibre --detach %U
Exec=calibre --detach %U,改为Exec=python3 calibre --detach %U

解决成功了!

排查过程

我的python版本

[ya@ya-PC ~]$ python3 --version
Python 3.9.10

安装缺失的模块

Looking in indexes: https://pypi.tuna.tsinghua.edu.cn/simple
Collecting msgpack
  Downloading https://pypi.tuna.tsinghua.edu.cn/packages/a2/21/bb54bb34300ac36813e2468acf29262fac3b9d35f58a28e518cb9bceddfd/msgpack-1.0.3-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (322 kB)
     |████████████████████████████████| 322 kB 2.2 MB/s 
Installing collected packages: msgpack
Successfully installed msgpack-1.0.3
WARNING: You are using pip version 21.2.4; however, version 22.1.1 is available.
You should consider upgrading via the '/home/ya/.pyenv/versions/3.9.10/bin/python3.9 -m pip install --upgrade pip' command.

有其他错误了

[ya@ya-PC ~]$ calibre-debug -g
calibre 5.42  embedded-python: False is64bit: True
Linux-5.10.117-1-MANJARO-x86_64-with-glibc2.35 Linux ('64bit', 'ELF')
('Linux', '5.10.117-1-MANJARO', '#1 SMP PREEMPT Wed May 18 09:22:50 UTC 2022')
Python 3.9.10
Interface language: zh_CN
Failed to import PyQt module: PyQt5.QtCore with error: No module named 'PyQt5'
Failed to initialize plugin: '/home/ya/.config/calibre/plugins/DeDRM.zip'
Traceback (most recent call last):
  File "/usr/lib/calibre/calibre/customize/ui.py", line 740, in initialize_plugins
    plugin = load_plugin(zfp) if not isinstance(zfp, type) else zfp
  File "/usr/lib/calibre/calibre/customize/ui.py", line 64, in load_plugin
    return loader.load(path_to_zip_file)
  File "/usr/lib/calibre/calibre/customize/zipplugin.py", line 292, in load
    m = importlib.import_module(plugin_module)
  File "/home/ya/.pyenv/versions/3.9.10/lib/python3.9/importlib/__init__.py", line 127, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
  File "<frozen importlib._bootstrap>", line 1030, in _gcd_import
  File "<frozen importlib._bootstrap>", line 1007, in _find_and_load
  File "<frozen importlib._bootstrap>", line 986, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 680, in _load_unlocked
  File "/usr/lib/calibre/calibre/customize/zipplugin.py", line 191, in exec_module
    exec(compiled, module.__dict__)
  File "calibre_plugins.dedrm.__init__", line 100, in <module>
    from calibre.gui2 import is_ok_to_use_qt
  File "/usr/lib/calibre/calibre/gui2/__init__.py", line 12, in <module>
    from qt.core import (
ImportError: cannot import name 'QT_VERSION' from 'qt.core' (/usr/lib/calibre/qt/core.py)
Failed to initialize plugin: SmartDevice App Interface (0, 0, 1)
Failed to initialize plugin: <class 'calibre.devices.smart_device_app.driver.SMART_DEVICE_APP'>
Traceback (most recent call last):
  File "/usr/lib/calibre/calibre/devices/smart_device_app/driver.py", line 2182, in monkeypatch_zeroconf
    from zeroconf._utils.name import service_type_name
ModuleNotFoundError: No module named 'zeroconf'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/lib/calibre/calibre/customize/ui.py", line 671, in initialize_plugin
    p = plugin(path_to_zip_file)
  File "/usr/lib/calibre/calibre/devices/smart_device_app/driver.py", line 396, in __init__
    monkeypatch_zeroconf()
  File "/usr/lib/calibre/calibre/devices/smart_device_app/driver.py", line 2185, in monkeypatch_zeroconf
    import zeroconf
ModuleNotFoundError: No module named 'zeroconf'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/lib/calibre/calibre/customize/ui.py", line 745, in initialize_plugins
    plugin = initialize_plugin(
  File "/usr/lib/calibre/calibre/customize/ui.py", line 678, in initialize_plugin
    raise InvalidPlugin((_('Initialization of plugin %s failed with traceback:')
calibre.customize.InvalidPlugin: 初始化插件 Traceback (most recent call last):
  File "/usr/lib/calibre/calibre/devices/smart_device_app/driver.py", line 2182, in monkeypatch_zeroconf
    from zeroconf._utils.name import service_type_name
ModuleNotFoundError: No module named 'zeroconf'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/lib/calibre/calibre/customize/ui.py", line 671, in initialize_plugin
    p = plugin(path_to_zip_file)
  File "/usr/lib/calibre/calibre/devices/smart_device_app/driver.py", line 396, in __init__
    monkeypatch_zeroconf()
  File "/usr/lib/calibre/calibre/devices/smart_device_app/driver.py", line 2185, in monkeypatch_zeroconf
    import zeroconf
ModuleNotFoundError: No module named 'zeroconf'
 失败,跟踪:
Traceback (most recent call last):
  File "/usr/lib/calibre/calibre/devices/smart_device_app/driver.py", line 2182, in monkeypatch_zeroconf
    from zeroconf._utils.name import service_type_name
ModuleNotFoundError: No module named 'zeroconf'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/lib/calibre/calibre/customize/ui.py", line 671, in initialize_plugin
    p = plugin(path_to_zip_file)
  File "/usr/lib/calibre/calibre/devices/smart_device_app/driver.py", line 396, in __init__
    monkeypatch_zeroconf()
  File "/usr/lib/calibre/calibre/devices/smart_device_app/driver.py", line 2185, in monkeypatch_zeroconf
    import zeroconf
ModuleNotFoundError: No module named 'zeroconf'

Successfully initialized third party plugins: Douban Books (3, 2, 0)
Traceback (most recent call last):
  File "/usr/bin/calibre-debug", line 21, in <module>
    sys.exit(main())
  File "/usr/lib/calibre/calibre/debug.py", line 264, in main
    calibre(['calibre'] + args[1:])
  File "/usr/lib/calibre/calibre/gui_launch.py", line 62, in calibre
    from calibre.gui2.main import main
  File "/usr/lib/calibre/calibre/gui2/__init__.py", line 12, in <module>
    from qt.core import (
ImportError: cannot import name 'QT_VERSION' from 'qt.core' (/usr/lib/calibre/qt/core.py)

安装zeroconf


[ya@ya-PC ~]$ pip3 install zeroconf
Looking in indexes: https://pypi.tuna.tsinghua.edu.cn/simple
Collecting zeroconf
  Using cached https://pypi.tuna.tsinghua.edu.cn/packages/d5/9e/b65de6eca8ebfc5193a0ce61149266d6186ea72375ba4676bc5d49027b58/zeroconf-0.38.6-py3-none-any.whl (106 kB)
Collecting ifaddr>=0.1.7
  Downloading https://pypi.tuna.tsinghua.edu.cn/packages/92/0f/a577a724c03982b800232713874e805c8fcc14f4a2c3060902ed20b50da8/ifaddr-0.1.7-py2.py3-none-any.whl (10 kB)
Installing collected packages: ifaddr, zeroconf
Successfully installed ifaddr-0.1.7 zeroconf-0.38.6
WARNING: You are using pip version 21.2.4; however, version 22.1.1 is available.
You should consider upgrading via the '/home/ya/.pyenv/versions/3.9.10/bin/python3.9 -m pip install --upgrade pip' command.

再运行一次

[ya@ya-PC ~]$ calibre-debug -g
calibre 5.42  embedded-python: False is64bit: True
Linux-5.10.117-1-MANJARO-x86_64-with-glibc2.35 Linux ('64bit', 'ELF')
('Linux', '5.10.117-1-MANJARO', '#1 SMP PREEMPT Wed May 18 09:22:50 UTC 2022')
Python 3.9.10
Interface language: zh_CN
Failed to import PyQt module: PyQt5.QtCore with error: No module named 'PyQt5'
Failed to initialize plugin: '/home/ya/.config/calibre/plugins/DeDRM.zip'
Traceback (most recent call last):
  File "/usr/lib/calibre/calibre/customize/ui.py", line 740, in initialize_plugins
    plugin = load_plugin(zfp) if not isinstance(zfp, type) else zfp
  File "/usr/lib/calibre/calibre/customize/ui.py", line 64, in load_plugin
    return loader.load(path_to_zip_file)
  File "/usr/lib/calibre/calibre/customize/zipplugin.py", line 292, in load
    m = importlib.import_module(plugin_module)
  File "/home/ya/.pyenv/versions/3.9.10/lib/python3.9/importlib/__init__.py", line 127, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
  File "<frozen importlib._bootstrap>", line 1030, in _gcd_import
  File "<frozen importlib._bootstrap>", line 1007, in _find_and_load
  File "<frozen importlib._bootstrap>", line 986, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 680, in _load_unlocked
  File "/usr/lib/calibre/calibre/customize/zipplugin.py", line 191, in exec_module
    exec(compiled, module.__dict__)
  File "calibre_plugins.dedrm.__init__", line 100, in <module>
    from calibre.gui2 import is_ok_to_use_qt
  File "/usr/lib/calibre/calibre/gui2/__init__.py", line 12, in <module>
    from qt.core import (
ImportError: cannot import name 'QT_VERSION' from 'qt.core' (/usr/lib/calibre/qt/core.py)
Successfully initialized third party plugins: Douban Books (3, 2, 0)
Traceback (most recent call last):
  File "/usr/bin/calibre-debug", line 21, in <module>
    sys.exit(main())
  File "/usr/lib/calibre/calibre/debug.py", line 264, in main
    calibre(['calibre'] + args[1:])
  File "/usr/lib/calibre/calibre/gui_launch.py", line 62, in calibre
    from calibre.gui2.main import main
  File "/usr/lib/calibre/calibre/gui2/__init__.py", line 12, in <module>
    from qt.core import (
ImportError: cannot import name 'QT_VERSION' from 'qt.core' (/usr/lib/calibre/qt/core.py)
[ya@ya-PC ~]$

安装pyqt5


[ya@ya-PC ~]$ pip3 install pyqt5
Looking in indexes: https://pypi.tuna.tsinghua.edu.cn/simple
Collecting pyqt5
  Downloading https://pypi.tuna.tsinghua.edu.cn/packages/36/66/19983d471c702e551a19a7225a92a7c1efadd961f6c650110ed906dd0ed7/PyQt5-5.15.6-cp36-abi3-manylinux1_x86_64.whl (8.3 MB)
     |████████████████████████████████| 8.3 MB 1.5 MB/s 
Collecting PyQt5-Qt5>=5.15.2
  Downloading https://pypi.tuna.tsinghua.edu.cn/packages/83/d4/241a6a518d0bcf0a9fcdcbad5edfed18d43e884317eab8d5230a2b27e206/PyQt5_Qt5-5.15.2-py3-none-manylinux2014_x86_64.whl (59.9 MB)
     |████████████████████████████████| 59.9 MB 1.0 MB/s 
Collecting PyQt5-sip<13,>=12.8
  Downloading https://pypi.tuna.tsinghua.edu.cn/packages/97/57/8184b508414b1ff1b334d42e74bf07b0e586941eb2c26d50f39fbd4119fc/PyQt5_sip-12.10.1-cp39-cp39-manylinux1_x86_64.whl (349 kB)
     |████████████████████████████████| 349 kB 4.0 MB/s 
Installing collected packages: PyQt5-sip, PyQt5-Qt5, pyqt5
Successfully installed PyQt5-Qt5-5.15.2 PyQt5-sip-12.10.1 pyqt5-5.15.6
WARNING: You are using pip version 21.2.4; however, version 22.1.1 is available.
You should consider upgrading via the '/home/ya/.pyenv/versions/3.9.10/bin/python3.9 -m pip install --upgrade pip' command.

继续运行

[ya@ya-PC ~]$ calibre-debug -g
calibre 5.42  embedded-python: False is64bit: True
Linux-5.10.117-1-MANJARO-x86_64-with-glibc2.35 Linux ('64bit', 'ELF')
('Linux', '5.10.117-1-MANJARO', '#1 SMP PREEMPT Wed May 18 09:22:50 UTC 2022')
Python 3.9.10
Interface language: zh_CN
Successfully initialized third party plugins: DeDRM (7, 0, 3) && Douban Books (3, 2, 0)
Traceback (most recent call last):
  File "/usr/bin/calibre-debug", line 21, in <module>
    sys.exit(main())
  File "/usr/lib/calibre/calibre/debug.py", line 264, in main
    calibre(['calibre'] + args[1:])
  File "/usr/lib/calibre/calibre/gui_launch.py", line 62, in calibre
    from calibre.gui2.main import main
  File "/usr/lib/calibre/calibre/gui2/main.py", line 11, in <module>
    import apsw
ModuleNotFoundError: No module named 'apsw'

安装apsw

[ya@ya-PC ~]$ pip3 install apsw
Looking in indexes: https://pypi.tuna.tsinghua.edu.cn/simple
Collecting apsw
  Downloading https://pypi.tuna.tsinghua.edu.cn/packages/d1/44/96d731035e858bdd610b130ed868c0e6d252e1336cffe33836e37e7582f0/apsw-3.36.0.post1-cp39-cp39-manylinux1_x86_64.whl (3.3 MB)
     |████████████████████████████████| 3.3 MB 1.4 MB/s 
Installing collected packages: apsw
Successfully installed apsw-3.36.0.post1
WARNING: You are using pip version 21.2.4; however, version 22.1.1 is available.
You should consider upgrading via the '/home/ya/.pyenv/versions/3.9.10/bin/python3.9 -m pip install --upgrade pip' command.
[ya@ya-PC ~]$

再再运行


[ya@ya-PC ~]$ calibre-debug -g
calibre 5.42  embedded-python: False is64bit: True
Linux-5.10.117-1-MANJARO-x86_64-with-glibc2.35 Linux ('64bit', 'ELF')
('Linux', '5.10.117-1-MANJARO', '#1 SMP PREEMPT Wed May 18 09:22:50 UTC 2022')
Python 3.9.10
Interface language: zh_CN
Successfully initialized third party plugins: DeDRM (7, 0, 3) && Douban Books (3, 2, 0)
Not controlling automatic hidpi scaling
devicePixelRatio: 1.0
logicalDpi: 96.0 x 96.25263157894737
physicalDpi: 157.8252427184466 x 157.65517241379308
Using calibre Qt style: True
Failed to read metadata from font file: /usr/share/fonts/TTF/TSCu_Times.ttf tuple index out of range
Failed to read metadata from font file: /usr/share/fonts/TTF/TSCu_Comic.ttf tuple index out of range
Traceback (most recent call last):
  File "/usr/bin/calibre-debug", line 21, in <module>
    sys.exit(main())
  File "/usr/lib/calibre/calibre/debug.py", line 264, in main
    calibre(['calibre'] + args[1:])
  File "/usr/lib/calibre/calibre/gui_launch.py", line 63, in calibre
    main(args)
  File "/usr/lib/calibre/calibre/gui2/main.py", line 538, in main
    run_main(app, opts, args, gui_debug, si)
  File "/usr/lib/calibre/calibre/gui2/main.py", line 545, in run_main
    return run_gui(opts, args, app, gui_debug=gui_debug)
  File "/usr/lib/calibre/calibre/gui2/main.py", line 402, in run_gui
    run_gui_(opts, args, app, gui_debug)
  File "/usr/lib/calibre/calibre/gui2/main.py", line 412, in run_gui_
    from calibre.gui2.ui import Main
  File "/usr/lib/calibre/calibre/gui2/ui.py", line 32, in <module>
    from calibre.db.legacy import LibraryDatabase
  File "/usr/lib/calibre/calibre/db/legacy.py", line 17, in <module>
    from calibre.db.backend import DB, set_global_state as backend_set_global_state
  File "/usr/lib/calibre/calibre/db/backend.py", line 26, in <module>
    from calibre.db.annotations import annot_db_data, unicode_normalize
  File "/usr/lib/calibre/calibre/db/annotations.py", line 7, in <module>
    from calibre.ebooks.epub.cfi.parse import cfi_sort_key
  File "/usr/lib/calibre/calibre/ebooks/epub/cfi/parse.py", line 7, in <module>
    import regex
ModuleNotFoundError: No module named 'regex'

安装regex


[ya@ya-PC ~]$ pip3 install regex
Looking in indexes: https://pypi.tuna.tsinghua.edu.cn/simple
Collecting regex
  Downloading https://pypi.tuna.tsinghua.edu.cn/packages/39/91/94fcecafa6d904b3b6ae4a4f4bfb18cb427728a0bb631bf3ebbcf8451f93/regex-2022.4.24-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (763 kB)
     |████████████████████████████████| 763 kB 4.0 MB/s 
Installing collected packages: regex
Successfully installed regex-2022.4.24
WARNING: You are using pip version 21.2.4; however, version 22.1.1 is available.
You should consider upgrading via the '/home/ya/.pyenv/versions/3.9.10/bin/python3.9 -m pip install --upgrade pip' command.
[ya@ya-PC ~]$

再再再运行


[ya@ya-PC ~]$ calibre-debug -g
calibre 5.42  embedded-python: False is64bit: True
Linux-5.10.117-1-MANJARO-x86_64-with-glibc2.35 Linux ('64bit', 'ELF')
('Linux', '5.10.117-1-MANJARO', '#1 SMP PREEMPT Wed May 18 09:22:50 UTC 2022')
Python 3.9.10
Interface language: zh_CN
Successfully initialized third party plugins: DeDRM (7, 0, 3) && Douban Books (3, 2, 0)
Not controlling automatic hidpi scaling
devicePixelRatio: 1.0
logicalDpi: 96.0 x 96.25263157894737
physicalDpi: 157.8252427184466 x 157.65517241379308
Using calibre Qt style: True
Failed to read metadata from font file: /usr/share/fonts/TTF/TSCu_Times.ttf tuple index out of range
Failed to read metadata from font file: /usr/share/fonts/TTF/TSCu_Comic.ttf tuple index out of range
Traceback (most recent call last):
  File "/usr/bin/calibre-debug", line 21, in <module>
    sys.exit(main())
  File "/usr/lib/calibre/calibre/debug.py", line 264, in main
    calibre(['calibre'] + args[1:])
  File "/usr/lib/calibre/calibre/gui_launch.py", line 63, in calibre
    main(args)
  File "/usr/lib/calibre/calibre/gui2/main.py", line 538, in main
    run_main(app, opts, args, gui_debug, si)
  File "/usr/lib/calibre/calibre/gui2/main.py", line 545, in run_main
    return run_gui(opts, args, app, gui_debug=gui_debug)
  File "/usr/lib/calibre/calibre/gui2/main.py", line 402, in run_gui
    run_gui_(opts, args, app, gui_debug)
  File "/usr/lib/calibre/calibre/gui2/main.py", line 412, in run_gui_
    from calibre.gui2.ui import Main
  File "/usr/lib/calibre/calibre/gui2/ui.py", line 42, in <module>
    from calibre.gui2.ebook_download import EbookDownloadMixin
  File "/usr/lib/calibre/calibre/gui2/ebook_download.py", line 8, in <module>
    from mechanize import MozillaCookieJar
ModuleNotFoundError: No module named 'mechanize'

安装mechanize

[ya@ya-PC ~]$ pip3 install mechanize
Looking in indexes: https://pypi.tuna.tsinghua.edu.cn/simple
Collecting mechanize
  Downloading https://pypi.tuna.tsinghua.edu.cn/packages/c2/19/00c387fc0c07f97affc78d92d4625d3845fa00f413efce1af44bc2bdda87/mechanize-0.4.8-py2.py3-none-any.whl (110 kB)
     |████████████████████████████████| 110 kB 1.7 MB/s 
Collecting html5lib>=0.999999999
  Downloading https://pypi.tuna.tsinghua.edu.cn/packages/6c/dd/a834df6482147d48e225a49515aabc28974ad5a4ca3215c18a882565b028/html5lib-1.1-py2.py3-none-any.whl (112 kB)
     |████████████████████████████████| 112 kB 6.2 MB/s 
Requirement already satisfied: six>=1.9 in ./.pyenv/versions/3.9.10/lib/python3.9/site-packages (from html5lib>=0.999999999->mechanize) (1.16.0)
Collecting webencodings
  Downloading https://pypi.tuna.tsinghua.edu.cn/packages/f4/24/2a3e3df732393fed8b3ebf2ec078f05546de641fe1b667ee316ec1dcf3b7/webencodings-0.5.1-py2.py3-none-any.whl (11 kB)
Installing collected packages: webencodings, html5lib, mechanize
Successfully installed html5lib-1.1 mechanize-0.4.8 webencodings-0.5.1
WARNING: You are using pip version 21.2.4; however, version 22.1.1 is available.
You should consider upgrading via the '/home/ya/.pyenv/versions/3.9.10/bin/python3.9 -m pip install --upgrade pip' command.

....再....运行

[ya@ya-PC ~]$ calibre-debug -g
calibre 5.42  embedded-python: False is64bit: True
Linux-5.10.117-1-MANJARO-x86_64-with-glibc2.35 Linux ('64bit', 'ELF')
('Linux', '5.10.117-1-MANJARO', '#1 SMP PREEMPT Wed May 18 09:22:50 UTC 2022')
Python 3.9.10
Interface language: zh_CN
Successfully initialized third party plugins: DeDRM (7, 0, 3) && Douban Books (3, 2, 0)
Not controlling automatic hidpi scaling
devicePixelRatio: 1.0
logicalDpi: 96.0 x 96.25263157894737
physicalDpi: 157.8252427184466 x 157.65517241379308
Using calibre Qt style: True
Failed to read metadata from font file: /usr/share/fonts/TTF/TSCu_Times.ttf tuple index out of range
Failed to read metadata from font file: /usr/share/fonts/TTF/TSCu_Comic.ttf tuple index out of range
Traceback (most recent call last):
  File "/usr/bin/calibre-debug", line 21, in <module>
    sys.exit(main())
  File "/usr/lib/calibre/calibre/debug.py", line 264, in main
    calibre(['calibre'] + args[1:])
  File "/usr/lib/calibre/calibre/gui_launch.py", line 63, in calibre
    main(args)
  File "/usr/lib/calibre/calibre/gui2/main.py", line 538, in main
    run_main(app, opts, args, gui_debug, si)
  File "/usr/lib/calibre/calibre/gui2/main.py", line 545, in run_main
    return run_gui(opts, args, app, gui_debug=gui_debug)
  File "/usr/lib/calibre/calibre/gui2/main.py", line 402, in run_gui
    run_gui_(opts, args, app, gui_debug)
  File "/usr/lib/calibre/calibre/gui2/main.py", line 412, in run_gui_
    from calibre.gui2.ui import Main
  File "/usr/lib/calibre/calibre/gui2/ui.py", line 44, in <module>
    from calibre.gui2.init import LayoutMixin, LibraryViewMixin
  File "/usr/lib/calibre/calibre/gui2/init.py", line 23, in <module>
    from calibre.gui2.library.views import BooksView, DeviceBooksView
  File "/usr/lib/calibre/calibre/gui2/library/views.py", line 19, in <module>
    from calibre.gui2.library.delegates import (RatingDelegate, PubDateDelegate,
  File "/usr/lib/calibre/calibre/gui2/library/delegates.py", line 25, in <module>
    from calibre.gui2.dialogs.comments_dialog import CommentsDialog, PlainTextDialog
  File "/usr/lib/calibre/calibre/gui2/dialogs/comments_dialog.py", line 14, in <module>
    from calibre.gui2.comments_editor import Editor
  File "/usr/lib/calibre/calibre/gui2/comments_editor.py", line 10, in <module>
    from html5_parser import parse
ModuleNotFoundError: No module named 'html5_parser'

安装html5_parser

[ya@ya-PC ~]$ pip3 install html5_parser
Looking in indexes: https://pypi.tuna.tsinghua.edu.cn/simple
Collecting html5_parser
  Downloading https://pypi.tuna.tsinghua.edu.cn/packages/e0/a1/f4e5d60919e8d1aeffc4aae4b41041b986081691a44798b4c77bf2585bf6/html5-parser-0.4.10.tar.gz (272 kB)
     |████████████████████████████████| 272 kB 1.4 MB/s 
Collecting chardet
  Downloading https://pypi.tuna.tsinghua.edu.cn/packages/19/c7/fa589626997dd07bd87d9269342ccb74b1720384a4d739a1872bd84fbe68/chardet-4.0.0-py2.py3-none-any.whl (178 kB)
     |████████████████████████████████| 178 kB 12.7 MB/s 
Requirement already satisfied: lxml>=3.8.0 in ./.pyenv/versions/3.9.10/lib/python3.9/site-packages (from html5_parser) (4.8.0)
Using legacy 'setup.py install' for html5-parser, since package 'wheel' is not installed.
Installing collected packages: chardet, html5-parser
    Running setup.py install for html5-parser ... done
Successfully installed chardet-4.0.0 html5-parser-0.4.10
WARNING: You are using pip version 21.2.4; however, version 22.1.1 is available.
You should consider upgrading via the '/home/ya/.pyenv/versions/3.9.10/bin/python3.9 -m pip install --upgrade pip' command.

再运行

[ya@ya-PC ~]$ calibre-debug -g
calibre 5.42  embedded-python: False is64bit: True
Linux-5.10.117-1-MANJARO-x86_64-with-glibc2.35 Linux ('64bit', 'ELF')
('Linux', '5.10.117-1-MANJARO', '#1 SMP PREEMPT Wed May 18 09:22:50 UTC 2022')
Python 3.9.10
Interface language: zh_CN
Successfully initialized third party plugins: DeDRM (7, 0, 3) && Douban Books (3, 2, 0)
Not controlling automatic hidpi scaling
devicePixelRatio: 1.0
logicalDpi: 96.0 x 96.25263157894737
physicalDpi: 157.8252427184466 x 157.65517241379308
Using calibre Qt style: True
Failed to read metadata from font file: /usr/share/fonts/TTF/TSCu_Times.ttf tuple index out of range
Failed to read metadata from font file: /usr/share/fonts/TTF/TSCu_Comic.ttf tuple index out of range
[0.00] Starting up...
[0.00] Showing splash screen...
[0.08] splash screen shown
[0.08] Initializing db...
[0.10] db initialized
[0.10] Constructing main UI...
Traceback (most recent call last):
  File "/usr/lib/calibre/calibre/gui2/ui.py", line 135, in __init__
    ac = self.init_iaction(action)
  File "/usr/lib/calibre/calibre/gui2/ui.py", line 153, in init_iaction
    ac = action.load_actual_plugin(self)
  File "/usr/lib/calibre/calibre/customize/__init__.py", line 624, in load_actual_plugin
    ac = getattr(importlib.import_module(mod), cls)(gui,
  File "/home/ya/.pyenv/versions/3.9.10/lib/python3.9/importlib/__init__.py", line 127, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
  File "<frozen importlib._bootstrap>", line 1030, in _gcd_import
  File "<frozen importlib._bootstrap>", line 1007, in _find_and_load
  File "<frozen importlib._bootstrap>", line 986, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 680, in _load_unlocked
  File "<frozen importlib._bootstrap_external>", line 850, in exec_module
  File "<frozen importlib._bootstrap>", line 228, in _call_with_frames_removed
  File "/usr/lib/calibre/calibre/gui2/actions/catalog.py", line 13, in <module>
    from calibre.gui2.tools import generate_catalog
  File "/usr/lib/calibre/calibre/gui2/tools.py", line 18, in <module>
    from calibre.gui2.convert.single import Config as SingleConfig
  File "/usr/lib/calibre/calibre/gui2/convert/single.py", line 23, in <module>
    from calibre.gui2.convert.look_and_feel import LookAndFeelWidget
  File "/usr/lib/calibre/calibre/gui2/convert/look_and_feel.py", line 12, in <module>
    from calibre.gui2.convert.look_and_feel_ui import Ui_Form
  File "/usr/lib/calibre/calibre/gui2/convert/look_and_feel_ui.py", line 299, in <module>
    from calibre.gui2.css_transform_rules import RulesWidget
  File "/usr/lib/calibre/calibre/gui2/css_transform_rules.py", line 10, in <module>
    from calibre.ebooks.css_transform_rules import (
  File "/usr/lib/calibre/calibre/ebooks/css_transform_rules.py", line 9, in <module>
    from css_parser.css import Property, CSSRule
ModuleNotFoundError: No module named 'css_parser'
qt.qpa.xcb: QXcbConnection: XCB error: 3 (BadWindow), sequence: 1099, resource id: 18118839, major code: 40 (TranslateCoords), minor code: 0

安装css_parser


[ya@ya-PC ~]$ pip3 install css_parser
Looking in indexes: https://pypi.tuna.tsinghua.edu.cn/simple
Collecting css_parser
  Downloading https://pypi.tuna.tsinghua.edu.cn/packages/3d/cb/826061990644e3c6ab69ffc2e2a51ca0a2c61b688957620f4ee2112049a1/css_parser-1.0.7-py2.py3-none-any.whl (197 kB)
     |████████████████████████████████| 197 kB 1.3 MB/s 
Installing collected packages: css-parser
Successfully installed css-parser-1.0.7
WARNING: You are using pip version 21.2.4; however, version 22.1.1 is available.
You should consider upgrading via the '/home/ya/.pyenv/versions/3.9.10/bin/python3.9 -m pip install --upgrade pip' command.

终于正经启动了

[ya@ya-PC ~]$ calibre-debug -g
calibre 5.42  embedded-python: False is64bit: True
Linux-5.10.117-1-MANJARO-x86_64-with-glibc2.35 Linux ('64bit', 'ELF')
('Linux', '5.10.117-1-MANJARO', '#1 SMP PREEMPT Wed May 18 09:22:50 UTC 2022')
Python 3.9.10
Interface language: zh_CN
Successfully initialized third party plugins: DeDRM (7, 0, 3) && Douban Books (3, 2, 0)
Not controlling automatic hidpi scaling
devicePixelRatio: 1.0
logicalDpi: 96.0 x 96.25263157894737
physicalDpi: 157.8252427184466 x 157.65517241379308
Using calibre Qt style: True
Failed to read metadata from font file: /usr/share/fonts/TTF/TSCu_Times.ttf tuple index out of range
Failed to read metadata from font file: /usr/share/fonts/TTF/TSCu_Comic.ttf tuple index out of range
[0.00] Starting up...
[0.00] Showing splash screen...
[0.07] splash screen shown
[0.07] Initializing db...
[0.08] db initialized
[0.08] Constructing main UI...
[1.36] main UI initialized...
[1.36] Hiding splash screen
Starting QuickView
Exception in thread Thread-7:
Traceback (most recent call last):
  File "/home/ya/.pyenv/versions/3.9.10/lib/python3.9/threading.py", line 973, in _bootstrap_inner
    self.run()
  File "/usr/lib/calibre/calibre/utils/mdns.py", line 42, in run
    _all_ip_addresses = self.get_all_ips()
  File "/usr/lib/calibre/calibre/utils/mdns.py", line 23, in get_all_ips
    import netifaces
ModuleNotFoundError: No module named 'netifaces'
[1.73] splash screen hidden
[1.73] Started up in 1.73 seconds with 42 books

本文来自:[linux]解决Calibre 在manjaro中运行不了-小码农,转载请保留本条链接,感谢!

温馨提示:
本文最后更新于 2022年05月28日,已超过 920 天没有更新。若文章内的图片失效(无法正常加载),请留言反馈或直接联系我
正文到此结束
本文目录