Deluge doesnt start on Ubuntu 18.04

General support for problems installing or using Deluge
Post Reply
granjerox
New User
New User
Posts: 5
Joined: Mon Aug 12, 2019 6:09 pm

Deluge doesnt start on Ubuntu 18.04

Post by granjerox »

Since yesterday I've realized that deluge server refuses to start due a Python libtorrent deps issue.
I've filled a bug https://dev.deluge-torrent.org/ticket/3511
But maybe someone here could help.

deluged: 2.1.1~dev7698+5acb57b5a-202203021432~ubuntu18.04.1
python-libtorrent: 1.1.12+daily8918+760f948+202003250209~ubuntu18.04.1
python3-libtorrent: 1.2.15~daily10744+019fcc32b-202202200724~ubuntu18.04.1

python --version && python3 --version
Python 2.7.17
Python 3.6.9

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'
mhertz
Moderator
Moderator
Posts: 2215
Joined: Wed Jan 22, 2014 5:05 am
Location: Denmark

Re: Deluge doesnt start on Ubuntu 18.04

Post by mhertz »

There's some info in this post of mine, plus the previous post, here: viewtopic.php?p=234600#p234600

To fix, I linked there a working libtorrent 1.2.15 I built, and instructions for installing another working one from pypi, if wanted instead, though older hence my rebuild.
granjerox
New User
New User
Posts: 5
Joined: Mon Aug 12, 2019 6:09 pm

Re: Deluge doesnt start on Ubuntu 18.04

Post by granjerox »

Thanks @mhertz for the reference. In my case installing lbry-libtorrent did the trick.

Code: Select all

sudo apt install python3-pip
sudo pip3 install lbry-libtorrent
python3 -c "import libtorrent; print(libtorrent.version)"
mhertz
Moderator
Moderator
Posts: 2215
Joined: Wed Jan 22, 2014 5:05 am
Location: Denmark

Re: Deluge doesnt start on Ubuntu 18.04

Post by mhertz »

You're welcome mate :) Yeah that is fine, though is 2 years old version, plus I believe don't support https trackers, which I forgot say before, well I haven't tested that, but from looking through how it's built from its github, hence I built newest v1.2.x, supporting https, and uploaded, as additional alternative fix. Thanks for reporting back.
yufaazhi
New User
New User
Posts: 1
Joined: Fri Jul 01, 2022 3:51 am

Re: Deluge doesnt start on Ubuntu 18.04

Post by yufaazhi »

I just encountered the same problem on U18 after an apt upgrade from the deluge PPA. So I have:

deluge 2.1.0-0~202206291031~ubuntu18.04.1
libtorrent-rasterbar10 1.2.16~daily10769+e0dd73971-202206291010~ubuntu18.04.1
python3-libtorrent 1.2.16~daily10769+e0dd73971-202206291010~ubuntu18.04.1

When I try to launch deluge I get the same issue:

deluge.error.LibtorrentImportError: No libtorrent library found: No module named 'libtorrent'

In python3 I see:

$ python3
Python 3.6.9 (default, Mar 15 2022, 13:55:28)
>>> import libtorrent
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
ModuleNotFoundError: No module named 'libtorrent'

Doing a pip3 install lbry-libtorrent fixes the problem but its some old version of libtorrent:

$ pip3 install lbry-libtorrent
$ python3
>>> import libtorrent
>>> libtorrent.__version__
'1.2.4.0' (dont remember this exactly)

So instead I ended up just doing:
$ dpkg -L python3-libtorrent | grep cpython
/usr/lib/python3/dist-packages/libtorrent.cpython-36dm-x86_64-linux-gnu.so
$ cd /usr/lib/python3/dist-packages
$ sudo ln -s libtorrent.cpython-36dm-x86_64-linux-gnu.so libtorrent.so

Now:
$ python3
Python 3.6.9 (default, Mar 15 2022, 13:55:28)
>>> import libtorrent
>>> libtorrent.__version__
'1.2.16.0'

And deluge launches OK
mhertz
Moderator
Moderator
Posts: 2215
Joined: Wed Jan 22, 2014 5:05 am
Location: Denmark

Re: Deluge doesnt start on Ubuntu 18.04

Post by mhertz »

@yufaazhi, You're a class act - this is incredibly helpful mate, and thank you so much for registering and posting this, for the help of others! :) (Just downloaded and tested this trick in an ubuntu 18.04.6 live iso)

Edit:

@Cas, Would you consider doing this in your build-script for the python3-libtorrent package specifically for 18.04 ubuntu, on your PPA thanks, if possible I mean. (Rename not link I mean).

Well, probably should be fixed upstream instead I guess, since not a deluge issue that the module isn't importable/usable from python, but not sure if PPA build-script or source that's the issue here though.

It states in 'setup.py' about output name:

Code: Select all

 
        # b2 doesn't provide a way to signal the name or paths of its outputs.
        # We try to convince python.jam to name its output file like our target
        # and copy it to our target directory. See comments in
        # write_b2_python_config for limitations on controlling the filename.
- and it's 'write_b2_python_config() comments':

Code: Select all

    # Note that all else being equal, we'd like to exactly control the output
    # filename, so distutils can find it. However:
    # 1. We can only control part of the filename; the prefix is controlled by
    #    our Jamfile and the final suffix is controlled by python.jam.
    # 2. Debian patched python.jam to disregard the configured ext_suffix
    #    anyway; they always override it with the same sysconfig var we use,
    #    found by invoking the executable.

    # So instead of applying an arbitrary name, we just try to guarantee that
    # b2 produces a name that distutils would expect, on all platforms. In
    # other words we apply debian's override everywhere, and hope no other
    # overrides ever disagree with us.

    # Note that sysconfig and distutils.sysconfig disagree here, especially on
    # windows.
    ext_suffix = distutils.sysconfig.get_config_var("EXT_SUFFIX")

    # python.jam appends the platform-specific final suffix on its own. I can't
    # find a consistent value from sysconfig or distutils.sysconfig for this.
    for plat_suffix in (".pyd", ".dll", ".so", ".sl"):
        if ext_suffix.endswith(plat_suffix):
            ext_suffix = ext_suffix[: -len(plat_suffix)]
            break
    write(f" : {b2_escape(ext_suffix)}")
    write(" ;\n")
BTW, I built python3-libtorrent using b2 direct, not using setup.py, and I know the working older version from lbry on pypi also did, so maybe something in setup.py is the culprit here. *Though just checked that on a newer ubuntu then python3-libtorrent also using same naming-scheme and not just named libtorrent.so, and with same *egg-info dir contents, but still works('import libtorrent').
Post Reply