{
  "id": "python/setuptools-find-packages-no-init",
  "signature": "error: Multiple top-level packages discovered in a flat-layout: ['pkg1', 'pkg2'].",
  "signature_zh": "错误：在扁平布局中发现了多个顶级包：['pkg1', 'pkg2']。",
  "regex": "error:\\ Multiple\\ top\\-level\\ packages\\ discovered\\ in\\ a\\ flat\\-layout:\\ \\['pkg1',\\ 'pkg2'\\]\\.",
  "domain": "python",
  "category": "config_error",
  "subcategory": null,
  "root_cause": "When using find_packages() without specifying where, setuptools detects multiple top-level packages in the current directory, which is ambiguous and not allowed.",
  "root_cause_type": "generic",
  "root_cause_zh": "使用find_packages()而未指定where时，setuptools检测到当前目录中的多个顶级包，这是不明确的，不允许。",
  "versions": [
    {
      "version": "3.8",
      "introduced": null,
      "deprecated": null,
      "removed": null,
      "behavior_change": null,
      "status": "active"
    },
    {
      "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"
    },
    {
      "version": "3.11",
      "introduced": null,
      "deprecated": null,
      "removed": null,
      "behavior_change": null,
      "status": "active"
    }
  ],
  "os_specific": {},
  "dead_ends": [
    {
      "action": "",
      "why_fails": "This is not practical if both packages are needed; and the error is about configuration, not about having multiple packages.",
      "fail_rate": 0.4,
      "condition": "",
      "sources": []
    },
    {
      "action": "",
      "why_fails": "This will cause no packages to be installed, defeating the purpose.",
      "fail_rate": 0.9,
      "condition": "",
      "sources": []
    },
    {
      "action": "",
      "why_fails": "This still leaves pkg2 undiscovered and may not include all needed modules.",
      "fail_rate": 0.5,
      "condition": "",
      "sources": []
    }
  ],
  "workarounds": [
    {
      "action": "",
      "success_rate": 0.9,
      "how": "Specify the source directory: `packages=find_packages(where='src')` and move packages to src/ layout.",
      "condition": "",
      "sources": []
    },
    {
      "action": "",
      "success_rate": 0.95,
      "how": "Explicitly list packages: `packages=['pkg1', 'pkg2']` in setup.py.",
      "condition": "",
      "sources": []
    },
    {
      "action": "",
      "success_rate": 0.8,
      "how": "Use `find_namespace_packages()` for namespace packages if applicable.",
      "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.84,
  "fix_success_rate": 0.8,
  "resolvable": "true",
  "first_seen": "2024-06-01",
  "last_confirmed": "2025-01-01",
  "last_updated": "2025-01-01",
  "evidence_count": 0,
  "tags": [],
  "locale": "en",
  "aliases": []
}