ModuleNotFoundError: No module named 'pkg_resources' in worker defaults on Python 3.13+
@auvipy is already working on this.
Since Oct 31, 2026.
Assessment
This issue has not been assessed yet.
Description
While testing a fix in celery/celery#10960, the smoke test worker container failed to start when running with Python 3.13+.
The worker crashes immediately on startup with the following traceback:
File "/app/app.py", line 13, in <module>
from pytest_celery.vendors.worker.tasks import *
...
File "/usr/local/lib/python3.13/site-packages/pytest_celery/vendors/worker/defaults.py", line 7, in <module>
from pkg_resources import resource_filename
ModuleNotFoundError: No module named 'pkg_resources'
Root cause:
Starting with Python 3.12 (and continuing in 3.13+), setuptools (which provides the pkg_resources module) is no longer installed by default in official Python Docker images. Since pytest_celery/vendors/worker/defaults.py imports pkg_resources, the worker container fails to boot in modern Python environments.
Suggested fix:
Replace pkg_resources.resource_filename with importlib.resources.files (or importlib_resources for backward compatibility), which is the modern standard for accessing package data in Python.
As requested by @auvipy in celery/celery#10960, I'm opening this issue so you can track the fix here. Let me know if you need any more details!
- Dominant language
- Python
- Stars
- 83
- Forks
- 18
- Avg merge
- 4h 13m
- Merged PRs (30d)
- 3
Getting set up
- No Dockerfile or Docker Compose file
- No pull request template
- Read the contributing guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from celery/pytest-celery
-
feature
Difficulty 3/5 1-2 days Newbie friendliness 45/100
celery/pytest-celery#463 · 1 comment ·
-
documentation
Difficulty 4/5 3-5 days Newbie friendliness 30/100
celery/pytest-celery#459 ·
-
`celery_worker` fixture name colides with `celery_worker` fixture from `celery.contrib.pytest`May be free again @Nusnus claimed this 645 days ago, and no pull request is open. Openbug
celery/pytest-celery#442 · 7 comments · 5 reactions · 1 assignee ·
-
Missing documentation on how to include source codeMay be free again @Nusnus claimed this 328 days ago, and no pull request is open. Opendocumentation
celery/pytest-celery#439 · 1 assignee ·
All issues in celery/pytest-celery
Similar issues
-
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
Maintainers usually reply within 1 day
-
AI bug
Difficulty 2/5 1-3 hours Newbie friendliness 68/100
AUTO-MAS-Project/AUTO-MAS#1960 · 1 comment ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 82/100
btclib-org/btclib-wallet#872 ·
Maintainers usually reply within 1 day
-
[Bug]: Scheduled returns scan all accepted minion keys causing extreme loadPossibly taken A pull request linked to this issue is open or already merged. Openbug needs-triage
Difficulty 2/5 1-3 hours Newbie friendliness 76/100
saltstack/salt#70789 · 1 comment ·
Maintainers usually reply within 3 days
-
Difficulty 2/5 1-3 hours Newbie friendliness 87/100
btclib-org/btclib#3093 ·
Maintainers usually reply within 1 day