I installed calibre using community repo, but it doesn’t work no matter what I try to do with it, view a file or convert it. I can’t open epub and chm files using Okular too. I think they are related and it is related to something being wrong in the system. Here an example of error I get when I try to open a epub file with clibre. It mentions html5-parser and libxml2 library. I am new both to Linux as my OS and EOS. Can someone help me to figure out what is going on here?
Here is the error:
ebook-viewer epubtest2.epub
Traceback (most recent call last):
File "/usr/bin/ebook-viewer", line 21, in <module>
sys.exit(ebook_viewer())
File "/usr/lib/calibre/calibre/gui_launch.py", line 101, in wrapper
return func(*a, **kw)
File "/usr/lib/calibre/calibre/gui_launch.py", line 116, in ebook_viewer
from calibre.gui2.viewer.main import main
File "/usr/lib/calibre/calibre/gui2/viewer/main.py", line 15, in <module>
from calibre.gui2.viewer.ui import EbookViewer, is_float
File "/usr/lib/calibre/calibre/gui2/viewer/ui.py", line 29, in <module>
from calibre.gui2.viewer.annotations import (
File "/usr/lib/calibre/calibre/gui2/viewer/annotations.py", line 11, in <module>
from calibre.gui2.viewer.convert_book import update_book
File "/usr/lib/calibre/calibre/gui2/viewer/convert_book.py", line 16, in <module>
from calibre.srv.render_book import RENDER_VERSION
File "/usr/lib/calibre/calibre/srv/render_book.py", line 25, in <module>
from calibre.ebooks.oeb.polish.container import Container as ContainerBase
File "/usr/lib/calibre/calibre/ebooks/oeb/polish/container.py", line 42, in <module>
from calibre.ebooks.oeb.polish.parsing import parse as parse_html_tweak
File "/usr/lib/calibre/calibre/ebooks/oeb/polish/parsing.py", line 10, in <module>
import html5_parser
File "/usr/lib/python3.10/site-packages/html5_parser/__init__.py", line 31, in <module>
raise RuntimeError(
RuntimeError: html5-parser and lxml are using different versions of libxml2. This happens commonly when using pip installed versions of lxml. Use pip install --no-binary lxml lxml instead. libxml2 versions: html5-parser: (2, 10, 3) != lxml: (2, 9, 14)
I don’t think done sudo pip, I am not 100% sure but it is very unlikely. I have done sudo yay couple of times by mistake tho.
I just a pacman -Syu yesterday. Should I do it again? I have installed calibre and okular sometime ago but never tested these features in them, so I don’t know if they have been like this from start or it is something new.
I don’t see any reference that you uninstalled calibre and okular, reboot, and then reinstall them. I’d try that. I use calibre and sigil often and they work well on EOS.
No I didn’t reinstall them, was not sure if that has a effect on their dependencies as it looks like that it is the issue here, I will give it a try later in night as I am going to turn it off.
The runtime exception occurred because the html5-parser on your machine uses libxml2 version 2.10.3 but your python-lxml uses version 2.9.14 of libxml2. Calibre runs without any issues on my machine, so it’s likely that you messed up somewhere (a partial upgrade or the use of other package managers like pip).
The latest version of the libxml2 package on the core repo (pacman -Ss libxml2) is 2.10.3-2, the same version that your html5-parser is using. This narrows things down because you now know that it is libxml2 that’s causing the problem—there are 2 versions of libxml2 installed on your system somehow. My guess is that you installed libxml2 version 2.9.14 as a dependency of another package (perhaps a package installed via pip?).
Your best course of action right now is to uninstall calibre (sudo pacman -Rns calibre), and then reinstall it with sudo pacman -Syu calibre. If you’re lucky, pacman will take care of everything and install all the dependencies required for calibre to run. During re-installation, pacman should notify you if there are conflicting versions of libxml2 installed on your system, you can decide on a further course of action then.
I would primary advise to not use Calibre from the repositories but directly from https://calibre-ebook.com/download_linux installed into e.g. /opt. It as mentioned there includes all dependencies and tends to Just Work – if that’s your thing.
Interesting, I had no idea I can install binary like this, Is it safe to use? I mean can I uninstall this kind of install like an AppImage easily. I am going to give it a try anyway, just want to know how this way of installing actually works and be prepared.
Yes, it’s safe. At install time you will be asked to create a bunch of links in /usr/bin/; other than those, a few /usr/share/applications/ .desktop files and /usr/share/icons/ icons – and as per request a nice /usr/bin/calibre-uninstall – all will be directly under /opt.