{
  "id": "python/setuptools-package-init-missing",
  "signature": "error: Each package must have an __init__.py file in its directory",
  "signature_zh": "错误：每个包目录中必须有一个__init__.py文件",
  "regex": "error:\\ Each\\ package\\ must\\ have\\ an\\ __init__\\.py\\ file\\ in\\ its\\ directory",
  "domain": "python",
  "category": "config_error",
  "subcategory": null,
  "root_cause": "Setuptools requires __init__.py for package discovery in older versions or certain configurations.",
  "root_cause_type": "generic",
  "root_cause_zh": "在旧版本或某些配置中，setuptools要求包目录中包含__init__.py文件。",
  "versions": [
    {
      "version": "3.8",
      "introduced": null,
      "deprecated": null,
      "removed": null,
      "behavior_change": null,
      "status": "active"
    }
  ],
  "os_specific": {},
  "dead_ends": [
    {
      "action": "Adding empty __init__.py to root only",
      "why_fails": "Each subpackage directory needs its own __init__.py.",
      "fail_rate": 0.8,
      "condition": "",
      "sources": []
    },
    {
      "action": "Removing the package from setup.py",
      "why_fails": "Excludes package from distribution; not a fix.",
      "fail_rate": 0.6,
      "condition": "",
      "sources": []
    }
  ],
  "workarounds": [
    {
      "action": "Create __init__.py in every package directory",
      "success_rate": 0.95,
      "how": "find . -type d -name 'mypackage' -exec touch {}/__init__.py \\;",
      "condition": "",
      "sources": []
    },
    {
      "action": "Use find_packages with exclude or namespace packages",
      "success_rate": 0.9,
      "how": "from setuptools import find_packages\nsetup(packages=find_packages(include=['mypackage*']))",
      "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.85,
  "fix_success_rate": 0.8,
  "resolvable": "true",
  "first_seen": "2024-07-22",
  "last_confirmed": "2025-01-01",
  "last_updated": "2025-01-01",
  "evidence_count": 0,
  "tags": [],
  "locale": "en",
  "aliases": []
}