{"record":{"id":"ef46ea0a292c4a72","repo":"run-llama/llama_index","slug":"please-install-yfiles-jupyter-graphs-to-visualize","errorCode":null,"errorMessage":"Please install yfiles_jupyter_graphs to visualize the graph: `pip install yfiles_jupyter_graphs`","messagePattern":"Please install yfiles_jupyter_graphs to visualize the graph: `pip install yfiles_jupyter_graphs`","errorType":"exception","errorClass":"ImportError","httpStatus":null,"severity":"error","filePath":"llama-index-core/llama_index/core/graph_stores/simple_labelled.py","lineNumber":290,"sourceCode":"        # save to html file\n        from pyvis.network import Network\n\n        net = Network(notebook=False, directed=True)\n        net.from_nx(G)\n        net.write_html(name)\n\n    def show_jupyter_graph(self) -> None:\n        \"\"\"\n        Visualizes the graph structure of the graph store.\n\n        NOTE: This function requires yfiles_jupyter_graphs to be installed.\n        NOTE: This method exclusively works in jupyter environments.\n\n        \"\"\"\n        try:\n            from yfiles_jupyter_graphs import GraphWidget\n        except ImportError:\n            raise ImportError(\n                \"Please install yfiles_jupyter_graphs to visualize the graph: `pip install yfiles_jupyter_graphs`\"\n            )\n\n        w = GraphWidget()\n        nodes = []\n        edges = []\n        for node in self.graph.nodes.values():\n            node_dict = {\"id\": node.id, \"properties\": {\"label\": node.id}}\n            nodes.append(node_dict)\n        for triplet in self.graph.triplets:\n            edge = {\n                \"id\": triplet[1],\n                \"start\": triplet[0],\n                \"end\": triplet[2],\n                \"properties\": {\"label\": triplet[1]},\n            }\n            edges.append(edge)\n        w.nodes = nodes","sourceCodeStart":272,"sourceCodeEnd":308,"githubUrl":"https://github.com/run-llama/llama_index/blob/afd0fef371831f9bda13e5af7167cf4e981278ab/llama-index-core/llama_index/core/graph_stores/simple_labelled.py#L272-L308","documentation":"show_jupyter_graph visualizes the property graph using the yfiles_jupyter_graphs widget, which is an optional dependency not installed with llama-index-core. The method catches the ImportError from importing GraphWidget and re-raises it with an install hint.","triggerScenarios":"Calling index.property_graph_store.show_jupyter_graph() (or PropertyGraphIndex visualization helpers) in a Jupyter notebook without yfiles_jupyter_graphs installed.","commonSituations":"Fresh environments where only llama-index-core (or a thin extra) was pip-installed; running outside Jupyter where the widget cannot render anyway; CI environments missing optional viz dependencies.","solutions":["pip install yfiles_jupyter_graphs in the same environment running the notebook.","Use the dependency-free alternative: save_networkx_graph('kg.html') and open the HTML file in a browser.","If installation is impossible (offline/CI), inspect the graph programmatically via store.graph.nodes and store.graph.triplets."],"exampleFix":"# before\nindex.property_graph_store.show_jupyter_graph()  # ImportError\n\n# after (option 1)\n# pip install yfiles_jupyter_graphs\nindex.property_graph_store.show_jupyter_graph()\n\n# after (option 2, no extra dep)\nindex.property_graph_store.save_networkx_graph(\"kg.html\")","handlingStrategy":"validation","validationCode":"def can_show_jupyter_graph() -> bool:\n    try:\n        import yfiles_jupyter_graphs  # noqa: F401\n        return True\n    except ImportError:\n        return False","typeGuard":null,"tryCatchPattern":"try:\n    store.show_jupyter_graph()\nexcept ImportError:\n    store.save_networkx_graph(\"kg.html\")  # dependency-free fallback","preventionTips":["Add yfiles_jupyter_graphs to your project's dev/notebook requirements if you use graph visualization.","Keep save_networkx_graph as a fallback for environments without the widget."],"tags":["graph-store","visualization","missing-dependency","jupyter","importerror"],"backgroundTag":null,"analyzedSha":"afd0fef371831f9bda13e5af7167cf4e981278ab","analyzedAt":"2026-08-15T05:42:58.429Z","schemaVersion":2},"datasetVersion":"2026-08-15T17:31:12.345Z"}