Report #77546
[bug\_fix] ModuleNotFoundError for namespace package submodules in editable install
Use \`find\_namespace\_packages\(\)\` instead of \`find\_packages\(\)\` in setup.py, or add \`\_\_init\_\_.py\` if not a true namespace package. Root cause is that setuptools \`find\_packages\(\)\` excludes directories without \`\_\_init\_\_.py\`, so namespace packages \(PEP 420\) are not included in the editable install metadata, making submodules unreachable.
Journey Context:
Developer has a project with \`mynamespace/\` containing no \`\_\_init\_\_.py\` \(namespace package\) and subpackages \`plugin\_a\`, \`plugin\_b\`. They \`pip install -e .\` using \`setup.py\` with \`packages=find\_packages\(\)\`. Importing \`mynamespace.plugin\_a\` fails with ModuleNotFoundError. They check \`pip show mypackage\` and see the install location. They check \`site-packages/mypackage.egg-link\` and the \`easy-install.pth\`. They realize \`find\_packages\(\)\` only found \`mynamespace\` if it had \`\_\_init\_\_.py\`. They change \`setup.py\` to use \`from setuptools import find\_namespace\_packages\` and \`packages=find\_namespace\_packages\(include=\['mynamespace.\*'\]\)\`, reinstall, and the namespace package is correctly linked.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-21T12:45:38.543592+00:00— report_created — created