Installation

Getting the dependencies

Installing from source requires you to have installed

  • Python3
  • networkx (==1.8.1)
  • numpy (==1.9.1)
  • scipy (==0.14.0)
  • cython (==0.21)
  • pandas (==0.15.1)
  • setuptools
  • working C and C++ compiler

You can install all these requirements by issuing

$ [sudo] apt-get install build-essential python3-dev python3-pip
$ [sudo] pip3 install -r requirements.txt       # use requirements-dev.txt if you want to run tests

On Red Hat and clones (e.g CentOS), install the dependencies using:

$ [sudo] yum -y install gcc gcc-c++ python3-devel python3-pip
$ [sudo] pip3 install -r requirements.txt       # use requirements-dev.txt if you want to run tests

Or use some cross-platform binary package manager such as conda (it is recommended as well as the most easiest and hastle-free way)

Setup a virtual environment in conda by

$ conda create -n pgmpy-env python=3.4
$ source activate pgmpy-env

Once you have the virtual environment setup, install the depenedencies using:

$ conda install -f requirements.txt     # use requirements-dev.txt if you want to run tests

Note

In order to build the documentation you will need sphinx and to run the tests you will need nose

$ [sudo] pip3 install sphinx nose

Installing from source

You can install from source by downloading a source archive file (zip) or by checking out the source files from git source repository.

  1. Download the source (zip file) from https://github.com/pgmpy/pgmpy or clone the pgmpy repository:

    $ git clone https://github.com/pgmpy/pgmpy
    $ git checkout dev
    
  2. Unpack (if necessary) and change directory to the source directory.

  3. Run:

    $ [sudo] python3 setup.py install
    

Testing

Testing requires having the nose library. After installation, the package can be tested by executing from the source directory:

$ nosetests3

This would give you a lot of output (and some warnings) but eventually should finish without errors. Otherwise, please consider posting an issue into the bug tracker or the Mailing List pgmpy@googlegroups.com .