{
  "id": "python/setuptools-find-packages-missing-subpackage",
  "signature": "ModuleNotFoundError: No module named 'mypkg.subpkg'",
  "signature_zh": "ModuleNotFoundError：没有名为 'mypkg.subpkg' 的模块",
  "regex": "ModuleNotFoundError:\\ No\\ module\\ named\\ 'mypkg\\.subpkg'",
  "domain": "python",
  "category": "module_error",
  "subcategory": null,
  "root_cause": "setuptools.find_packages() did not include the subpackage because it lacks an __init__.py or was excluded by patterns.",
  "root_cause_type": "generic",
  "root_cause_zh": "setuptools.find_packages() 未包含该子包，因为它缺少 __init__.py 或被排除模式过滤掉了。",
  "versions": [
    {
      "version": "3.x",
      "introduced": null,
      "deprecated": null,
      "removed": null,
      "behavior_change": null,
      "status": "active"
    }
  ],
  "os_specific": {},
  "dead_ends": [
    {
      "action": "",
      "why_fails": "install_requires lists external deps, not local packages.",
      "fail_rate": 0.95,
      "condition": "",
      "sources": []
    },
    {
      "action": "",
      "why_fails": "Breaks on upgrade and hides the packaging bug.",
      "fail_rate": 0.7,
      "condition": "",
      "sources": []
    }
  ],
  "workarounds": [
    {
      "action": "",
      "success_rate": 0.95,
      "how": "`touch mypkg/subpkg/__init__.py` then rebuild and reinstall the wheel.",
      "condition": "",
      "sources": []
    },
    {
      "action": "",
      "success_rate": 0.92,
      "how": "In setup.py: `from setuptools import find_namespace_packages` then `packages=find_namespace_packages(include=['mypkg*'])`.",
      "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.87,
  "fix_success_rate": 0.8,
  "resolvable": "true",
  "first_seen": "2024-04-11",
  "last_confirmed": "2025-01-01",
  "last_updated": "2025-01-01",
  "evidence_count": 0,
  "tags": [],
  "locale": "en",
  "aliases": []
}