Installation#
pgmpy supports Python 3.10 through 3.14. For most users, the base PyPI install is enough:
pip install pgmpy
PyPI#
Install the latest published release from PyPI:
pip install pgmpy
If you also want optional dependency groups, install pgmpy with extras. Quotes
around the requirement are recommended and may be required in shells such as
zsh.
Extra |
Command |
Includes |
|---|---|---|
|
|
PyTorch and Pyro support for the torch backend and functional/hybrid workflows. |
|
|
Everything in |
|
|
The test and development toolchain, including |
|
|
The documentation toolchain, including Sphinx, MyST, nbsphinx, sphinx-design, and the pydata-sphinx theme. |
|
|
The combined optional, testing, and documentation dependencies. |
Conda#
Install the base package from conda-forge:
conda install -c conda-forge pgmpy
If you need the optional dependency groups listed above, install them with
pip inside the same environment after creating it.
Development Version#
To install the latest dev branch directly from GitHub:
pip install git+https://github.com/pgmpy/pgmpy.git@dev
Editable Install From Source#
If you are contributing to pgmpy or working on the documentation locally, clone the repository and install it in editable mode:
git clone https://github.com/pgmpy/pgmpy.git
cd pgmpy
For a local development install with the test dependencies:
pip install -e .[tests] # bash
pip install -e ".[tests]" # zsh
The same pattern works for the other extras:
pip install -e ".[docs]"
pip install -e ".[torch]"
pip install -e ".[optional]"
pip install -e ".[all]"