Skip to content


Repository files navigation

Bayesian Modeling and Computation in Python

Open access and Code

This repository contains the open-access version of the text and the code examples in the book. All of this can be more easily viewed at

Updated code

For the most up-to-date code please check the folder notebooks_updated. This code is updated to work with the latest versions of the libraries used in the book, which means that some of the code will be different from the one in the book.

See a mistake?

If you see any issues please create an issue on the issue tracker

Environment installation

To run the code you will need to install the correct packages in a computational environment. We have provided instructions below for common options.


conda env create -f environment.yml
conda activate bmcp


The book code can also be run using Google Colab.

More instructions to come soon


If you use the online or printed versions of this book in your own work, please cite us using

Martin Osvaldo A, Kumar Ravin; Lao Junpeng Bayesian Modeling and Computation in Python Boca Ratón, 2021. ISBN 978-0-367-89436-8

Here is the citation in BibTeX format

  title = {{Bayesian Modeling and Computation in Python}},
  author = {Martin, Osvaldo A. and Kumar, Ravin and Lao, Junpeng},
  year = {2021},
  month = dec,
  address = {{Boca Raton}},
  isbn = {978-0-367-89436-8},


This book is only possible because of open source contributors working on the projects we used. If you like this book we encourage you to make a donation to ArviZ or PyMC.