deluge 2.2.0: No module named 'pkg_resources' (tested fix)
deluge 2.2.0, the latest release, imports pkg_resources at the top of ui_entry.py and pluginmanagerbase.py, so on setuptools 82 or newer deluge and deluge-web fail with ModuleNotFoundError: No module named 'pkg_resources'. Tested fix: pip install "setuptools<81".
1. The error: deluge 2.2.0 with setuptools 84
pip install deluge==2.2.0 (the newest release, 2025-04-28) into a Python 3.11.17 venv with setuptools 84.2.1. The deluge launcher fails right away:
$ deluge --version
Traceback (most recent call last):
File "/path/to/venv/bin/deluge", line 4, in <module>
from deluge.ui.ui_entry import start_ui
File "/path/to/venv/lib/python3.11/site-packages/deluge/ui/ui_entry.py", line 20, in <module>
import pkg_resources
ModuleNotFoundError: No module named 'pkg_resources'
The web UI fails when it starts (--version alone still works for it):
$ deluge-web -d -p 8964 -L info
Traceback (most recent call last):
...
from deluge.ui.web.pluginmanager import PluginManager
File "/path/to/venv/lib/python3.11/site-packages/deluge/ui/web/pluginmanager.py", line 14, in <module>
from deluge.pluginmanagerbase import PluginManagerBase
File "/path/to/venv/lib/python3.11/site-packages/deluge/pluginmanagerbase.py", line 16, in <module>
import pkg_resources
ModuleNotFoundError: No module named 'pkg_resources'
Two files import pkg_resources at the top: deluge/ui/ui_entry.py (finds the UIs through entry points) and deluge/pluginmanagerbase.py (loads plugins). setuptools 82.0.0 removed pkg_resources. We did not start deluged (it needs the libtorrent binding, which pip did not install), but its plugin manager uses the same pluginmanagerbase.py.
2. Fix: pin setuptools below 81 (tested)
$ pip install "setuptools<81" # gave 80.10.2
$ deluge-web -d -p 8964 -L info
/path/to/venv/lib/python3.11/site-packages/deluge/pluginmanagerbase.py:16: UserWarning: pkg_resources is deprecated as an API. See https://setuptools.pypa.io/en/latest/pkg_resources.html. The pkg_resources package is slated for removal as early as 2025-11-30. Refrain from using this package or pin to Setuptools<81.
import pkg_resources
06:36:19 [INFO ][deluge.ui.web.server :1622] Serving at http://0.0.0.0:8964/
The web UI served normally; deluge --version printed deluge 2.2.0. The pkg_resources is deprecated as an API warning remains; hide it with PYTHONWARNINGS="ignore:pkg_resources is deprecated as an API" in the service environment (systemd unit or Docker ENV).
2.2.0 is the latest deluge on PyPI, so there is no newer release to upgrade to.
Related: No module named 'pkg_resources' (general fix) · supervisord · Trac 1.6.
Frequently asked questions
Is there a newer deluge that fixes it?
Not on PyPI as of 2026-10-24: 2.2.0 (2025-04-28) is the latest release and still has both top-level imports.
Why does deluge-web --version work but deluge-web fail?
The version check exits before the web server imports its plugin manager, and pluginmanagerbase.py is where the pkg_resources import is.
Written with AI assistance. Measured on 2026-10-24 on Linux with deluge 2.2.0, CPython 3.11.17, setuptools 80.10.2 and 84.2.1. Output pasted unedited except shortened paths and trimmed traceback frames. PlainTables is our extension; deluge is free.