Practical overview
When it fits
Use PM4Py when you want to work with process-mining algorithms in a Python project, including the documented workflow of deriving and displaying a Petri net from an XES log.
Who it is for
- Researchers studying process-mining methods with Python.
- Industry teams analyzing business-process event data.
- Python developers prototyping process-analysis or process-improvement studies.
Documented uses
- Read an XES event log and discover a Petri net with the inductive method.
- Explore business-process behavior through process-mining algorithms.
- Prototype process-improvement studies using Python.
Requirements & limits
The public open-source version is licensed under AGPL-3.0. A separate license is offered for commercial use in closed-source environments.
- The standard installation is listed for Python 3.9 through 3.14.
- Optional integrations are organized as extras, including
ml,polars,visualizationandsolvers. - The documented introductory example uses XES input and produces a displayed Petri net.
- Commercial use in a closed-source environment requires reviewing the separate licensing option.
Check current requirements in the official documentation. Source-based guidance does not mean OpenViST has run or independently tested this project.
Install PM4Py and try the documented XES example
Set up the Python library and use its README example to discover and display a Petri net from an XES event log.
Before you start
- Python 3.9 through 3.14 for the listed standard installation.
- An XES event-log file available at a local path.
Steps
Install the package with the command below.
pip install -U pm4pyIn a Python script, import
pm4pyand read the event log withpm4py.read_xes('').Pass the log to
pm4py.discover_petri_net_inductive(log)to obtain the net and its initial and final markings.Display the result with
pm4py.view_petri_net(net, initial_marking, final_marking, format="svg").
Expected outcome
The example discovers a Petri net from the log and displays it in SVG format.
Guide limitations
- The example requires an XES log file; other input formats are not covered by this recipe.
- Optional feature groups are installed separately when needed.
Sources & review
Source record details
- Source availability
- Active
- Sources checked
- 13 October 2026
- Original website title
- process-intelligence-solutions/pm4py · Official homepage title · retained in its source language

