Report #69549
[bug\_fix] ModuleNotFoundError: No module named 'my\_package' after \`pip install -e .\`
Upgrade build backend \(\`pip install --upgrade setuptools>=64\`\), or use the modern editable mode via \`pip install -e . --config-settings editable\_mode=strict\` \(setuptools\) to ensure .pth files are correctly generated for src-layout projects, or ensure \`pyproject.toml\` has \`\[tool.setuptools.packages.find\]\` configured for src-layout.
Journey Context:
You clone a repo with \`src/mypackage/\` layout. You run \`pip install -e .\`. It says success. You run \`python -c 'import mypackage'\` and get ModuleNotFoundError. You check \`site-packages\` and see \`mypackage.egg-link\` pointing to the wrong place, or a \`\_\_editable\_\_.mypackage.pth\` file missing. You realize setuptools changed to PEP 660 editable installs, which use import hooks instead of .egg-link files. If your \`pyproject.toml\` doesn't specify \`package-dir = \{"" = "src"\}\`, the editable install puts the metadata in site-packages but the import path is wrong. You upgrade setuptools, ensure the src-layout is declared, and reinstall, or you force the legacy mode with \`SETUPTOOLS\_ENABLE\_FEATURES=legacy-editable\` to get the old .egg-link behavior that works with your setup.py.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-20T23:13:35.162292+00:00— report_created — created