Join us at FabCon Atlanta from March 16 - 20, 2026, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.
Register now!Join the Fabric FabCon Global Hackathon—running virtually through Nov 3. Open to all skill levels. $10,000 in prizes! Register now.
GraphViz is one of my favourite code-to-graph tools: https://graphviz.readthedocs.io/en/stable/examples.html#structs-revisited-py
You can create something like this:
The best part about it, besides just being built from code, is that the objects are automatically spaced around the canvas.
However, it doesn't look like it works out-of-the-box in a Fabric notebook by just using `import graphviz` via PySpark.
The error ends with: "FileNotFoundError: [Errno 2] No such file or directory: 'xdg-open'"
Is there any workaround for this, or is there any known way of using GraphViz in a Fabric Notebook ?
Thanks !
Solved! Go to Solution.
Hi @AleisterTJMraz ,
Thanks for reaching out to the Microsoft fabric community forum.
Tried to pip install graphviz in my Fabric Notebook
So as you can see from the shared images graphviz successfully got installed and got imported into fabric.
The error you're encountering isn't due to a lack of Graphviz support in Fabric, but rather it's caused by this specific line in your code:
graphviz.Digraph('structs', filename='structs_revisited.gv',
node_attr={'shape': 'record'})
in your cell. Pyspark is not able to find structs_revisited.gv file.
Please modify the code in such a way that pyspark is able to retieve the file information, so as to bypass the error.
If you find this post helpful, please mark it as an "Accept as Solution" and consider giving a KUDOS. Feel free to reach out if you need further assistance.
Thank you
Hi @AleisterTJMraz ,
As we haven’t heard back from you, we wanted to kindly follow up to check if the solution provided by the community members for the issue worked. If our response addressed, please mark it as Accept as solution and click Yes if you found it helpful.
Thanks and regards
Hi @AleisterTJMraz
I wanted to check if you had the opportunity to review the information provided. Please feel free to contact us if you have any further questions. If our responses has addressed your query, please accept it as a solution and give a 'Kudos' so other members can easily find it.
Thank you.
Hi @AleisterTJMraz ,
May I ask if you have resolved this issue? If so, please mark the helpful reply and accept it as the solution. This will be helpful for other community members who have similar problems to solve it faster.
Thank you.
Hi @AleisterTJMraz ,
Thanks for reaching out to the Microsoft fabric community forum.
Tried to pip install graphviz in my Fabric Notebook
So as you can see from the shared images graphviz successfully got installed and got imported into fabric.
The error you're encountering isn't due to a lack of Graphviz support in Fabric, but rather it's caused by this specific line in your code:
graphviz.Digraph('structs', filename='structs_revisited.gv',
node_attr={'shape': 'record'})
in your cell. Pyspark is not able to find structs_revisited.gv file.
Please modify the code in such a way that pyspark is able to retieve the file information, so as to bypass the error.
If you find this post helpful, please mark it as an "Accept as Solution" and consider giving a KUDOS. Feel free to reach out if you need further assistance.
Thank you
Hi @AleisterTJMraz ,
Yeah, GraphViz is super handy for visualizing relationships like that. The issue you're hitting is because Fabric Notebooks (at least for now) don't come with the GraphViz system binaries pre-installed — specifically the dot executable, which is what the Python graphviz package relies on under the hood.
One workaround is to use pydot + matplotlib or even networkx for simpler graphing needs, though they don’t give you the same layout quality as GraphViz. Another option is to generate the .dot file in your notebook and then render it externally (e.g., download and visualize locally or in another environment that has GraphViz installed).
If you're working in a Spark context and need something more integrated, you might consider exporting the graph data and using Power BI or another viz tool that supports custom visuals.
Would be cool if Fabric added native support for this in the future. Maybe worth submitting as an idea?
If my response resolved your query, kindly mark it as the Accepted Solution to assist others. Additionally, I would be grateful for a 'Kudos' if you found my response helpful.
User | Count |
---|---|
33 | |
13 | |
9 | |
9 | |
5 |