python
data_error
ai_generated
true
ModuleNotFoundError: No module named 'mypkg.data' # after: pip install mypkg from sdist
ID: python/setuptools-sdist-missing-package-data
80%Fix Rate
86%Confidence
0Evidence
2024-06-30First Seen
Version Compatibility
| Version | Status | Introduced | Deprecated | Notes |
|---|---|---|---|---|
| 3.x | active | — | — | — |
Root Cause
Non-Python data files or subpackages were not included in the sdist because package_data/include_package_data or MANIFEST.in were misconfigured.
generic中文
非 Python 数据文件或子包未包含在 sdist 中,因为 package_data/include_package_data 或 MANIFEST.in 配置错误。
Workarounds
-
95% success
[tool.setuptools.package-data] mypkg = ["data/*.json", "data/*.csv"] # or [tool.setuptools] include-package-data = true
-
90% success
echo 'recursive-include mypkg/data *.json *.csv' >> MANIFEST.in python -m build --sdist pip install dist/mypkg-1.0.tar.gz
Dead Ends
Common approaches that don't work:
-
90% fail
Forces building from sdist, which is exactly where the data files are missing.
-
85% fail
Reinstall does not add missing files to the sdist.
-
80% fail
.gitignore does not affect sdist contents; MANIFEST.in does.