run-llama/llama_index · error · ImportError
Please install yfiles_jupyter_graphs to visualize the graph:
Error message
Please install yfiles_jupyter_graphs to visualize the graph: `pip install yfiles_jupyter_graphs`
What it means
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.
Source
Thrown at llama-index-core/llama_index/core/graph_stores/simple_labelled.py:290
# save to html file
from pyvis.network import Network
net = Network(notebook=False, directed=True)
net.from_nx(G)
net.write_html(name)
def show_jupyter_graph(self) -> None:
"""
Visualizes the graph structure of the graph store.
NOTE: This function requires yfiles_jupyter_graphs to be installed.
NOTE: This method exclusively works in jupyter environments.
"""
try:
from yfiles_jupyter_graphs import GraphWidget
except ImportError:
raise ImportError(
"Please install yfiles_jupyter_graphs to visualize the graph: `pip install yfiles_jupyter_graphs`"
)
w = GraphWidget()
nodes = []
edges = []
for node in self.graph.nodes.values():
node_dict = {"id": node.id, "properties": {"label": node.id}}
nodes.append(node_dict)
for triplet in self.graph.triplets:
edge = {
"id": triplet[1],
"start": triplet[0],
"end": triplet[2],
"properties": {"label": triplet[1]},
}
edges.append(edge)
w.nodes = nodesView on GitHub (pinned to afd0fef371)
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.
Example fix
# before
index.property_graph_store.show_jupyter_graph() # ImportError
# after (option 1)
# pip install yfiles_jupyter_graphs
index.property_graph_store.show_jupyter_graph()
# after (option 2, no extra dep)
index.property_graph_store.save_networkx_graph("kg.html") Defensive patterns
Strategy: validation
Validate before calling
def can_show_jupyter_graph() -> bool:
try:
import yfiles_jupyter_graphs # noqa: F401
return True
except ImportError:
return False Try / catch
try:
store.show_jupyter_graph()
except ImportError:
store.save_networkx_graph("kg.html") # dependency-free fallback Prevention
- 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.
When it happens
Trigger: Calling index.property_graph_store.show_jupyter_graph() (or PropertyGraphIndex visualization helpers) in a Jupyter notebook without yfiles_jupyter_graphs installed.
Common situations: 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.
Related errors
- Detected nested async. Please use nest_asyncio.apply() to al
- Cannot import cohere package, please `pip install cohere`.
- SimpleGraphStore does not support get_schema
- SimpleGraphStore does not support query
- Vector query not implemented for SimplePropertyGraphStore.
AI-assisted analysis of run-llama/llama_index@afd0fef371 (2026-08-15).
Data as JSON: /api/errors/ef46ea0a292c4a72.
Report an issue: GitHub.