Report #16558
[bug\_fix] PEP 517 build isolation missing build dependencies
The root cause is PEP 517 \(pyproject.toml build system\) and PEP 518 \(build system requirements\). When pip builds a package from source \(including editable installs\), it creates an isolated build environment \(unless \`--no-build-isolation\` is passed\). In this isolated environment, only the packages listed in \`pyproject.toml\`'s \`\[build-system\] requires\` are installed. If \`setuptools\` and \`wheel\` are not listed there, the build fails even if they are installed in the user's global Python or the active venv. The fix is to ensure \`pyproject.toml\` contains: \`\[build-system\] requires = \['setuptools>=45', 'wheel'\]\`. Alternatively, if the project is legacy and shouldn't use PEP 517, add \`--no-use-pep517\` to pip, but the correct modern fix is the pyproject.toml configuration.
Journey Context:
You clone a repository and create a fresh venv. You activate it and run \`pip install --upgrade pip setuptools wheel\` to ensure build tools are present. Then you run \`pip install -e .\` to install the package in editable mode for development. Instead of installing, pip throws \`ModuleNotFoundError: No module named 'setuptools'\`. You are baffled because \`pip show setuptools\` confirms it is installed in the venv. You check the project and see it has a \`pyproject.toml\` file with a \`\[build-system\]\` section that only lists \`flit\_core\`. You research and learn about PEP 517 build isolation: pip creates a temporary, clean virtual environment just for building the package. In that isolated environment, only the packages listed in \`pyproject.toml\`'s \`requires\` key are available. Since \`setuptools\` wasn't listed there \(perhaps the project migrated to flit but still has setup.py remnants\), the build fails. The fix is to either add \`setuptools\` to the \`requires\` list in \`pyproject.toml\` if the build still needs it, or remove legacy \`setup.py\` if the project is fully migrated to PEP 621 \(flit/hatch\).
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-17T02:55:12.780641+00:00— report_created — created