{"id":7787,"library":"tfp-nightly","title":"TensorFlow Probability Nightly","description":"TensorFlow Probability (TFP) is a library for probabilistic modeling and statistical inference built on TensorFlow. This `tfp-nightly` package provides the latest pre-release versions of TFP, offering cutting-edge features and bug fixes. It is typically updated daily and is rigorously tested against nightly builds of TensorFlow and JAX. The current version is 0.26.0.dev20260415.","status":"active","version":"0.26.0.dev20260415","language":"en","source_language":"en","source_url":"http://github.com/tensorflow/probability","tags":["tensorflow","probability","machine learning","deep learning","bayesian","statistical inference","nightly"],"install":[{"cmd":"pip install tfp-nightly","lang":"bash","label":"Install latest nightly build"}],"dependencies":[{"reason":"tfp-nightly is built against and requires a compatible version of TensorFlow's nightly build for optimal compatibility and performance.","package":"tensorflow-nightly","optional":false},{"reason":"With TensorFlow 2.16+, `tf.keras` refers to Keras 3. TFP currently relies on Keras 2, which is now packaged as `tf-keras` (or `tf-keras-nightly`). This dependency is crucial for using TFP with recent TensorFlow versions.","package":"tf-keras","optional":false},{"reason":"TFP supports JAX as an alternative backend for numerical computation and is tested against specific JAX versions.","package":"jax","optional":true}],"imports":[{"symbol":"tfp","correct":"import tensorflow_probability as tfp"},{"symbol":"tfd","correct":"import tensorflow_probability.distributions as tfd"},{"symbol":"tfb","correct":"import tensorflow_probability.bijectors as tfb"},{"symbol":"tf","correct":"import tensorflow as tf"}],"quickstart":{"code":"import tensorflow as tf\nimport tensorflow_probability as tfp\ntfd = tfp.distributions\ntfb = tfp.bijectors\n\n# Create a Normal distribution\nmean = tf.constant(0.0, dtype=tf.float32)\nstddev = tf.constant(1.0, dtype=tf.float32)\nnormal_dist = tfd.Normal(loc=mean, scale=stddev)\n\n# Sample from the distribution\nsamples = normal_dist.sample(10)\nprint(\"Samples from Normal distribution:\", samples)\n\n# Calculate log probability\nlog_prob = normal_dist.log_prob(0.5)\nprint(\"Log probability of 0.5:\", log_prob)\n\n# Demonstrate a bijector (e.g., Exp) to create a LogNormal distribution\nexp_bijector = tfb.Exp()\nlog_normal_dist = exp_bijector(normal_dist)\n\n# Sample from the transformed distribution\nlog_normal_samples = log_normal_dist.sample(5)\nprint(\"Samples from LogNormal distribution (via Exp bijector):\", log_normal_samples)","lang":"python","description":"This quickstart demonstrates how to create a basic Normal distribution, sample from it, calculate log probabilities, and apply a bijector to transform it into a LogNormal distribution. It showcases the core `distributions` and `bijectors` modules of TensorFlow Probability."},"warnings":[{"fix":"You must explicitly install `tf-keras` (or `tf-keras-nightly`) and ensure your `tfp-nightly` setup utilizes it instead of `tf.keras`. Some examples might involve `import tf_keras as keras` and configuring TFP to use this module.","message":"TensorFlow Probability currently relies on Keras 2 for its Keras backend integration. With TensorFlow 2.16+ (including `tensorflow-nightly`), `tf.keras` now points to Keras 3. This leads to incompatibility issues.","severity":"breaking","affected_versions":"0.24.0 and later (and corresponding `tfp-nightly` builds)"},{"fix":"Upgrade your Python environment to version 3.9 or higher (e.g., 3.9, 3.10, 3.11).","message":"Support for Python 3.8 has been officially removed from TensorFlow Probability.","severity":"breaking","affected_versions":"0.22.0 and later (and corresponding `tfp-nightly` builds)"},{"fix":"Always install `tensorflow-nightly` alongside `tfp-nightly` to maintain compatibility, e.g., `pip install --upgrade tensorflow-nightly tfp-nightly`. Consult TFP release notes for recommended JAX versions.","message":"`tfp-nightly` is built and tested against `tensorflow-nightly` and specific JAX versions. Using `tfp-nightly` with stable TensorFlow releases or significantly older/newer `jax` versions can lead to runtime errors or unexpected behavior due to API mismatches.","severity":"gotcha","affected_versions":"All `tfp-nightly` versions"},{"fix":"Be prepared for frequent updates and potential API churn. Review GitHub pull requests, issues, and release notes for changes. Use `tfp-nightly` primarily for testing new features or contributing, and `tensorflow-probability` for production workloads.","message":"As a nightly build, `tfp-nightly` may introduce API changes, experimental features, or deprecations without strict backward compatibility guarantees. Code written for stable `tensorflow-probability` might break with `tfp-nightly`.","severity":"gotcha","affected_versions":"All `tfp-nightly` versions"}],"env_vars":null,"last_verified":"2026-04-16T00:00:00.000Z","next_check":"2026-07-15T00:00:00.000Z","problems":[{"fix":"Install `tf-keras` (or `tf-keras-nightly`) using `pip install tf-keras`. You may also need to explicitly configure TFP to use this Keras version if issues persist.","cause":"TensorFlow 2.16+ uses Keras 3, but TFP expects Keras 2. The Keras 2 backend module cannot be found at the expected path.","error":"ModuleNotFoundError: No module named 'tensorflow_probability.python.internal.backend.keras'"},{"fix":"Upgrade your Python environment to 3.9, 3.10, or 3.11.","cause":"Attempting to install or run `tfp-nightly` on an unsupported Python 3.8 environment.","error":"ValueError: Python 3.8 is no longer supported by TensorFlow Probability."},{"fix":"Ensure both `tensorflow-nightly` and `tfp-nightly` are updated to their very latest versions: `pip install --upgrade tensorflow-nightly tfp-nightly`.","cause":"This error typically indicates an incompatibility between the installed `tfp-nightly` and `tensorflow-nightly` versions, where one expects an API that the other no longer provides or has changed.","error":"AttributeError: module 'tensorflow.python.framework.ops' has no attribute 'uid'"},{"fix":"Check the latest `tfp-nightly` release notes or GitHub issues. Ensure all input tensors have explicit shapes and correct dtypes. For instance, ensure single-element tensors are not implicitly cast to Python integers when iterating is expected.","cause":"This can occur due to subtle API changes in nightly builds, especially concerning how shapes, dtypes, or specific arguments are handled in distributions or bijectors. It might also relate to NumPy deprecation warnings and changes in array casting.","error":"TypeError: 'int' object is not iterable"}]}