Skip to content

Installation Guide (MacOS)

Thomas Wiecki edited this page Oct 12, 2021 · 44 revisions

PyMC3 installation on MacOS

We recommend using Anaconda (or Miniforge) to install Python3 on MacOS, which allows for packages to be installed using its conda utility. If you are running on the new M1 chip

conda create -c conda-forge -n pymc3_env python=3.9 pymc3
conda activate pymc3_env

If you like, replace the name pymc3_env with whatever environment name you prefer. Note that this is a hybrid installation, using both conda and pip; as of this writing, there are no ARM64 builds of PyMC3 on Conda-Forge, so pip must be used with M1 Macs.

For older (Non-M1) Macs, you can install the latest release of PyMC3 on Anaconda from Conda-Forge as follows:

conda create -c conda-forge -n pymc3_env python=3.9 pymc3 theano-pymc mkl mkl-service
conda activate pymc3_env

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. Note that using Anaconda instead of Miniforge should work with M1 Macs as well but will run PyMC3 (and Python) using Rosetta2, rather than natively on Apple silicon.

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

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

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:

git clone https://github.com/pymc-devs/pymc3
cd pymc3
python setup.py install (or python setup.py develop)

Theano-PyMC Installation

PyMC3 is tested on Python 3.6, 3.7, and 3.8 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.

  • If you have Theano installed, please remove it and install Theano-PyMC via Conda Forge:
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
  • If you have cloned PyMC3's repository onto your computer, you can install Theano-PyMC using the requirements.txt:
pip install -r requirements.txt

Arviz Installation

Plots and diagnostics are entirely done by ArviZ - if you follow the installation instructions above, then it will be installed alongside PyMC3.