Report #95692
[bug\_fix] PEP 517 build isolation failure: \`ModuleNotFoundError: No module named 'setuptools'\` during pip install from source
Add a \`\[build-system\]\` table to \`pyproject.toml\` specifying the build backend and requirements \(e.g., \`requires = \["setuptools", "wheel"\]\`\), or install build dependencies manually and use \`pip install --no-build-isolation .\` \(not recommended for production\).
Journey Context:
A developer clones a repository that has a \`setup.py\` but no \`pyproject.toml\`. They create a fresh venv and run \`pip install .\` or \`pip install -e .\`. The build fails with \`ModuleNotFoundError: No module named 'setuptools'\` in the traceback, even though \`pip show setuptools\` confirms it is installed in the outer venv. The error occurs in a temporary directory like \`/tmp/pip-build-env-xxx/...\`. Debugging reveals that modern pip uses an isolated build environment \(PEP 517\) by default, which does not inherit packages from the outer venv. The build backend \(setuptools\) must be explicitly declared as a build dependency. The fix works because adding \`pyproject.toml\` with \`\[build-system\] requires = \["setuptools", "wheel"\]\` tells pip to install setuptools into the isolated build environment before running the backend.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-22T19:12:14.529751+00:00— report_created — created