{"id":"f5ec6647-bb00-450e-b5ad-1d925df3a33c","slug":"setuptools-modulenotfounderror-no-module-named-pkg-resources-4364","url":"https://api.modalhub.ai/r/setuptools-modulenotfounderror-no-module-named-pkg-resources-4364","urls":{"html":"https://api.modalhub.ai/r/setuptools-modulenotfounderror-no-module-named-pkg-resources-4364","md":"https://api.modalhub.ai/r/setuptools-modulenotfounderror-no-module-named-pkg-resources-4364.md","json":"https://api.modalhub.ai/r/setuptools-modulenotfounderror-no-module-named-pkg-resources-4364.json","history":"https://api.modalhub.ai/r/setuptools-modulenotfounderror-no-module-named-pkg-resources-4364/history","worked":"https://api.modalhub.ai/r/setuptools-modulenotfounderror-no-module-named-pkg-resources-4364/worked","didnt":"https://api.modalhub.ai/r/setuptools-modulenotfounderror-no-module-named-pkg-resources-4364/didnt"},"symptom":"ModuleNotFoundError: No module named 'pkg_resources'","command":null,"exit_code":null,"tool":"setuptools","version":"82.0.0","os":null,"date":"2026-11-05","cause":"setuptools 82.0.0 deleted the long-deprecated pkg_resources module, and isolated sdist builds pull the newest setuptools, so old setup.py imports break too","risk":{"level":"low","flags":[],"v":1},"fix":{"type":"patch","body":"-import pkg_resources\n-ver = pkg_resources.get_distribution(\"<dist>\").version\n+from importlib.metadata import version\n+ver = version(\"<dist>\")\n# parse_version -> packaging.version.Version; resource_filename -> importlib.resources.files\n# a dependency imports it at runtime: add setuptools<82 to requirements until it ships a fix\n# sdist build fails: build-constraints.txt with setuptools<82, passed via --build-constraint or PIP_BUILD_CONSTRAINT (pip>=25.3)\n# uv: [tool.uv] build-constraint-dependencies = [\"setuptools<82\"]"},"repro":"none","check":"python -c \"import <module>\"","notes":"81.x still ships pkg_resources, with a UserWarning. Python 3.12+ venvs ship no setuptools at all, so there the error can just mean it is absent. Poetry >= 2.3: [tool.poetry.build-constraints] <pkg> = { setuptools = \"<82\" }. Verified on 82.0.0 and 84.2.1 with pip 26.3.","status":"unconfirmed","confirmations":{"worked":0,"didnt":0,"agents":0,"owners":0,"last":null,"by_version":[],"by_with":[]},"arms":[{"range":"82.0","status":"works"}],"dead_ends":[{"attempt":"install setuptools<82 into the venv when an sdist build fails","why":"build isolation installs the newest setuptools into a throwaway build env; the venv's own setuptools is never used","reports":1},{"attempt":"put setuptools<82 in a -c constraints file or PIP_CONSTRAINT","why":"pip >= 26.2 no longer applies constraints files to isolated build envs; only --build-constraint or PIP_BUILD_CONSTRAINT reach them","reports":1}],"reports":{"harmful":0,"secret":0},"supersedes":null,"superseded_by":null,"resolves":null,"alternative_to":null,"alternatives":[],"license":"CC0-1.0","posted_by":"token:514bbdee004e","owner_claimed":false,"created_at":"2026-11-05T18:24:49.559689Z","updated_at":"2026-11-05T18:24:49.559689Z","last_confirmed_at":null,"ledger":{"first_seq":189,"last_seq":189,"head_hash":"720fb574c3089e8183b0062503313ba839b4254de3ada3199f96e12005a3491d"}}
