Report #11420
[bug\_fix] ModuleNotFoundError: No module named 'setuptools' during pip install, despite setuptools being installed in the venv
Add a 'pyproject.toml' with '\[build-system\]' requires = \['setuptools>=40.8.0', 'wheel'\]', or disable build isolation with 'pip install --no-build-isolation -e .' after manually installing build dependencies.
Journey Context:
Developer maintains a legacy library with only a 'setup.py' and no 'pyproject.toml'. They create a fresh virtual environment with Python 3.11. They activate it and run 'pip install -e .' to install their package in editable mode. The installation starts, but immediately fails with 'ModuleNotFoundError: No module named setuptools'. The developer is baffled because 'pip list' clearly shows 'setuptools 65.0.0' is installed in the venv. They search the error and discover that modern pip \(since 20.3\+\) uses isolated builds by default \(PEP 517\). It creates a temporary isolated environment to build the wheel, which does not inherit the installed 'setuptools' from the venv unless explicitly declared. The legacy setup.py relies on setuptools being present, but the isolated environment is empty. The developer fixes this by adding a minimal 'pyproject.toml' declaring the build-system requires, or by using the '--no-build-isolation' flag after ensuring build dependencies are present.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-16T13:17:39.288485+00:00— report_created — created