{
  "id": "python/matplotlib-no-display-figure",
  "signature": "UserWarning: FigureCanvasAgg is non-interactive, and thus cannot be shown",
  "signature_zh": "UserWarning: FigureCanvasAgg 是非交互式的，因此无法显示",
  "regex": "UserWarning:\\ FigureCanvasAgg\\ is\\ non\\-interactive,\\ and\\ thus\\ cannot\\ be\\ shown",
  "domain": "python",
  "category": "runtime_error",
  "subcategory": null,
  "root_cause": "plt.show() called while matplotlib is using a non-interactive backend (Agg), typically on a headless environment or after matplotlib.use('Agg').",
  "root_cause_type": "generic",
  "root_cause_zh": "在 matplotlib 使用非交互后端 (Agg) 时调用了 plt.show()，通常发生在无头环境或调用了 matplotlib.use('Agg') 之后。",
  "versions": [
    {
      "version": "3.x",
      "introduced": null,
      "deprecated": null,
      "removed": null,
      "behavior_change": null,
      "status": "active"
    }
  ],
  "os_specific": {},
  "dead_ends": [
    {
      "action": "",
      "why_fails": "The block argument only controls blocking behavior for interactive backends; Agg still cannot render a window.",
      "fail_rate": 0.9,
      "condition": "",
      "sources": []
    },
    {
      "action": "",
      "why_fails": "The backend selection is environment-driven, not an installation defect.",
      "fail_rate": 0.85,
      "condition": "",
      "sources": []
    }
  ],
  "workarounds": [
    {
      "action": "",
      "success_rate": 0.97,
      "how": "fig, ax = plt.subplots()\nax.plot([1,2,3])\nfig.savefig('plot.png', dpi=150)",
      "condition": "",
      "sources": []
    },
    {
      "action": "",
      "success_rate": 0.82,
      "how": "pip install PyQt5\nimport matplotlib\nmatplotlib.use('Qt5Agg')\nimport matplotlib.pyplot as plt\nplt.plot([1,2,3]); plt.show()",
      "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.87,
  "fix_success_rate": 0.8,
  "resolvable": "true",
  "first_seen": "2024-05-02",
  "last_confirmed": "2025-01-01",
  "last_updated": "2025-01-01",
  "evidence_count": 0,
  "tags": [],
  "locale": "en",
  "aliases": []
}