{
  "id": "python/starlette-importerror-uvicorn",
  "signature": "ImportError: No module named 'uvicorn'",
  "signature_zh": "ImportError: 没有名为 'uvicorn' 的模块",
  "regex": "ImportError:\\ No\\ module\\ named\\ 'uvicorn'",
  "domain": "python",
  "category": "module_error",
  "subcategory": null,
  "root_cause": "Uvicorn ASGI server is not installed in the current Python environment.",
  "root_cause_type": "generic",
  "root_cause_zh": "当前 Python 环境中未安装 Uvicorn ASGI 服务器。",
  "versions": [
    {
      "version": "3.x",
      "introduced": null,
      "deprecated": null,
      "removed": null,
      "behavior_change": null,
      "status": "active"
    }
  ],
  "os_specific": {},
  "dead_ends": [
    {
      "action": "Installing in wrong virtual environment",
      "why_fails": "Package installed but not in active env.",
      "fail_rate": 0.8,
      "condition": "",
      "sources": []
    },
    {
      "action": "Using pip without --user flag in system Python",
      "why_fails": "May not have permissions; use virtualenv.",
      "fail_rate": 0.6,
      "condition": "",
      "sources": []
    }
  ],
  "workarounds": [
    {
      "action": "Install uvicorn using pip",
      "success_rate": 0.95,
      "how": "pip install uvicorn\n# Or for production: pip install 'uvicorn[standard]'",
      "condition": "",
      "sources": []
    },
    {
      "action": "Activate correct virtual environment",
      "success_rate": 0.9,
      "how": "source venv/bin/activate  # Linux/Mac\nvenv\\Scripts\\activate  # Windows\npip install uvicorn",
      "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.88,
  "fix_success_rate": 0.8,
  "resolvable": "true",
  "first_seen": "2024-09-01",
  "last_confirmed": "2025-01-01",
  "last_updated": "2025-01-01",
  "evidence_count": 0,
  "tags": [],
  "locale": "en",
  "aliases": []
}