python config_error ai_generated true

error: package directory 'mypackage/data' does not exist

ID: python/setuptools-missing-package-data

Also available as: JSON · Markdown · 中文
80%Fix Rate
84%Confidence
0Evidence
2024-06-18First Seen

Version Compatibility

VersionStatusIntroducedDeprecatedNotes
3.8 active
3.9 active
3.10 active
3.11 active
3.12 active

Root Cause

The setup.py or setup.cfg references a package data directory that does not exist in the source tree.

generic

中文

setup.py 或 setup.cfg 引用了源代码树中不存在的包数据目录。

Workarounds

  1. 95% success
    mkdir -p mypackage/data && touch mypackage/data/__init__.py
  2. 90% success
    In setup.py, change include_package_data=True to a proper MANIFEST.in or package_data dict.

Dead Ends

Common approaches that don't work:

  1. 60% fail

    Empty directories are often ignored; the build may still fail if the directory is expected to contain files.

  2. 40% fail

    Removing it may exclude necessary data files from the distribution.