{
  "id": "python/setuptools-package-dir-conflict",
  "signature": "ERROR: setuptools.errors.PackageDiscoveryError: Multiple top-level packages discovered in a flat-layout: ['mypackage', 'mypackage2']",
  "signature_zh": "错误：setuptools.errors.PackageDiscoveryError：在扁平布局中发现多个顶级包：['mypackage', 'mypackage2']",
  "regex": "ERROR:\\ setuptools\\.errors\\.PackageDiscoveryError:\\ Multiple\\ top\\-level\\ packages\\ discovered\\ in\\ a\\ flat\\-layout:\\ \\['mypackage',\\ 'mypackage2'\\]",
  "domain": "python",
  "category": "config_error",
  "subcategory": null,
  "root_cause": "Setuptools auto-discovery finds multiple packages in the root directory, causing ambiguity.",
  "root_cause_type": "generic",
  "root_cause_zh": "Setuptools 自动发现功能在根目录中找到多个包，导致歧义。",
  "versions": [
    {
      "version": "3.9",
      "introduced": null,
      "deprecated": null,
      "removed": null,
      "behavior_change": null,
      "status": "active"
    },
    {
      "version": "3.10",
      "introduced": null,
      "deprecated": null,
      "removed": null,
      "behavior_change": null,
      "status": "active"
    }
  ],
  "os_specific": {},
  "dead_ends": [
    {
      "action": "Renaming one package to a subpackage",
      "why_fails": "Does not resolve the discovery conflict; setuptools still sees two top-level packages.",
      "fail_rate": 0.7,
      "condition": "",
      "sources": []
    },
    {
      "action": "Removing one package directory entirely",
      "why_fails": "Loss of code; better to configure explicitly.",
      "fail_rate": 0.5,
      "condition": "",
      "sources": []
    }
  ],
  "workarounds": [
    {
      "action": "Explicitly specify packages in setup.cfg or setup.py",
      "success_rate": 0.95,
      "how": "In setup.cfg: [options]\npackages = find:\nfind:\ninclude = mypackage*\nOr in setup.py: packages=['mypackage']",
      "condition": "",
      "sources": []
    },
    {
      "action": "Use namespace packages if both are related",
      "success_rate": 0.85,
      "how": "Rename packages to share a namespace like 'company.mypackage' and 'company.mypackage2'.",
      "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-10-01",
  "last_confirmed": "2025-01-01",
  "last_updated": "2025-01-01",
  "evidence_count": 0,
  "tags": [],
  "locale": "en",
  "aliases": []
}