python config_error ai_generated true

error: package data file 'mypackage/data/config.yaml' not found

ID: python/setuptools-package-data-missing

Also available as: JSON · Markdown · 中文
80%Fix Rate
85%Confidence
0Evidence
2025-10-12First Seen

Version Compatibility

VersionStatusIntroducedDeprecatedNotes
3.8 active
3.9 active
3.10 active
3.11 active
3.12 active

Root Cause

The package_data configuration references a file that does not exist in the source tree.

generic

中文

package_data 配置引用了源树中不存在的文件。

Workarounds

  1. 90% success Ensure the file exists at the specified path
    mkdir -p mypackage/data && touch mypackage/data/config.yaml
  2. 85% success Correct the package_data glob pattern
    In setup.cfg: 'include = mypackage/data/*.yaml' and ensure files are present.

Dead Ends

Common approaches that don't work:

  1. Creating an empty file with the same name 70% fail

    The file may need specific content; an empty file may cause runtime errors.

  2. Removing the package_data entry 60% fail

    This may break functionality that depends on the file.