Skip to content

Installation Guide (Windows)

Chris Fonnesbeck edited this page Jun 2, 2022 · 49 revisions

PyMC Installation on Windows

The following instructions rely on having Anaconda, Mamba or Miniforge installed, which provide Python environments from which you can install and run PyMC in a controlled way, using the conda utility.

Simple Install

The Simple Install process of PyMC under Windows is recommended for most users. It is a two-step process, with conda being used to set up an environment that contains required dependencies, including the GCC compiler toolchain, and then pip to install PyMC itself. Using conda allows Aesara and PyMC to easily access MKL and also confines the install of the GCC compiler toolchain into the conda environment rather than placing it onto the global Windows PATH.

It is usually a good idea to install into a fresh conda environment, which we will call pymc_env:

conda create -n pymc_env -c conda-forge python libpython mkl-service numba m2w64-toolchain

Once the conda environment has been created, there are two options for getting a version of PyMC installed depending on your needs. You probably want Option 1, which installs the latest version of PyMC. But Option 2 is available if you know you need the older PyMC3.

Option 1 - PyMC

Next, PyMC can be installed into the environment we have created:

conda activate pymc_env
pip install pymc --pre

Until v4 is officially released, you will need to add the --pre flag as shown to get the correct version.

You might experience this warning message when running PyMC:

WARNING (aesara.tensor.blas): Using NumPy C-API based implementation for BLAS functions.

If so, create a file called .aesararc, and put it in your home directory (usually C:\Users\<username>). Add these lines to .aesararc:

[blas]
ldflags = -lblas

That will signal Aesara to link against BLAS, and that should eliminate the warning message.

Option 2 - PyMC3

If you are looking for the older PyMC3, then run this to install into the environment we have created:

conda activate pymc_env
pip install pymc3

You might experience this warning message when running PyMC3:

WARNING (theano.tensor.blas): Using NumPy C-API based implementation for BLAS functions.

If so, create a file called .theanorc, and put it in your home directory (usually C:\Users\<username>). Add these lines to .theanorc:

[blas]
ldflags = -lblas

That will signal Theano to link against BLAS, and that should eliminate the warning message.

Fancy Install

The Fancy Install of PyMC is for those who would prefer to manage the GCC compiler installation on their own rather than rely on conda to do it. You can install an up-to-date copy of GCC yourself and make sure it is available on the global Windows PATH. An easy way to do this (though not the only way) is via the Chocolatey package manager:

choco install mingw

Once GCC installation has completed, you can then pickup the creation of a conda environment and the PyMC or PyMC3 install options as described above, replacing the conda environment creation command with this one, which omits the m2w64-toolchain:

conda create -n pymc_env -c conda-forge python libpython mkl-service numba

Then follow Option 1 for PyMC or Option 2 for PyMC3 as described above.

JAX sampling

JAX is not directly supported on Windows systems at the moment.