Calibre doesn't open (ImportError: libicui18n.so.67)

When I run calibre, it gives me an error and quits. Here is the error message:

Traceback (most recent call last):
  File "/usr/bin/calibre", line 21, in <module>
    sys.exit(calibre())
  File "/usr/lib/calibre/calibre/gui_launch.py", line 72, in calibre
    from calibre.gui2.main import main
  File "/usr/lib/calibre/calibre/gui2/main.py", line 12, in <module>
    import apsw
ImportError: libicui18n.so.67: não é possível abrir arquivo compartilhado: Arquivo ou diretório inexistente

So I tried creating symlinks for the libraries that it searched, but I ended up with a different error:

Traceback (most recent call last):
  File "/usr/bin/calibre", line 21, in <module>
    sys.exit(calibre())
  File "/usr/lib/calibre/calibre/gui_launch.py", line 72, in calibre
    from calibre.gui2.main import main
  File "/usr/lib/calibre/calibre/gui2/main.py", line 12, in <module>
    import apsw
ImportError: /home/user/.local/lib/python3.9/site-packages/apsw.cpython-39-x86_64-linux-gnu.so: undefined symbol: u_strToLower_67

I already deleted the symlinks and the error returned to the initial. I don’t know how to fix it, so I hope someone can help.

It’s looking for an older library from ICU 67, but we’ve had ICU 69 for months.

Are you fully up to date?

sudo pacman-mirrors -f5 && sudo pacman -Syyu

I executed this command and looks like that I’m fully up to date already. I read in the dependencies file at GitHub and it looks like that Calibre still depends on ICU 67.

What version of Calibre and ICU do you have installed?

pacman -Qi calibre icu | grep Version

Here is the output.

Version               : 5.20.0-1
Version               : 69.1-1

That file is only used for building installers, that’s not used in our package. Calibre has been built with ICU 69.1 since 5.14.0-2 in April. I have no issues with 5.21.0-1 in the unstable branch.

The error you’re receiving shouldn’t be happening and the following shouldn’t be necessary, but since we’re here, why not? You can try rebuilding Calibre:

sudo pacman -S --needed base-devel
mkdir calibre
cd calibre
curl "https://raw.githubusercontent.com/archlinux/svntogit-community/0c13f6a2fa8f4a9f90dc62225412e92b699c32c9/trunk/PKGBUILD" --output PKGBUILD
makepkg -srcif

Well, it seems like I don’t have trusted the PGP signature of the downloaded file. I don’t know if it’s very important for the security, so… Can I skip the PGP check?

This also looks weird. Seems more a problem with your local python install. Why do you have modules installed in your home that are going to be sourced with system packages.

I do not know either.

So fix your python environment and try starting calibre again.

How do I do that? Can I only uninstall aspw from pip?

ImportError: libicui18n.so.67: cannot open shared object file: No such file or directory
==> ERRO: Uma falha ocorreu em check().

It returned an error at the end, so it didn’t install.

Ah, good catch. We’re on to something here.

You could try that. You should be using a virtual environment to keep local Python packages separate from the system.

Please post the full build log to a pastebin service and post the link here.

I did try that, but it returned an error. I don’t have much experience with pip and Python in general.

Found existing installation: apsw 3.35.4.post1
ERROR: Cannot uninstall 'apsw'. It is a distutils installed project and thus we cannot accurately determine which files belong to it which would lead to only a partial uninstall.

That depends on how you set up your own python environment. How did you set it up?

On a normal system aspw is provided by the system package python-apsw and is installed in /usr/lib/...

I did put in GitHub Gist the whole terminal output.

I have python-apsw installed. And I don’t know exactly how did I set up my python environment, I’d only use it for installing a Discord bot and ProtonVPN (and the Discord bot (Red) did use a virtual environment).

Again, an issue with your local aspw install:

  File "/home/felipe/calibre/src/calibre-5.20.0/src/calibre/db/backend.py", line 13, in <module>
    import apsw

I realized that it did have 2 apsw packages installed, one that was the system package (apsw), and another that was installed by the bot (apsw-wheels). I uninstalled the latter and opened Calibre, so… it worked. Thank you all for helping me in this issue. :slight_smile:

(So what do I mark as solution?)

Good question. I just marked your post as the solution so it’s easier to see what happend. :wink: