{
  "id": "python/pip-requirements-parse-error-options",
  "signature": "ERROR: Invalid requirement: '--extra-index-url https://example.com/simple' (from line 3 of requirements.txt)\nHint: Requirements must be in the form 'package[extras]==version'.",
  "signature_zh": "错误：无效的需求：'--extra-index-url https://example.com/simple'（来自 requirements.txt 第 3 行）\n提示：需求必须采用 'package[extras]==version' 的形式。",
  "regex": "ERROR:\\ Invalid\\ requirement:\\ '\\-\\-extra\\-index\\-url\\ https://example\\.com/simple'\\ \\(from\\ line\\ 3\\ of\\ requirements\\.txt\\)\\\nHint:\\ Requirements\\ must\\ be\\ in\\ the\\ form\\ 'package\\[extras\\]==version'\\.",
  "domain": "python",
  "category": "config_error",
  "subcategory": null,
  "root_cause": "A global option like --extra-index-url is placed after a package line in requirements.txt; pip only accepts global options at the top of the file, before any requirement.",
  "root_cause_type": "generic",
  "root_cause_zh": "像 --extra-index-url 这样的全局选项被放在 requirements.txt 中某个包行之后；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": "Quoting turns it into an invalid package name; pip still rejects it.",
      "fail_rate": 0.95,
      "condition": "",
      "sources": []
    },
    {
      "action": "",
      "why_fails": "Global options are only valid before the first requirement; moving to the end does not help.",
      "fail_rate": 0.9,
      "condition": "",
      "sources": []
    }
  ],
  "workarounds": [
    {
      "action": "",
      "success_rate": 0.98,
      "how": "Move all global options to the top of requirements.txt:\n  --extra-index-url https://example.com/simple\n  --trusted-host example.com\n  foo==1.2.3\n  bar>=2.0",
      "condition": "",
      "sources": []
    },
    {
      "action": "",
      "success_rate": 0.95,
      "how": "Alternatively pass options on the CLI:\n  pip install -r requirements.txt --extra-index-url https://example.com/simple",
      "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.9,
  "fix_success_rate": 0.8,
  "resolvable": "true",
  "first_seen": "2024-06-11",
  "last_confirmed": "2025-01-01",
  "last_updated": "2025-01-01",
  "evidence_count": 0,
  "tags": [],
  "locale": "en",
  "aliases": []
}