python
config_error
ai_generated
true
error: Multiple top-level packages discovered in a flat-layout: ['package1', 'package2'].
ID: python/setuptools-long-description-error
80%Fix Rate
85%Confidence
0Evidence
2025-05-22First Seen
Version Compatibility
| Version | Status | Introduced | Deprecated | Notes |
|---|---|---|---|---|
| 3.8 | active | — | — | — |
| 3.9 | active | — | — | — |
| 3.10 | active | — | — | — |
| 3.11 | active | — | — | — |
| 3.12 | active | — | — | — |
Root Cause
setuptools automatically discovers packages but finds multiple in the same directory, causing ambiguity.
generic中文
setuptools 自动发现包,但在同一目录中找到多个,导致歧义。
Workarounds
-
90% success Explicitly specify packages in setup.py or setup.cfg
In setup.cfg, add '[options]\npackages = find:' and configure find options, or list packages manually.
-
85% success Use a src-layout
Move packages into a 'src/' directory and set 'package_dir = {"": "src"}' in setup.cfg.
Dead Ends
Common approaches that don't work:
-
Ignoring the warning and proceeding
80% fail
setuptools may fail to build or include wrong packages.
-
Renaming the packages to have a common prefix
60% fail
This does not resolve the flat-layout detection logic.