pgmpy requires Python >=3.8, <=3.11. pgmpy is hosted on both pypi and anaconda. For installation through pypi, use the command:

pip install pgmpy

For installation through anaconda, use the command:

conda install -c ankurankan pgmpy

For installing the latest dev branch from github, use the command:

pip install git+


If installing manually, the following non-optional dependencies needs to be installed:

  • numpy

  • scipy

  • scikit-learn

  • pandas

  • pyparsing

  • pytorch

  • statsmodels

  • tqdm

  • joblib