Deluge 2.1.0 fails to run on 18.04; "No module named 'libtorrent'"

General support for problems installing or using Deluge
Post Reply
headlessNik
New User
New User
Posts: 3
Joined: Sat Jul 09, 2022 5:38 pm

Deluge 2.1.0 fails to run on 18.04; "No module named 'libtorrent'"

Post by headlessNik »

TL;DR
~10 days ago I updated deluge via 'apt update' and Deluge stopped working with 'No module named 'libtorrent'" error. I have since blow Deluge away completely several times and reinstalled several times, most recently 8th of July; Ubuntu 18.04, 'ppa:deluge-team/stable'

~10 days ago:
I ran 'apt update, etc' and restarted my server as I do at the end of each month. A day or two later I could not connect via my ThinClient (via SSH Tunnel). I googled the errors I was seeing, saw a suggestion to blow away '../state' which did not help. Blew away deluge (apt remove --purge deluge*) completely, including 'rm -rf /var/lib/deluge'

~7 days ago:
I saw the similar post (viewtopic.php?f=7&t=56140) but stated resolution was to install 2yr old libtorrent? I blew Deluge away at that time and gave it a week for everything to be sorted. Everything was freshly pulled from PPA yesterday and still not able to successfully launch Deluged; output below, /var/lib/deluge remains empty of first run config files.

$deluged:

Code: Select all

Traceback (most recent call last):
  File "/usr/lib/python3/dist-packages/deluge/_libtorrent.py", line 21, in <module>
    import deluge.libtorrent as lt
ModuleNotFoundError: No module named 'deluge.libtorrent'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/lib/python3/dist-packages/deluge/_libtorrent.py", line 24, in <module>
    import libtorrent as lt
ModuleNotFoundError: No module named 'libtorrent'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/bin/deluged", line 11, in <module>
    load_entry_point('deluge==2.1.0', 'gui_scripts', 'deluged')()
  File "/usr/lib/python3/dist-packages/deluge/core/daemon_entry.py", line 87, in start_daemon
    from deluge.core.daemon import is_daemon_running
  File "/usr/lib/python3/dist-packages/deluge/core/daemon.py", line 19, in <module>
    from deluge.core.core import Core
  File "/usr/lib/python3/dist-packages/deluge/core/core.py", line 26, in <module>
    from deluge._libtorrent import LT_VERSION, lt
  File "/usr/lib/python3/dist-packages/deluge/_libtorrent.py", line 26, in <module>
    raise LibtorrentImportError('No libtorrent library found: %s' % (ex))
deluge.error.LibtorrentImportError: No libtorrent library found: No module named 'libtorrent'
apt/source:

Code: Select all

deb http://ppa.launchpad.net/deluge-team/stable/ubuntu bionic main
# deb-src http://ppa.launchpad.net/deluge-team/stable/ubuntu bionic main
versions:

Code: Select all

deluged is already the newest version (2.1.0-0~202206291031~ubuntu18.04.1).
deluge-common is already the newest version (2.1.0-0~202206291031~ubuntu18.04.1).
libtorrent-rasterbar10 is already the newest version (1.2.16~daily10769+e0dd73971-202206291010~ubuntu18.04.1).
python3-libtorrent is already the newest version (1.2.16~daily10769+e0dd73971-202206291010~ubuntu18.04.1).
python3 is already the newest version (3.6.7-1~18.04).

$lsb_release -a
Description:	Ubuntu 18.04.6 LTS
Release:	18.04
Codename:	bionic

$uname -a
Linux 4.15.0-188-generic
I saw a post about everything being fine from the PPA for 20.04 viewtopic.php?f=7&t=56218 and wanted to see why mine is still not working from PPA on 18.04.

Please let me know if I've missed any pertinent information & thanks for any guidance.
mhertz
Moderator
Moderator
Posts: 2215
Joined: Wed Jan 22, 2014 5:05 am
Location: Denmark

Re: Deluge 2.1.0 fails to run on 18.04; "No module named 'libtorrent'"

Post by mhertz »

In your first link there's a posted solution by yufaazhi in last post's second solution. Alternatively I previously posted another here: viewtopic.php?p=234600#p234600, where I built and uploaded a static libtorrent 1.2.15 which should work on ubuntu 18.04.
headlessNik
New User
New User
Posts: 3
Joined: Sat Jul 09, 2022 5:38 pm

Re: Deluge 2.1.0 fails to run on 18.04; "No module named 'libtorrent'"

Post by headlessNik »

mhertz, I appreciate the reply and the work you did to develop a workaround.

If I'm trying to avoid building anything or linking to anything non-standard to avoid more update/dependency issues in the future, is my best option to move to 20.04 LTS? Given the other post I linked to, it appears this should function directly out of the PPA?

I spent the day backing up all of the DBs and configs I have running on this server incase moving to 20.04 is the right longterm solution, wondering if there are any thoughts on this?
mhertz
Moderator
Moderator
Posts: 2215
Joined: Wed Jan 22, 2014 5:05 am
Location: Denmark

Re: Deluge 2.1.0 fails to run on 18.04; "No module named 'libtorrent'"

Post by mhertz »

Well if wanting to just have it work without any workarounds, then yes, I would hazzard a guess to say so - don't know much about ubuntu honestly, but should work like that upon 20.04 as you stated.

However, the trick posted by yufaazhi is imho very unobtrusive and would overlive updates, or so i'm guessing atleast(unless changing filename), so if not in hurry of updating, then might as well use that imho i.e. install deluge from PPA and then run this single line:

Code: Select all

sudo ln -s /usr/lib/python3/dist-packages/libtorrent.cpython-36dm-x86_64-linux-gnu.so /usr/local/lib/python3.6/dist-packages/libtorrent.so
(I changed the fix to instead use '/user/local/lib' instead of '/usr/lib' for the symlink, but original is fine too i.e. 'sudo ln -s /usr/lib/python3/dist-packages/libtorrent.cpython-36dm-x86_64-linux-gnu.so /usr/lib/python3/dist-packages/libtorrent.so')

Honestly I haden't really much noticed that workaround and what was about before now, and if had, then wouldn't even had included my solution in the mix previously.

Good luck!
Post Reply