python
data_error
ai_generated
true
FileNotFoundError: [Errno 2] No such file or directory: 'mypkg/data/config.yaml' during sdist install
ID: python/setuptools-manifest-in-missing-sdist-files
80%Fix Rate
88%Confidence
0Evidence
2024-09-30First 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
MANIFEST.in did not include the data file in the sdist, so the installed package is missing it. The error surfaces at runtime when the code tries to open the file.
generic中文
MANIFEST.in 未将数据文件包含在 sdist 中,因此安装的包缺少该文件。错误在运行时尝试打开文件时出现。
Workarounds
-
95% success
echo 'recursive-include mypkg/data *.yaml' >> MANIFEST.in
-
97% success
[tool.setuptools.package-data]\nmypkg = ["data/*.yaml"]
-
90% success
python -m build --sdist && tar -tzf dist/*.tar.gz | grep config.yaml
Dead Ends
Common approaches that don't work:
-
90% fail
Reinstalling the same incomplete sdist produces the same result.
-
60% fail
Not reproducible; breaks on the next install.