opsdroid: No module named 'pkg_resources' (fix)
opsdroid 0.31.0 (the latest) does from pkg_resources import iter_entry_points in opsdroid/loader.py, so a fresh install fails with ModuleNotFoundError: No module named 'pkg_resources', even for opsdroid version. Tested fix: pip install "setuptools<81".
1. The error: opsdroid 0.31.0 on a fresh install
pip install opsdroid gives 0.31.0, the latest release (2025-04-30). It requires setuptools>=76.0.0 with no upper bound, so a fresh Python 3.11 venv got setuptools 84.2.1. Then every command fails, even opsdroid version:
$ opsdroid version
Traceback (most recent call last):
File "/path/to/venv/bin/opsdroid", line 4, in <module>
from opsdroid.cli import cli
File "opsdroid/cli/__init__.py", line 5, in <module>
from opsdroid.cli.config import config
File "opsdroid/cli/config.py", line 5, in <module>
from opsdroid.cli.utils import (
File "opsdroid/cli/utils.py", line 19, in <module>
from opsdroid.core import OpsDroid
File "opsdroid/core.py", line 23, in <module>
from opsdroid.loader import Loader
File "opsdroid/loader.py", line 18, in <module>
from pkg_resources import iter_entry_points
ModuleNotFoundError: No module named 'pkg_resources'
opsdroid start -f configuration.yaml failed with the same traceback. opsdroid/loader.py line 18 is a plain from pkg_resources import iter_entry_points, and setuptools 82.0.0 removed pkg_resources. The CLI imports the loader at startup, so nothing runs. The main branch on GitHub (last commit 2025-11-24) still has the same import.
2. Fix: pin setuptools below 81 (tested)
$ pip install "setuptools<81" # gave 80.10.2
$ opsdroid version
opsdroid/loader.py:18: 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.
from pkg_resources import iter_entry_points
opsdroid 0.31.0
The bot also started. With a websocket connector and the hello skill in the config, opsdroid start -f configuration.yaml printed:
opsdroid/loader.py:18: 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.
from pkg_resources import iter_entry_points
INFO opsdroid.logging ========================================
INFO opsdroid.logging Started opsdroid 0.31.0.
WARNING opsdroid.logging Running in non-interactive shell - falling back to simple logging. You can override this using 'logging.config: false'
WARNING opsdroid 'welcome-message: true/false' is missing in configuration.yaml
WARNING opsdroid.loader No databases in configuration. This will cause skills which store things in memory to lose data when opsdroid is restarted.
INFO opsdroid.loader Cloning hello from remote repository.
INFO opsdroid.core Opsdroid is now running, press ctrl+c to exit.
INFO opsdroid.web started web server on http://0.0.0.0:8080
We stopped it after 40 seconds; it shut down cleanly. setuptools 80.10.2 is still at least 76.0.0, so it still meets opsdroid's own requirement. If you deploy with a requirements file, add setuptools<81 next to opsdroid so a rebuild does not pull 82+ again.
3. Hide the warning (optional)
The pkg_resources is deprecated warning above is harmless. To hide it:
$ PYTHONWARNINGS="ignore:pkg_resources is deprecated as an API" opsdroid version
opsdroid 0.31.0
We did not test the opsdroid Docker image. If it fails the same way, add RUN pip install "setuptools<81" to a Dockerfile built on top of it.
Related: No module named 'pkg_resources' (general fix) · Jenkins Job Builder (same cause) · scrapyd.
Frequently asked questions
Why does a fresh install break?
opsdroid requires setuptools>=76.0.0 with no upper bound, so pip installs the newest setuptools, which no longer ships pkg_resources.
Is there a newer opsdroid that fixes it?
No. 0.31.0 is the latest release, and the GitHub main branch still imports pkg_resources in loader.py.
Written with AI assistance. Measured on 2026-10-24 on Linux with opsdroid 0.31.0, aiohttp 3.14.5, CPython 3.11.17, setuptools 80.10.2 and 84.2.1. Output pasted unedited except shortened paths and a cut-off log. PlainTables is our extension; opsdroid is free.