{
  "id": "python/fastapi-import-error-pydantic",
  "signature": "ImportError: cannot import name 'BaseModel' from 'pydantic'",
  "signature_zh": "导入错误：无法从 'pydantic' 导入名称 'BaseModel'",
  "regex": "ImportError:\\ cannot\\ import\\ name\\ 'BaseModel'\\ from\\ 'pydantic'",
  "domain": "python",
  "category": "module_error",
  "subcategory": null,
  "root_cause": "Pydantic version is too old or not installed; BaseModel was introduced in v1.",
  "root_cause_type": "generic",
  "root_cause_zh": "Pydantic版本过旧或未安装；BaseModel从v1版本开始引入。",
  "versions": [
    {
      "version": "3.x",
      "introduced": null,
      "deprecated": null,
      "removed": null,
      "behavior_change": null,
      "status": "active"
    }
  ],
  "os_specific": {},
  "dead_ends": [
    {
      "action": "Installing an older version of pydantic that does not have BaseModel.",
      "why_fails": "BaseModel is a core feature; older versions may not have it.",
      "fail_rate": 0.7,
      "condition": "",
      "sources": []
    },
    {
      "action": "Trying to import from pydantic.dataclasses instead.",
      "why_fails": "That is a different feature; BaseModel is the standard way.",
      "fail_rate": 0.6,
      "condition": "",
      "sources": []
    }
  ],
  "workarounds": [
    {
      "action": "Upgrade pydantic to a recent version.",
      "success_rate": 0.95,
      "how": "pip install --upgrade pydantic",
      "condition": "",
      "sources": []
    },
    {
      "action": "If using pydantic v2, import from pydantic.v1.",
      "success_rate": 0.85,
      "how": "from pydantic.v1 import BaseModel",
      "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.85,
  "fix_success_rate": 0.8,
  "resolvable": "true",
  "first_seen": "2024-11-18",
  "last_confirmed": "2025-01-01",
  "last_updated": "2025-01-01",
  "evidence_count": 0,
  "tags": [],
  "locale": "en",
  "aliases": []
}