Already have Python installed?
pip install pm4py The commands below run in the Command Prompt (cmd) or in PowerShell. If you use Anaconda or Miniconda, run them in the Anaconda Prompt instead.
You can install Python directly, or use Anaconda or Miniconda for a managed environment.
Check that both are available. Each command prints a version number:
python --versionpip --version If pip is missing, download get-pip.py and run python get-pip.py.
A virtual environment keeps PM4Py and its dependencies apart from other Python projects. Activate it in every new terminal before you work with PM4Py. Navigate to your project folder and run the commands below:
python -m venv pm4py_envpm4py_env\Scripts\activateconda create -n pm4py_env python=3.11conda activate pm4py_envPM4Py draws process models, Petri nets and other visualizations with Graphviz.
bin folder, usually C:\Program Files\Graphviz\bin.bin path and confirm with OK.Open a new Command Prompt and check the installation:
dot -VIt prints dot - graphviz version X.XX.X if Graphviz is set up correctly.
With your environment activated, run:
pip install pm4pyThis also installs the graphviz Python package that connects PM4Py to Graphviz.
Import PM4Py and print its version:
python -c "import pm4py; print(pm4py.__version__)"If a version number appears without errors, PM4Py is ready to use.
The commands below run in the Terminal app. The guide uses Homebrew, the most common package manager for macOS.
If you do not have Homebrew yet, install it with the command shown on brew.sh. Then install Python, which comes with pip:
brew install pythonCheck that both are available. On macOS they are called python3 and pip3:
python3 --versionpip3 --versionPrefer an installer? The macOS installer from python.org works too.
Homebrew's Python does not allow installing packages system-wide (pip reports an externally-managed-environment error), so PM4Py goes into a virtual environment. Activate it in every new terminal before you work with PM4Py. Navigate to your project folder and run the commands below:
python3 -m venv pm4py_envsource pm4py_env/bin/activateInside the activated environment, python and pip work without the 3.
PM4Py draws process models, Petri nets and other visualizations with Graphviz:
brew install graphvizdot -Vdot -V prints the Graphviz version if it is set up correctly.
With your environment activated, run:
pip install pm4pyThis also installs the graphviz Python package that connects PM4Py to Graphviz.
Import PM4Py and print its version:
python -c "import pm4py; print(pm4py.__version__)"If a version number appears without errors, PM4Py is ready to use.
The commands below run in a terminal. They are given for Ubuntu and Debian (apt) and for Fedora (dnf); other distributions have equivalent packages.
Most distributions come with Python 3. Check which version you have:
python3 --versionThen install or update Python, pip and the virtual environment module:
sudo apt updatesudo apt install python3 python3-pip python3-venvsudo dnf install python3 python3-pip Recent distributions do not allow installing packages into the system Python (pip reports an externally-managed-environment error), so PM4Py goes into a virtual environment. Activate it in every new terminal before you work with PM4Py. Navigate to your project folder and run the commands below:
python3 -m venv pm4py_envsource pm4py_env/bin/activateInside the activated environment, python and pip work without the 3.
PM4Py draws process models, Petri nets and other visualizations with Graphviz:
sudo apt install graphvizdot -Vsudo dnf install graphvizdot -Vdot -V prints the Graphviz version if it is set up correctly.
With your environment activated, run:
pip install pm4pyThis also installs the graphviz Python package that connects PM4Py to Graphviz.
Import PM4Py and print its version:
python -c "import pm4py; print(pm4py.__version__)"If a version number appears without errors, PM4Py is ready to use.
pip3 outside a virtual environment. On Windows, run the Python installer again and check Add python.exe to PATH. python -m pip works in either case. ExecutableNotFound when the Graphviz program is not on the PATH. Check that dot -V works in a new terminal; on Windows, add the Graphviz bin folder to the PATH as described in step 3. pip install --force-reinstall pm4pyPM4Py is ready to use. Here’s where to go next.