## Prerequisites and system recommendations

Python 3.11 or 3.12 is required to use Meridian.

We also recommend using a minimum of 1 GPU.

> [!NOTE]
> **Note:** This project has been tested on V100 and T4 GPU using 16 GB of RAM.

## Install

To install Meridian, run the following command to automatically install the most
recent published version from PyPI.

### Linux (GPU)

> [!NOTE]
> **Note:** A CUDA toolchain and a compatible GPU device are necessary for the `[and-cuda]` extra to activate. For a CPU-only environment, see: "CPU".

    python3 -m pip install --upgrade 'google-meridian[and-cuda]'
    # Verify the installation:
    python3 -c "import meridian; print(meridian.__version__)"

### macOS

> [!NOTE]
> **Note:** There is no official GPU support for macOS.

    python3 -m pip install --upgrade 'google-meridian'
    # Verify the installation:
    python3 -c "import meridian; print(meridian.__version__)"

### CPU

    python3 -m pip install --upgrade 'google-meridian'
    # Verify the installation:
    python3 -c "import meridian; print(meridian.__version__)"

### Latest

    python3 -m pip install --upgrade git+https://github.com/google/meridian.git
    # Verify the installation:
    python3 -c "import meridian; print(meridian.__version__)"

## How to use the Meridian library

You can run the Meridian code programmatically using sample data with the
[Getting started colab](https://developers.google.com/meridian/notebook/meridian-getting-started).

The Meridian model uses a holistic MCMC sampling approach called [No U Turn
Sampler
(NUTS)](https://www.tensorflow.org/probability/api_docs/python/tfp/experimental/mcmc/NoUTurnSampler)
which can be compute intensive. To help with this, GPU support has been
developed across the library (out-of-the-box) using tensors. We recommend
running your Meridian model on GPUs to get real time optimization results and
significantly reduce training time.

> [!NOTE]
> **Note:** Meridian uses the JAX backend by default. The legacy TensorFlow backend is deprecated and will be removed in a future release. To learn more about backend configuration and precision options, see [Use the JAX backend](https://developers.google.com/meridian/docs/advanced-modeling/using-jax).