Installation Guide How to Install PM4Py

Step-by-step instructions for each system: installing Python and pip, setting up a virtual environment, adding Graphviz for visualizations, and checking that PM4Py works.

Already have Python?

Terminal
pip install pm4py
  • Python 3.11 or newer with pip
  • Graphviz, to visualize process models

Install PM4Py on Windows

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.

  1. Install Python and pip

    You can install Python directly, or use Anaconda or Miniconda for a managed environment.

    Python installer Recommended

    • Download the latest Windows installer (64-bit) from python.org.
    • Run it and check Add python.exe to PATH on the first screen.
    • pip is included.

    Anaconda or Miniconda

    • Anaconda comes with Python and many scientific libraries.
    • Miniconda has only Conda and Python; you install packages as needed.
    • Run the installer, then open the Anaconda Prompt.

    Check that both are available. Each command prints a version number:

    Command Prompt
    python --versionpip --version

    If pip is missing, download get-pip.py and run python get-pip.py.

  2. Create a virtual environment Recommended

    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:

    Command Prompt
    python -m venv pm4py_envpm4py_env\Scripts\activate
    Anaconda Prompt
    conda create -n pm4py_env python=3.11conda activate pm4py_env
  3. Install Graphviz

    PM4Py draws process models, Petri nets and other visualizations with Graphviz.

    • Download the 64-bit EXE installer for Windows from graphviz.org.
    • Run it and choose Add Graphviz to the system PATH for all users (or for the current user).
    Add Graphviz to the PATH manually
    1. Find the Graphviz bin folder, usually C:\Program Files\Graphviz\bin.
    2. Open the Start menu, search for Edit the system environment variables and open it.
    3. Click Environment Variables….
    4. Under System variables, select Path and click Edit.
    5. Click New, paste the bin path and confirm with OK.

    Open a new Command Prompt and check the installation:

    Command Prompt
    dot -V

    It prints dot - graphviz version X.XX.X if Graphviz is set up correctly.

  4. Install PM4Py

    With your environment activated, run:

    Command Prompt
    pip install pm4py

    This also installs the graphviz Python package that connects PM4Py to Graphviz.

  5. Verify the installation

    Import PM4Py and print its version:

    Command Prompt
    python -c "import pm4py; print(pm4py.__version__)"

    If a version number appears without errors, PM4Py is ready to use.

PM4Py Installation Troubleshooting

The most common problems and how to solve them.

pip is not found

On macOS and Linux, 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.

externally-managed-environment error

Your system's Python does not accept packages installed with pip. Create and activate a virtual environment (step 2 of the guide for your system) and install PM4Py there.

Graphviz is not found

Visualizations fail with an error such as 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.

PM4Py cannot be imported

Make sure the environment you installed PM4Py into is activated. If the error persists, reinstall PM4Py:

Terminal
pip install --force-reinstall pm4py