Report #30060
[bug\_fix] Stale editable install shadowing from previous setup.py develop
Completely remove old installation artifacts with \`pip uninstall mypackage\` \(possibly multiple times\), manually delete any \`mypackage.egg-link\` files from \`site-packages\`, delete the \`mypackage.egg-info\` directory from the project root \(created by old \`setup.py develop\`\), clear \`\_\_pycache\_\_\` directories, then reinstall using modern \`pip install -e .\` \(not \`python setup.py develop\`\). The root cause is that legacy \`python setup.py develop\` creates \`.egg-link\` files and \`.egg-info\` directories that can conflict with modern PEP 660 editable installs \(which use \`.pth\` files\). If remnants exist, Python's import system may find the old \`.egg-link\` pointing to a moved/renamed directory, or find the package in site-packages instead of your editable source, causing import errors or stale code execution.
Journey Context:
You've been working on \`mypackage\` for months using \`python setup.py develop\` in a venv. You decide to modernize and switch to \`pyproject.toml\`. You pull latest main which now uses PEP 660 editable installs. You run \`pip install -e .\` and it says 'Successfully installed mypackage-2.0'. You edit \`src/mypackage/core.py\` and restart your Flask app, but the changes don't appear. You add a \`print\('debug'\)\` and nothing shows. You run \`python -c 'import mypackage; print\(mypackage.\_\_file\_\_\)'\` and it prints \`/home/user/project/venv/lib/python3.9/site-packages/mypackage/\_\_init\_\_.py\` instead of your \`src/\` directory. You realize it's importing from site-packages, not the editable source. You check \`pip show mypackage\` and see Location is the venv site-packages. You check \`site-packages/\` and find both \`mypackage-1.0.egg-link\` \(from the old develop\) and \`\_\_editable\_\_.mypackage-2.0.pth\` \(from the new pip install\). The egg-link points to the old location \(project root\) where the package no longer exists since you moved to src-layout. Python imports from the egg-link first \(site-packages adds egg-link dirs to path\), finds nothing or stale pyc files, and fails or imports wrong version. You run \`pip uninstall mypackage\` three times until it says 'not installed'. You manually delete \`mypackage.egg-info\` from the project root \(leftover from setup.py develop\). You delete \`\_\_pycache\_\_\` recursively. You run \`pip install -e .\` again. Now \`mypackage.\_\_file\_\_\` points to \`src/mypackage/\_\_init\_\_.py\` and edits reflect immediately. The fix worked by removing conflicting legacy metadata that shadowed the modern editable install.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-18T04:50:43.558917+00:00— report_created — created