Skip to content

Installation Guide (Linux)

Ricardo Vieira edited this page Dec 1, 2021 · 32 revisions

PyMC3 Installation for Linux

The latest release of PyMC3 can be installed from Conda Forge (conda-forge):

conda install -c conda-forge pymc3 theano-pymc mkl mkl-service

Note that you must specifically request theano-pymc or you will get an obsolete version of PyMC3 that works with the now-abandoned theano library. We encourage you to test this with the --dry-run flag to ensure you get up-to-date versions.

While strongly discouraged due to installation problems you could try to install PyMC3 and its dependencies via PyPI using pip:

pip install pymc3

The reason installation via PyPI is difficult, especially on Windows and OSX, is that Theano requires compilation against MKL, which is difficult to set up, while Conda comes with its own compilers and MKL installation. .. note:

Running pip install pymc will install PyMC 2.3, not PyMC3, from PyPI.

The current development branch of PyMC3 can be installed from GitHub, also using pip:

pip install git+https://github.com/pymc-devs/pymc@v3

Make sure to install the Theano-PyMC version that is pegged in PyMC3's requirements.txt. For more information, see the Theano-PyMC Installation section, below.

Lastly, another option is to clone the repository and install PyMC3 using python setup.py install or python setup.py develop.

Theano-PyMC Installation

PyMC3 is tested on Python 3.7, 3.8, and 3.9 and depends on NumPy, SciPy, and Pandas (see requirements.txt for version information).

Moreover, as of Late 2020, PyMC3 now requires Theano-PyMC instead of Theano.

That being said, you can install PyMC3 using the requirements.txt file.

This requires cloning the repository to your computer:

git clone https://github.com/pymc-devs/pymc
cd pymc
checkout v3
pip install -r requirements.txt
  • If you have Theano installed, please remove it and install Theano-PyMC via Conda Forge, seen below:

    conda remove theano
    
  • If you have an outdated version of Theano-PyMC, then re-install the module via Conda Forge:

    conda remove theano-pymc -y
    conda install -c conda-forge theano-pymc -y
    

Arviz Installation

Plotting is done using ArviZ - if you follow the installation instructions above, then it will be installed alongside PyMC3.

Optional

In addtion to the above dependencies, the GLM submodule relies on Patsy.

PyMC v4 Installation

Until a release version of PyMC v4 is available, it must be installed directly from the repository itself:

git clone https://github.com/pymc-devs/pymc/
cd pymc
conda env create -f ./conda-envs/environment-test-py39.yml
conda activate pymc-test-py39
pip install .