cancel
Showing results for 
Search instead for 
Did you mean: 
Machine Learning
cancel
Showing results for 
Search instead for 
Did you mean: 

Displaying graphviz images in a notebook

Rob_S
New Contributor III

Hi,

I'm experimenting with process mining in a Databricks notebook using the OSS library PM4PY. I've been working through some tutorials and the notebook they provide on Github:

https://github.com/pm4py/pm4py-core/blob/release/notebooks/3_process_discovery.ipynb

I've installed all dependencies (I think) and the below code runs in a cell with no errors but I don't see the actual image:

import pandas as pd
import pm4py
import graphviz
df = pm4py.format_dataframe(pd.read_csv('/dbfs/FileStore/shared_uploads/[username]/testfile-1.csv', sep=';'), case_id='case_id',activity_key='activity',
                             timestamp_key='timestamp')
bpmn_model = pm4py.discover_bpmn_inductive(df)
pm4py.view_bpmn(bpmn_model)

It uses graphviz for display, I'm presuming that its output might not be supported in DBX notebooks. I've seen some similar(ish) problems but not found a solution. Any thoughts/help?

7 REPLIES 7

Prabakar
Esteemed Contributor III
Esteemed Contributor III

If you have installed graphviz then it should work.

https://kb.databricks.com/libraries/install-pygraphviz.html

Rob_S
New Contributor III

Thanks @Prabakar Ammeappin​ I actually had followed that article and have this in my first cell in the notebook:

%sh

#sudo apt-get install -y python3-dev graphviz libgraphviz-dev pkg-config

and then this in the next cell:

%pip install pm4py

%pip install pygraphviz

So I think it's installed but no luck 😞

jose_gonzalez
Moderator
Moderator

Hi @Robert Stanton​,

Like Prabakar mentioned, you will need to install the library first to be able to use it. In Addition to @Prabakar Ammeappin​ response, please check the following docs https://docs.databricks.com/libraries/index.html

Rob_S
New Contributor III

Thanks @Jose Gonzalez​ 

I read that doc and couldn't see any specific advice (but a little new to this). Any thoughts if I have installed everything? It all seems to work (no errors) just nothing displays

Kaniz
Community Manager
Community Manager

Hi @Robert Stanton​ , We haven’t heard from you on the last response from @Prabakar​ and @Jose Gonzalez​, and I was checking back to see if their suggestions helped you. Or else, If you have any solution, please do share that with the community as it can be helpful to others.

Also, Please don't forget to click on the "Select As Best" button whenever the information provided helps resolve your question.

Rob_S
New Contributor III

Thanks @Kaniz Fatma​ - replied above, help appreciated

rushank29
New Contributor II

@Rob_S i am also in the same situation the code cell executes but no visualization how did you tackle this problem?

Welcome to Databricks Community: Lets learn, network and celebrate together

Join our fast-growing data practitioner and expert community of 80K+ members, ready to discover, help and collaborate together while making meaningful connections. 

Click here to register and join today! 

Engage in exciting technical discussions, join a group with your peers and meet our Featured Members.