{
  "id": "pytorch/mps-backend-unavailable",
  "signature": "RuntimeError: MPS backend is not available. Please install PyTorch with MPS support or use CPU/CUDA.",
  "signature_zh": "运行时错误：MPS后端不可用。请安装支持MPS的PyTorch或使用CPU/CUDA。",
  "regex": "RuntimeError: MPS backend is not available\\. Please install PyTorch with MPS support or use CPU/CUDA\\.",
  "domain": "pytorch",
  "category": "config_error",
  "subcategory": null,
  "root_cause": "PyTorch was built without MPS (Metal Performance Shaders) support, or the system lacks a compatible Apple GPU/macOS version.",
  "root_cause_type": "generic",
  "root_cause_zh": "PyTorch编译时未启用MPS（Metal Performance Shaders）支持，或系统缺少兼容的Apple GPU/macOS版本。",
  "versions": [
    {
      "version": "torch>=1.12",
      "introduced": null,
      "deprecated": null,
      "removed": null,
      "behavior_change": null,
      "status": "active"
    },
    {
      "version": "macOS>=12.3",
      "introduced": null,
      "deprecated": null,
      "removed": null,
      "behavior_change": null,
      "status": "active"
    },
    {
      "version": "MPS>=1.0",
      "introduced": null,
      "deprecated": null,
      "removed": null,
      "behavior_change": null,
      "status": "active"
    }
  ],
  "os_specific": {},
  "dead_ends": [
    {
      "action": "conda install pytorch -c pytorch",
      "why_fails": "Installing PyTorch from conda default channel often ships CPU-only build; user must explicitly select MPS variant.",
      "fail_rate": 0.7,
      "condition": "",
      "sources": []
    },
    {
      "action": "export PYTORCH_MPS_HIGH_WATERMARK_RATIO=0.0",
      "why_fails": "Setting environment variable PYTORCH_MPS_HIGH_WATERMARK_RATIO=0.0 does not enable MPS; it only controls memory threshold.",
      "fail_rate": 0.9,
      "condition": "",
      "sources": []
    }
  ],
  "workarounds": [
    {
      "action": "Install PyTorch with MPS support: pip3 install torch torchvision torchaudio --index-url https://download.pytorch.org/whl/mps. Then verify with: import torch; print(torch.backends.mps.is_available())",
      "success_rate": 0.9,
      "how": "Install PyTorch with MPS support: pip3 install torch torchvision torchaudio --index-url https://download.pytorch.org/whl/mps. Then verify with: import torch; print(torch.backends.mps.is_available())",
      "condition": "",
      "sources": []
    },
    {
      "action": "Fall back to CPU: device = torch.device('cuda' if torch.cuda.is_available() else ('mps' if torch.backends.mps.is_available() else 'cpu'))",
      "success_rate": 0.95,
      "how": "Fall back to CPU: device = torch.device('cuda' if torch.cuda.is_available() else ('mps' if torch.backends.mps.is_available() else 'cpu'))",
      "condition": "",
      "sources": []
    }
  ],
  "workarounds_zh": [
    "安装支持MPS的PyTorch：pip3 install torch torchvision torchaudio --index-url https://download.pytorch.org/whl/mps。然后验证：import torch; print(torch.backends.mps.is_available())",
    "回退到CPU：device = torch.device('cuda' if torch.cuda.is_available() else ('mps' if torch.backends.mps.is_available() else 'cpu'))"
  ],
  "transition_graph": {
    "leads_to": [],
    "preceded_by": [],
    "frequently_confused_with": []
  },
  "official_doc_url": "https://pytorch.org/docs/stable/mps.html",
  "official_doc_section": null,
  "error_code": "MPS_NOT_AVAILABLE",
  "verification_tier": "ai_generated",
  "confidence": 0.9,
  "fix_success_rate": 0.85,
  "resolvable": "true",
  "first_seen": "2023-04-05",
  "last_confirmed": "2024-06-01",
  "last_updated": "2024-06-01",
  "evidence_count": 1,
  "tags": [],
  "locale": "en",
  "aliases": []
}