No module named 'pm4py.objects.petri' in pm4py

Question:

I am using thePython open source pm4py, and following the blog: Process Mining with Python tutorial: A healthcare application — Part 2. When I ran

from pm4py.objects.conversion.log import converter as log_converter
from pm4py.algo.discovery.alpha import algorithm as alpha_miner
log = log_converter.apply(eventlog)
net, initial_marking, final_marking = alpha_miner.apply(log)

no problem at all.

But when I import the following visualization module

from pm4py.visualization.petrinet import visualizer as pn_visualizer

or try other module:

from pm4py.objects.petri import performance_map

it showed

ModuleNotFoundError: No module named 'pm4py.visualization.petrinet'
ModuleNotFoundError: No module named 'pm4py.objects.petri'

I checked the documentation and the classes do exist in the library, so they are not deprecated.

I googled but failed to find anyone to mention the bug. I also tried different python version 3.8, 3.9 and, even

pip install "pm4py==<early version>" 

still doesn’t work. Did anyone else have same issue? Thanks

Asked By: TripleH

||

Answers:

I hunted through the github for the name of these packages. Looks like the tutorial has them wrong or is using an older version perhaps?

They should be:

from pm4py.objects.conversion.log import converter as log_converter
from pm4py.algo.discovery.alpha import algorithm as alpha_miner
from pm4py.visualization.petri_net import visualizer as pn_visualizer
from pm4py.visualization.petri_net.util import performance_map 
Answered By: BrendanOtherwhyz
Categories: questions Tags: ,
Answers are sorted by their score. The answer accepted by the question owner as the best is marked with
at the top-right corner.