{
  "id": "python/pip-metadata-file-not-found",
  "signature": "ERROR: Could not install packages due to an OSError: [Errno 2] No such file or directory: '.../METADATA'",
  "signature_zh": "错误：由于 OSError 无法安装包：[Errno 2] 没有那个文件或目录：'.../METADATA'",
  "regex": "ERROR:\\ Could\\ not\\ install\\ packages\\ due\\ to\\ an\\ OSError:\\ \\[Errno\\ 2\\]\\ No\\ such\\ file\\ or\\ directory:\\ '\\.\\.\\./METADATA'",
  "domain": "python",
  "category": "data_error",
  "subcategory": null,
  "root_cause": "A previously partially installed or corrupted package directory lacks the required METADATA file, causing pip to fail during metadata validation.",
  "root_cause_type": "generic",
  "root_cause_zh": "先前部分安装或损坏的包目录缺少必需的 METADATA 文件，导致 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"
    }
  ],
  "os_specific": {},
  "dead_ends": [
    {
      "action": "Reinstalling the package with `--force-reinstall`",
      "why_fails": "If the existing broken directory is not cleaned, pip may still encounter the same missing file.",
      "fail_rate": 0.5,
      "condition": "",
      "sources": []
    },
    {
      "action": "Manually creating an empty METADATA file",
      "why_fails": "The METADATA file must contain valid package metadata; an empty file will cause parsing errors.",
      "fail_rate": 0.9,
      "condition": "",
      "sources": []
    }
  ],
  "workarounds": [
    {
      "action": "Remove the corrupted package directory manually",
      "success_rate": 0.95,
      "how": "Find the site-packages directory (e.g., `python -m site --user-site`), then delete the package folder (e.g., `rm -rf <package_name>-*`). Then reinstall.",
      "condition": "",
      "sources": []
    },
    {
      "action": "Use pip's `--no-cache-dir` and reinstall",
      "success_rate": 0.85,
      "how": "`pip install --no-cache-dir --force-reinstall <package_name>`",
      "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.82,
  "fix_success_rate": 0.8,
  "resolvable": "true",
  "first_seen": "2024-07-22",
  "last_confirmed": "2025-01-01",
  "last_updated": "2025-01-01",
  "evidence_count": 0,
  "tags": [],
  "locale": "en",
  "aliases": []
}