{
  "id": "python/pip-requires-python-invalid-metadata",
  "signature": "ERROR: Invalid requirement: 'Requires-Python: >=3.8'",
  "signature_zh": "错误：无效的依赖项：'Requires-Python: >=3.8'",
  "regex": "ERROR:\\ Invalid\\ requirement:\\ 'Requires\\-Python:\\ >=3\\.8'",
  "domain": "python",
  "category": "config_error",
  "subcategory": null,
  "root_cause": "A requirements.txt file contains package metadata lines (like Requires-Python or Name:) pasted from a PKG-INFO; pip's requirement parser rejects them.",
  "root_cause_type": "generic",
  "root_cause_zh": "requirements.txt 包含从 PKG-INFO 粘贴的包元数据行（如 Requires-Python 或 Name:），pip 的依赖解析器会拒绝它们。",
  "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": "If other metadata lines remain, parsing still fails; also hides the actual intent of the file.",
      "fail_rate": 0.6,
      "condition": "",
      "sources": []
    },
    {
      "action": "",
      "why_fails": "--no-deps skips dependency resolution, not requirement parsing; the invalid line still errors.",
      "fail_rate": 0.9,
      "condition": "",
      "sources": []
    }
  ],
  "workarounds": [
    {
      "action": "",
      "success_rate": 0.98,
      "how": "# requirements.txt should look like:\nrequests>=2.31\nnumpy==1.26.4\n# Remove any 'Name:', 'Version:', 'Requires-Python:' lines.",
      "condition": "",
      "sources": []
    },
    {
      "action": "",
      "success_rate": 0.95,
      "how": "pip freeze > requirements.txt\n# verify each line parses\npython - <<'PY'\nfrom packaging.requirements import Requirement\nfor i, l in enumerate(open('requirements.txt'),1):\n    l=l.strip()\n    if l and not l.startswith('#'):\n        Requirement(l)\nprint('ok')\nPY",
      "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-06-05",
  "last_confirmed": "2025-01-01",
  "last_updated": "2025-01-01",
  "evidence_count": 0,
  "tags": [],
  "locale": "en",
  "aliases": []
}