Install

Stable builds

Install the latest version of TensorFlow Probability:

pip install --upgrade tensorflow-probability

TensorFlow Probability depends on a recent stable release of TensorFlow (pip package tensorflow). See the TFP release notes for details about dependencies between TensorFlow and TensorFlow Probability.

To force a Python 3-specific install, replace pip with pip3 in the above commands. For additional installation help, guidance installing prerequisites, and (optionally) setting up virtual environments, see the TensorFlow installation guide.

Nightly builds

There are also nightly builds of TensorFlow Probability under the pip package tfp-nightly, which depend on one of tf-nightly and tf-nightly-gpu. Nightly builds include newer features, but may be less stable than the versioned releases.

Install from source

You can also install from source. This requires the Bazel build system. It is highly recommended that you install the nightly build of TensorFlow (tf-nightly) before trying to build TensorFlow Probability from source.

  sudo apt-get install bazel git python-pip
  python -m pip install --upgrade --user tf-nightly
  git clone https://github.com/tensorflow/probability.git
  cd probability
  bazel build --copt=-O3 --copt=-march=native :pip_pkg
  PKGDIR=$(mktemp -d)
  ./bazel-bin/pip_pkg $PKGDIR
  python -m pip install --upgrade --user $PKGDIR/*.whl