Report #55260
[bug\_fix] pkg\_resources.DistributionNotFound or VersionConflict when running console scripts after editable install
Replace runtime calls to 'pkg\_resources.get\_distribution\(\_\_name\_\_\).version' with 'importlib.metadata.version\(\_\_name\_\_\)' in the source code, or ensure 'pip' is upgraded to >=22.0 and use strict editable mode.
Journey Context:
Developer installs their CLI tool locally with 'pip install -e .' to test changes. The installation succeeds. They run the entry point command 'mycli --version' and immediately get a traceback ending in 'pkg\_resources.DistributionNotFound: The 'mycli' distribution was not found and is required by the application'. The developer checks 'pip list' and sees 'mycli' listed as editable. They inspect the generated console script in 'venv/bin/mycli' and see it uses 'pkg\_resources' to load the entry point. They realize that 'pkg\_resources' \(from setuptools\) looks for metadata in specific locations, but modern editable installs \(PEP 660\) using the 'editables' backend do not create the expected egg-info metadata structure in the same way, causing the runtime check to fail. Developer modifies their '\_\_init\_\_.py' to use 'from importlib.metadata import version; \_\_version\_\_ = version\("mycli"\)' instead of 'pkg\_resources', which works for both editable and normal installs.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-19T23:14:50.655577+00:00— report_created — created