{
  "id": "python/setuptools-sdist-missing-package-data",
  "signature": "ModuleNotFoundError: No module named 'mypkg.data'\n# after: pip install mypkg from sdist",
  "signature_zh": "ModuleNotFoundError：没有名为 'mypkg.data' 的模块\n# 在从 sdist 执行 pip install mypkg 之后",
  "regex": "ModuleNotFoundError:\\ No\\ module\\ named\\ 'mypkg\\.data'\\\n\\#\\ after:\\ pip\\ install\\ mypkg\\ from\\ sdist",
  "domain": "python",
  "category": "data_error",
  "subcategory": null,
  "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.",
  "root_cause_type": "generic",
  "root_cause_zh": "非 Python 数据文件或子包未包含在 sdist 中，因为 package_data/include_package_data 或 MANIFEST.in 配置错误。",
  "versions": [
    {
      "version": "3.x",
      "introduced": null,
      "deprecated": null,
      "removed": null,
      "behavior_change": null,
      "status": "active"
    }
  ],
  "os_specific": {},
  "dead_ends": [
    {
      "action": "",
      "why_fails": "Forces building from sdist, which is exactly where the data files are missing.",
      "fail_rate": 0.9,
      "condition": "",
      "sources": []
    },
    {
      "action": "",
      "why_fails": "Reinstall does not add missing files to the sdist.",
      "fail_rate": 0.85,
      "condition": "",
      "sources": []
    },
    {
      "action": "",
      "why_fails": ".gitignore does not affect sdist contents; MANIFEST.in does.",
      "fail_rate": 0.8,
      "condition": "",
      "sources": []
    }
  ],
  "workarounds": [
    {
      "action": "",
      "success_rate": 0.95,
      "how": "[tool.setuptools.package-data]\nmypkg = [\"data/*.json\", \"data/*.csv\"]\n# or\n[tool.setuptools]\ninclude-package-data = true",
      "condition": "",
      "sources": []
    },
    {
      "action": "",
      "success_rate": 0.9,
      "how": "echo 'recursive-include mypkg/data *.json *.csv' >> MANIFEST.in\npython -m build --sdist\npip install dist/mypkg-1.0.tar.gz",
      "condition": "",
      "sources": []
    }
  ],
  "workarounds_zh": [],
  "transition_graph": {
    "leads_to": [],
    "preceded_by": [],
    "frequently_confused_with": []
  },
  "official_doc_url": null,
  "official_doc_section": null,
  "error_code": null,
  "verification_tier": "ai_generated",
  "confidence": 0.86,
  "fix_success_rate": 0.8,
  "resolvable": "true",
  "first_seen": "2024-06-30",
  "last_confirmed": "2025-01-01",
  "last_updated": "2025-01-01",
  "evidence_count": 0,
  "tags": [],
  "locale": "en",
  "aliases": []
}