{
  "id": "python/pip-install-metadata-generation-failed",
  "signature": "error: metadata-generation-failed\n× Encountered error while generating package metadata.\n╰─> See above for output.",
  "signature_zh": "错误：元数据生成失败\n× 生成包元数据时遇到错误。",
  "regex": "error:\\ metadata\\-generation\\-failed\\\n×\\ Encountered\\ error\\ while\\ generating\\ package\\ metadata\\.\\\n╰─>\\ See\\ above\\ for\\ output\\.",
  "domain": "python",
  "category": "install_error",
  "subcategory": null,
  "root_cause": "pip uses PEP 517 build isolation to build wheel metadata in an isolated environment. If the build backend (setuptools, hatchling, poetry-core) is missing or a build dependency is not declared in pyproject.toml, metadata generation fails before the actual install.",
  "root_cause_type": "generic",
  "root_cause_zh": "pip 使用 PEP 517 构建隔离在独立环境中构建 wheel 元数据。如果构建后端（setuptools、hatchling、poetry-core）缺失或构建依赖未在 pyproject.toml 中声明，元数据生成会在实际安装前失败。",
  "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"
    },
    {
      "version": "3.12",
      "introduced": null,
      "deprecated": null,
      "removed": null,
      "behavior_change": null,
      "status": "active"
    }
  ],
  "os_specific": {},
  "dead_ends": [
    {
      "action": "",
      "why_fails": "Disables isolation but the missing build dependency is still not present in the current environment, so the backend import fails anyway.",
      "fail_rate": 0.55,
      "condition": "",
      "sources": []
    },
    {
      "action": "",
      "why_fails": "The failure is in the build backend invocation, not a corrupted download; clearing cache does not add missing build deps.",
      "fail_rate": 0.7,
      "condition": "",
      "sources": []
    },
    {
      "action": "",
      "why_fails": "Newer pip still respects pyproject.toml build-system requirements; the missing dependency is unchanged.",
      "fail_rate": 0.6,
      "condition": "",
      "sources": []
    }
  ],
  "workarounds": [
    {
      "action": "",
      "success_rate": 0.85,
      "how": "pip install setuptools wheel\npip install --no-build-isolation ./mypackage",
      "condition": "",
      "sources": []
    },
    {
      "action": "",
      "success_rate": 0.9,
      "how": "[build-system]\nrequires = [\"setuptools>=64\", \"wheel\", \"cython\"]\nbuild-backend = \"setuptools.build_meta\"",
      "condition": "",
      "sources": []
    },
    {
      "action": "",
      "success_rate": 0.8,
      "how": "pip install -v ./mypackage 2>&1 | grep -A5 'Error'",
      "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.88,
  "fix_success_rate": 0.8,
  "resolvable": "true",
  "first_seen": "2024-03-12",
  "last_confirmed": "2025-01-01",
  "last_updated": "2025-01-01",
  "evidence_count": 0,
  "tags": [],
  "locale": "en",
  "aliases": []
}