Report #74901
[bug\_fix] ModuleNotFoundError: No module named 'my\_package' after \`pip install -e .\` \(editable install\) or error regarding missing build backend
Add a \`\[build-system\]\` table to \`pyproject.toml\` specifying \`requires\` \(e.g., \`\["setuptools>=45", "wheel"\]\`\) and \`build-backend\` \(e.g., \`"setuptools.build\_meta"\`\). This declares the PEP 517 backend required for modern editable installs.
Journey Context:
You clone a repository containing a \`setup.py\` but no \`pyproject.toml\`, or with a \`pyproject.toml\` containing only tool configurations \(e.g., for Black\). You run \`pip install -e .\` to install in editable mode. Pip \(21.0\+\) detects the presence of \`pyproject.toml\` and enters PEP 517 mode. It looks for \`\[build-system\]\` but doesn't find it. It defaults to setuptools, but because the backend isn't explicitly declared, it fails to build the editable wheel, or it falls back to legacy \`setup.py develop\` which doesn't create the necessary \`.pth\` files or metadata in \`site-packages\`. You try to import your package and get \`ModuleNotFoundError\`. You try \`pip install -e . --no-use-pep517\` and it works, but you see deprecation warnings. You research and learn that modern editable installs require a \`\[build-system\]\` declaration. You create a \`pyproject.toml\` with \`\[build-system\] requires = \["setuptools>=45", "wheel"\] build-backend = "setuptools.build\_meta"\`. You rerun \`pip install -e .\`. Pip now uses the declared backend to build an editable wheel \(which installs a \`.pth\` file in \`site-packages\` pointing to your source\). Your package is now importable. Why fix works: PEP 517 requires an explicit build backend to generate distribution metadata and editable installs; without the \`\[build-system\]\` table, pip cannot reliably determine how to construct the editable path.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-21T08:19:10.047944+00:00— report_created — created