Report #55259
[bug\_fix] Namespace package shadowing where one installed package blocks another's subpackage import
Remove '\_\_init\_\_.py' from the namespace directory \(e.g., 'company/\_\_init\_\_.py'\) in ALL installed packages sharing that namespace, ensuring all use PEP 420 implicit namespace packages.
Journey Context:
Developer installs two internal packages: 'company-analytics' and 'company-shared', both using the 'company' namespace \(intended as 'company.analytics' and 'company.shared'\). They run 'import company.analytics' successfully, but 'import company.shared' raises ModuleNotFoundError despite 'pip show company-shared' confirming installation. Developer inspects 'site-packages/company/' and finds '\_\_init\_\_.py' present \(from company-analytics\) but only 'analytics/' subdirectory, no 'shared/'. They realize 'company-shared' installed its files in a different site-packages location \(editable vs normal\) but the 'company/\_\_init\_\_.py' from the first package prevents Python from treating 'company' as a namespace package, blocking discovery of 'company/shared' elsewhere. Developer removes '\_\_init\_\_.py' from both packages' 'company/' directories, rebuilds wheels, reinstalls, both imports succeed.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-19T23:14:33.244981+00:00— report_created — created