{
  "id": "pip/invalid-requirement-parse-error-from-env-markers",
  "signature": "ERROR: Invalid requirement: '<package> ; extra == \"test\"' - Expected end of string after extra specifier",
  "signature_zh": "错误：无效需求：'<包名> ; extra == \"test\"' - 在额外说明符之后应为字符串结束",
  "regex": "ERROR: Invalid requirement: '[^']+' - Expected end of string after extra specifier",
  "domain": "pip",
  "category": "config_error",
  "subcategory": null,
  "root_cause": "The requirement string contains environment markers (e.g., extra, python_version) with incorrect syntax, such as missing parentheses, extra spaces, or unsupported operators.",
  "root_cause_type": "generic",
  "root_cause_zh": "需求字符串包含环境标记（例如 extra、python_version），但语法不正确，例如缺少括号、多余空格或不支持的运算符。",
  "versions": [
    {
      "version": "pip 21.0+",
      "introduced": null,
      "deprecated": null,
      "removed": null,
      "behavior_change": null,
      "status": "active"
    },
    {
      "version": "Python 3.8-3.12",
      "introduced": null,
      "deprecated": null,
      "removed": null,
      "behavior_change": null,
      "status": "active"
    },
    {
      "version": "setuptools 58+",
      "introduced": null,
      "deprecated": null,
      "removed": null,
      "behavior_change": null,
      "status": "active"
    }
  ],
  "os_specific": {},
  "dead_ends": [
    {
      "action": "Removing all environment markers from the requirement",
      "why_fails": "This changes the package's dependency behavior, potentially breaking conditional dependencies.",
      "fail_rate": 0.7,
      "condition": "",
      "sources": []
    },
    {
      "action": "Using double quotes instead of single quotes in the requirements file",
      "why_fails": "The error is about marker syntax, not quote style; pip parses both quote types the same way.",
      "fail_rate": 0.95,
      "condition": "",
      "sources": []
    },
    {
      "action": "Escaping the semicolon with a backslash",
      "why_fails": "Backslash escaping is not supported in pip requirement strings; it will cause a different parse error.",
      "fail_rate": 0.9,
      "condition": "",
      "sources": []
    }
  ],
  "workarounds": [
    {
      "action": "Correct the marker syntax: use 'package ; extra == \"test\"' (note the spacing) or 'package; extra == \"test\"' (no space before semicolon). For multiple conditions: 'package; extra == \"test\" and python_version >= \"3.8\"'",
      "success_rate": 0.95,
      "how": "Correct the marker syntax: use 'package ; extra == \"test\"' (note the spacing) or 'package; extra == \"test\"' (no space before semicolon). For multiple conditions: 'package; extra == \"test\" and python_version >= \"3.8\"'",
      "condition": "",
      "sources": []
    },
    {
      "action": "pip install --dry-run -r requirements.txt 2>&1 | grep -E 'Invalid requirement'",
      "success_rate": 0.85,
      "how": "pip install --dry-run -r requirements.txt 2>&1 | grep -E 'Invalid requirement'",
      "condition": "",
      "sources": []
    },
    {
      "action": "Replace the invalid requirement with a simpler version: 'package[test]' if the extra is defined in the package itself, or split into separate requirement lines with conditional installation using pip's --extra-index-url.",
      "success_rate": 0.8,
      "how": "Replace the invalid requirement with a simpler version: 'package[test]' if the extra is defined in the package itself, or split into separate requirement lines with conditional installation using pip's --extra-index-url.",
      "condition": "",
      "sources": []
    }
  ],
  "workarounds_zh": [
    "修正标记语法：使用 '包名 ; extra == \"test\"'（注意空格）或 '包名; extra == \"test\"'（分号前无空格）。对于多个条件：'包名; extra == \"test\" and python_version >= \"3.8\"'",
    "pip install --dry-run -r requirements.txt 2>&1 | grep -E 'Invalid requirement'",
    "将无效需求替换为更简单的版本：'包名[test]'（如果包中已定义 extra），或拆分为单独的需求行，使用 pip 的 --extra-index-url 进行条件安装。"
  ],
  "transition_graph": {
    "leads_to": [],
    "preceded_by": [],
    "frequently_confused_with": []
  },
  "official_doc_url": "https://pip.pypa.io/en/stable/reference/requirements-file-format/#environment-markers",
  "official_doc_section": null,
  "error_code": "ERROR",
  "verification_tier": "ai_generated",
  "confidence": 0.87,
  "fix_success_rate": 0.9,
  "resolvable": "true",
  "first_seen": "2024-01-10",
  "last_confirmed": "2024-06-01",
  "last_updated": "2024-06-01",
  "evidence_count": 1,
  "tags": [],
  "locale": "en",
  "aliases": []
}