nameko: No module named 'pkg_resources' (fix)
nameko 2.14.1 (the latest stable) does from pkg_resources import get_distribution in nameko/cli/main.py, so nameko run and every other command fail with ModuleNotFoundError: No module named 'pkg_resources' on setuptools 82+. Tested fix: pip install "setuptools<81".
1. The error: nameko 2.14.1 with setuptools 84
pip install nameko gives 2.14.1 (2021-12-05), the latest stable release. It does not depend on setuptools, so it uses whatever the venv has. In a Python 3.11 venv with setuptools 84.2.1, every nameko command fails before it does anything:
$ nameko show-config --config config.yaml
Traceback (most recent call last):
File "/path/to/venv/bin/nameko", line 4, in <module>
from nameko.cli.main import main
File "nameko/cli/main.py", line 9, in <module>
from pkg_resources import get_distribution
ModuleNotFoundError: No module named 'pkg_resources'
nameko/cli/main.py line 9 is from pkg_resources import get_distribution (used for --version), and setuptools 82.0.0 removed pkg_resources. A venv with no setuptools at all (uv venv, or python -m venv on Python 3.12+) has no pkg_resources either.
2. Fix: pin setuptools below 81 (tested)
$ pip install "setuptools<81" # gave 80.10.2
$ nameko show-config --config config.yaml
nameko/cli/main.py:9: 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 get_distribution
AMQP_URI: pyamqp://guest:guest@localhost
WEB_SERVER_ADDRESS: 0.0.0.0:8966
nameko run worked too. This HTTP-only service, hello.py:
from nameko.web.handlers import http
class HelloService:
name = "hello"
@http("GET", "/hi")
def hi(self, request):
return "hi from nameko\n"
$ nameko run --config config.yaml hello
nameko/cli/main.py:9: 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 get_distribution
nameko/cli/commands.py:109: [EventletDeprecationWarning lines cut]
starting services: hello
127.0.0.1 - - [24/Oct/2026 07:31:19] "GET /hi HTTP/1.1" 200 132 0.000583
The 200 line is from curl http://127.0.0.1:8966/hi, which returned hi from nameko. The pkg_resources warning is harmless; see pkg_resources is deprecated to hide it. The eventlet warning is separate: eventlet 0.41.3 now warns that it is deprecated, whatever setuptools you have.
3. Or: nameko 3.0.0rc11 has no pkg_resources import
The 3.0 pre-release line dropped the import. pip install --pre nameko gave 3.0.0rc11, and the same command worked on setuptools 84.2.1:
$ nameko show-config --config config.yaml
nameko/extensions.py:9: [EventletDeprecationWarning lines cut]
AMQP_URI: pyamqp://guest:guest@localhost
WEB_SERVER_ADDRESS: 0.0.0.0:8966
3.0 is still a release candidate (rc11, also 2021-12-05) and changes how config is accessed, so check its upgrade notes before you switch a running project. For an existing 2.x service the setuptools pin is the smaller change.
Related: No module named 'pkg_resources' (general fix) · opsdroid (same cause) · supervisor.
Frequently asked questions
Does nameko 3 fix it?
Yes. nameko 3.0.0rc11 (pip install --pre nameko) has no pkg_resources import and ran show-config on setuptools 84.2.1. It is still a release candidate.
Do I need a RabbitMQ broker to test the fix?
No. show-config and an HTTP-only service under nameko run worked without a broker in our test.
Written with AI assistance. Measured on 2026-10-24 on Linux with nameko 2.14.1 and 3.0.0rc11, eventlet 0.41.3, kombu 5.6.2, CPython 3.11.17, setuptools 80.10.2 and 84.2.1. Output pasted unedited except shortened paths and the cut eventlet warnings. PlainTables is our extension; nameko is free.