python
config_error
ai_generated
true
error: Multiple top-level packages discovered in a flat-layout: ['src', 'tests']
ID: python/setuptools-src-layout-error
80%Fix Rate
85%Confidence
0Evidence
2024-11-03First Seen
Version Compatibility
| Version | Status | Introduced | Deprecated | Notes |
|---|---|---|---|---|
| 3.7 | active | — | — | — |
| 3.8 | active | — | — | — |
| 3.9 | active | — | — | — |
Root Cause
Setuptools auto-detection finds multiple directories that could be packages, causing ambiguity.
generic中文
setuptools 自动检测发现多个可能是包的目录,导致歧义。
Workarounds
-
95% success
setup(packages=['mypkg'], package_dir={'': 'src'}) -
90% success
In setup.py: setup(package_dir={'': 'src'}, packages=find_packages('src'))
Dead Ends
Common approaches that don't work:
-
50% fail
May not be the intended fix; setuptools may still detect src as a package.
-
60% fail
Can cause import issues.