Report #74201
[bug\_fix] ModuleNotFoundError: No module named 'pkg\_resources'
Install or upgrade \`setuptools\` in the virtual environment: \`pip install --upgrade setuptools\`. Ensure the venv is activated before installing.
Journey Context:
A developer creates a fresh virtual environment on Python 3.12 using \`python3 -m venv .venv\` and activates it. They immediately run \`pip install some-package\`. The installation appears to work, but when they try to run the package's CLI entry point, they get \`ModuleNotFoundError: No module named 'pkg\_resources'\`. Confused, they check \`pip list\` and see that \`setuptools\` is not installed. They realize that starting with Python 3.12, virtual environments created with \`venv\` no longer include \`setuptools\` or \`pkg\_resources\` by default—only \`pip\`. The package they installed was legacy code that imports \`pkg\_resources\` at runtime to determine its version or entry points. The fix is to explicitly \`pip install setuptools\` in the venv, providing the missing module.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-21T07:08:40.947021+00:00— report_created — created