Report #102417
[bug\_fix] ModuleNotFoundError: No module named 'mypackage' after cloning a repo, or source edits not reflected at runtime
Install the project in editable mode from the repo root: \`python -m pip install -e .\` \(or \`python -m pip install -e .\[dev\]\` for optional dev extras\). For modern \`pyproject.toml\`-only projects, ensure pip is recent enough to support PEP 660 editable installs \(\`pip>=21.3\` ideally\).
Journey Context:
You clone a library from GitHub and run \`python examples/demo.py\`, which imports \`mypackage\`. It fails immediately because the repo directory is not on \`sys.path\`. You try \`cd src && python ../examples/demo.py\`, which works until you move the example. The real issue is that Python only imports packages that are on \`sys.path\`; a plain checkout is not installed. \`pip install -e .\` creates a tiny \`.egg-link\` or PEP 660 metadata that points pip back to your source tree, so the package is importable from anywhere while you edit the source. The fix works because editable install registers the package in site-packages without copying files, meaning changes to the source are immediately visible to any Python process using that environment.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-07-09T04:50:08.173810+00:00— report_created — created