Installing Calibre on Ubuntu
November 16, 2022 1:24 AM   Subscribe

I haven't been able to update Calibre for several versions. This is a long shot but I'm hoping someone can help.

When I try to install the latest version of Calibre I get this error message:

Using python executable: /usr/local/bin/python3
2022-11-16 19:56:37 URL:https://download.calibre-ebook.com/linux-installer.sh [33639/33639] -> "-" [1]
Traceback (most recent call last):
File "", line 1, in
File "", line 16, in
File "/usr/local/lib/python3.10/ssl.py", line 98, in
import _ssl # if we can't import it, let the error propagate
ModuleNotFoundError: No module named '_ssl',


I'm using Ubuntu 22.04.1 LTS.

I've also tried sudo apt install calibre and sudo apt-get install calibre though they aren't recommended. I get this response:
calibre is already the newest version (5.37.0+dfsg-1build1).

But calibre still doesn't appear to be installed and I can't run it. It's driving me round the bend. Does anyone know how to fix it?
posted by aussie_powerlifter to Technology (3 answers total) 2 users marked this as a favorite
 
Best answer: Based on the error message, it looks like your Python installation is somehow broken. Or rather, you have a broken version of Python installed at /usr/local/bin/python3, which is getting used instead of the standard Ubuntu version which should be at /usr/bin/python3.

I'm going to hazard a guess that /usr/bin/python3 -c "import ssl" runs with no errors, and /usr/local/bin/python3 -c "import ssl" gives the same error message that you posted above. Is that right?

If so, it seems like the simplest fix would be to delete /usr/local/bin/python3 and let the normal Ubuntu Python installation take precedence. (If you're feeling extra-cautious, you might want to move it elsewhere rather than deleting it outright.)
posted by teraflop at 2:53 AM on November 16, 2022 [3 favorites]


Response by poster: It worked - thank you so much!
posted by aussie_powerlifter at 3:36 AM on November 16, 2022 [2 favorites]


Best answer: It sounds like you now also have the (super old) packaged version of Calibre installed, so make sure you remove that (with sudo apt-get remove calibre).

The update script symlinks the executables in /opt/calibre/... to /usr/bin/, which is also where the package puts executables. I'm not sure what happens if the packaged executables are already there (maybe it fails to overwrite them; maybe it succeeds and the package overwrites them the next time you upgrade Ubuntu). I'd re-run the script after uninstalling the package.

While digging around I saw that I had some old packaged Calibre .desktop files in /usr/share/applications/ which weren't removed for some reason back when I uninstalled the package. The script copies the new .desktop files to /usr/share/local/applications/. The presence of these files should make no difference (the files in the local directory take precedence), but it's probably a good idea to remove them and avoid future confusion.

If you get confusing results when trying to run an executable from a terminal after installing / uninstalling an executable from the same terminal, try a fresh terminal (bash caches paths). This may be why you couldn't run the old Calibre after you installed the package.
posted by confluency at 5:56 AM on November 16, 2022


« Older How do I figure out why I love a perfume?   |   Translation device options for real time Newer »
This thread is closed to new comments.