Report #63551
[bug\_fix] pip install fails with 'No module named setuptools' despite setuptools being installed globally
Add a \[build-system\] table to pyproject.toml containing 'requires = \["setuptools", "wheel"\]' and 'build-backend = "setuptools.build\_meta"'. This ensures pip's PEP 517 build isolation installs setuptools in the clean build environment.
Journey Context:
Developer clones a project containing only setup.py and a pyproject.toml that has '\[tool.black\]' and '\[tool.isort\]' sections but no '\[build-system\]'. In a fresh CI container \(python:3.11-slim\), they run 'pip install --upgrade pip setuptools' \(successful\), then 'pip install .'. The install fails with 'ModuleNotFoundError: No module named setuptools' during the 'Getting requirements to build wheel' phase. Developer is confused because 'pip show setuptools' confirms it's installed globally. They learn that since pip 19\+ and the presence of pyproject.toml, pip defaults to PEP 517 build isolation, creating a temporary venv for building that does NOT inherit globally installed packages. Since pyproject.toml lacks \[build-system\] requirements, the isolated env has pip/wheel but not setuptools. Adding the \[build-system\] table with setuptools requirement fixes it.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-20T13:09:30.825220+00:00— report_created — created