{
  "id": "pip/cache-read-only-filesystem",
  "signature": "ERROR: Could not install packages due to an OSError: [Errno 30] Read-only file system: '/root/.cache/pip/http'",
  "signature_zh": "错误：由于操作系统错误 [Errno 30] 只读文件系统，无法安装软件包",
  "regex": "ERROR: Could not install packages due to an OSError: \\[Errno 30\\] Read-only file system: '.+/pip/(http|cache|wheels)'",
  "domain": "pip",
  "category": "system_error",
  "subcategory": null,
  "root_cause": "pip's cache directory is located on a read-only filesystem (e.g., in a container, CI environment, or mounted volume with read-only permissions), preventing pip from writing or updating cached files.",
  "root_cause_type": "generic",
  "root_cause_zh": "pip 的缓存目录位于只读文件系统上（例如在容器、CI 环境或具有只读权限的挂载卷中），阻止 pip 写入或更新缓存文件。",
  "versions": [
    {
      "version": "pip 23.0",
      "introduced": null,
      "deprecated": null,
      "removed": null,
      "behavior_change": null,
      "status": "active"
    },
    {
      "version": "pip 24.0",
      "introduced": null,
      "deprecated": null,
      "removed": null,
      "behavior_change": null,
      "status": "active"
    },
    {
      "version": "pip 24.2",
      "introduced": null,
      "deprecated": null,
      "removed": null,
      "behavior_change": null,
      "status": "active"
    }
  ],
  "os_specific": {},
  "dead_ends": [
    {
      "action": "Run pip with sudo or as root to override permissions",
      "why_fails": "The filesystem is genuinely read-only (e.g., mounted with -o ro); root cannot write to a read-only filesystem either. This often happens in Docker containers where the volume is mounted read-only.",
      "fail_rate": 0.9,
      "condition": "",
      "sources": []
    },
    {
      "action": "Delete the cache directory manually with rm -rf /root/.cache/pip",
      "why_fails": "Deletion also requires write permission to the filesystem; the same read-only restriction applies.",
      "fail_rate": 0.95,
      "condition": "",
      "sources": []
    }
  ],
  "workarounds": [
    {
      "action": "Disable pip's cache entirely: pip install --no-cache-dir <package>",
      "success_rate": 0.95,
      "how": "Disable pip's cache entirely: pip install --no-cache-dir <package>",
      "condition": "",
      "sources": []
    },
    {
      "action": "Set PIP_CACHE_DIR environment variable to a writable location: export PIP_CACHE_DIR=/tmp/pip-cache && pip install <package>",
      "success_rate": 0.9,
      "how": "Set PIP_CACHE_DIR environment variable to a writable location: export PIP_CACHE_DIR=/tmp/pip-cache && pip install <package>",
      "condition": "",
      "sources": []
    }
  ],
  "workarounds_zh": [
    "完全禁用 pip 的缓存：pip install --no-cache-dir <package>",
    "将 PIP_CACHE_DIR 环境变量设置为可写位置：export PIP_CACHE_DIR=/tmp/pip-cache && pip install <package>"
  ],
  "transition_graph": {
    "leads_to": [],
    "preceded_by": [],
    "frequently_confused_with": []
  },
  "official_doc_url": "https://pip.pypa.io/en/stable/topics/caching/",
  "official_doc_section": null,
  "error_code": "ERROR",
  "verification_tier": "ai_generated",
  "confidence": 0.85,
  "fix_success_rate": 0.9,
  "resolvable": "true",
  "first_seen": "2023-11-20",
  "last_confirmed": "2024-06-01",
  "last_updated": "2024-06-01",
  "evidence_count": 1,
  "tags": [],
  "locale": "en",
  "aliases": []
}