Latest deluge-dev in venv(ubuntu/debian instructions).

General support for problems installing or using Deluge
Post Reply
mhertz
Moderator
Moderator
Posts: 1200
Joined: Wed Jan 22, 2014 5:05 am
Location: Denmark

Latest deluge-dev in venv(ubuntu/debian instructions).

Post by mhertz »

The deluge packages on ubuntu and debian will fill your log up with errors because misses a logging fix from deluge develop, and also has several bugs also fixed in develop, and the PPA for develop is outdated, so personally if I was using ubuntu or debian, or other distro with likewise situation, then would propperly just make a venv(virtualenv - isolated python/app/deps) of latest dev deluge, which isn't very hard to do, and I prefer venv's under home-dir to untracked files under / when building from source and installing outside package-manager, and nice imho to have everything in single folder under home-dir which you can just delete to uninstall fully later on, including deps(but could also skip venv and installing through 'pip install --user git+git...' which too installs under home-dir, or just ditch '--user' if not minding install under '/usr/local/...'), so anyway, here's some general instructions. Note, works on other distro's, and just specified ubuntu/debian because using package-manager and package-names matching those platforms, so just change those where needed.

Uninstall your old deluge first if having it installed.

Then:

Code: Select all

sudo apt install git
python3 -m venv --system-site-packages ~/.local/deluge
~/.local/deluge/bin/pip3 install git+git://deluge-torrent.org/deluge.git
sudo apt install python3-libtorrent
This will make the venv and install latest deluge dev version(currently 2.0.4.dev56) and deps, and the gtk3 python bindings should already be installed(e.g. python3-gi and python3-gi-cairo etc). If already have git installed, then don't need install it obviously - actually pip can install from url of deluge github tarball, but error's out because of a get_version() function needing git, so just easier use git, than workaround that imho.

You can test if it runs now with '~/.local/deluge/bin/deluge' and/or deluged from same place.

All that's missing now is to make links to the deluge components into your user-bin-dir added to your path, e.g. '~/bin' or '~/.local/bin', and change path to deluge in service files which i'd presume is how most run deluge, but note maybe you'd prefer an alternative and easier approach which would let you skip this and next few steps, as outlined later on in the paragraph starting with "Or alternatively ...", but up to you. Anyway, continuing with previous mentioned links added to user-bin-dir(if not going for alternative):

Code: Select all

ln -s ~/.local/deluge/bin/deluged ~/bin/deluged
ln -s ~/.local/deluge/bin/deluge-web ~/bin/deluge-web
ln -s ~/.local/deluge/bin/deluge ~/bin/deluge
ln -s ~/.local/deluge/bin/deluge-console ~/bin/deluge-console
Finally ammend your service files(follow documentation upon how make those) to load from the new place, and I believe you need specify full path as vagually remember that no path lookup is done for that:

/etc/systemd/system/deluged.service:

Code: Select all

[Unit]
Description=Deluge Bittorrent Client Daemon
Documentation=man:deluged
After=network-online.target

[Service]
Type=simple
UMask=007

ExecStart=/home//<user>/.local/deluge/bin/deluged -d

Restart=on-failure

# Time to wait before forcefully stopped.
TimeoutStopSec=300

[Install]
WantedBy=multi-user.target
/etc/systemd/system/deluge-web.service:

Code: Select all

[Unit]
Description=Deluge Bittorrent Client Web Interface
Documentation=man:deluge-web
After=network-online.target deluged.service
Wants=deluged.service

[Service]
Type=simple
UMask=027

ExecStart=/home/<user>/.local/deluge/bin//deluge-web -d

Restart=on-failure

[Install]
WantedBy=multi-user.target
I only changed the ExecStart lines, one of each file, with ammended path(replace '<user>' with your own user-name). One could also instead use override files instead of ammending files directly, so if going that route instead, then make two dirs if not there already: '/etc/systemd/system/deluged.service.d' and '/etc/systemd/system/deluge-web.service.d' and place new file override.conf in them with:

Code: Select all

[Service]
ExecStart=
ExecStart=/home/<user>/.local/deluge/bin/deluged -d

Code: Select all

[Service]
ExecStart=
ExecStart=/home/<user>/.local/deluge/bin/deluge-web -d
For good meassure, afterwards run 'sudo systemctl daemon-reload'. (Edit: Easier is just running 'sudo systemctl edit deluged' and 'sudo systemctl edit deluge-web', and copy/paste above into first empty line, which generate the override dirs/files for you)

Or alternatively to changing the service files(or using override files/dirs) and making shortcuts in user-bin-dir, then could just add the shortcuts direct to /usr/bin(sudo ln -s ~/.local/deluge/bin/deluged /usr/bin/deluged' etc), negating these last few steps, up to you.

That should be it.

Oh, whenever wanting to update deluge and deps then run:

Code: Select all

~/.local/deluge/bin/pip3 install --upgrade git+git://deluge-torrent.org/deluge.git
(python3-libtorrent updated with rest of your system updates)

Hope no typo's or glarring mistakes, as just quickly threw together, but tested firstly on an old ubuntu 20.10 VM I had laying around.

Edits:

* Documentation for making systemd service files: https://deluge.readthedocs.io/en/latest ... rvice.html

* If using AutoAdd plugin with magnets, then broken in latest dev56, so use my fixed build from here: viewtopic.php?f=9&p=233591#p233591

* For uninstall you just delete '~/.local/deluge' folder, the systemd service files and possibly override dirs/files if used(stop/disable services first), and the shortcuts, and uninstall git if not needing it for elsewhere.

* You can use other path than '~/.local/deluge', up to you and just a suggestion.

* There's been reported high memory usage and sometimes crashing because of it, fixed in libtorrent 1.2.10 and above, and i'm not certain when started sorry. On ubuntu then latest libtorrent from repos is 1.2.5, so possibly affected, but you can just add the 'libtorrent 1.2 daily builds' PPA from here: https://answers.launchpad.net/~libtorre ... /1.2-daily, and install python3-libtorrent which currently gives 1.2.12, so unaffected. If needing newer libtorrent than your distro provides, then can build static version of python3-libtorrent(so self-contained without runtime-deps on boost and openssl) using userdocs ubuntu/debain build-script found here: https://github.com/userdocs/python-libtorrent-binding - Note currently fails run as boost url in script has changed, so search bintray in it and change the two found urls to instead: "https://boostorg.jfrog.io/artifactory/m ... 6_0.tar.gz" - can easilly be changed to work on other distro e.g. I made it work in arch-linux by commenting out the "check-dependencies" function, since uses apt-get - note newer gcc's is little crazy and on a 4GB system I needed 10GB swap file(failed with 5GB!) added to build finished without OOM(on very minimal non-DE system) - I remember building libtorrent in a 2GB memory assigned win10 VM using msvc 2019.
Post Reply