Registry / ai-ml / wandb
library0.29.0pypypi✓ verified 25d ago

Weights & Biases (wandb) is a MLOps platform for experiment tracking, model optimization, and collaboration, widely used by machine learning practitioners. It provides a CLI and Python library to log metrics, visualize results, and manage models from experimentation to production. The library is actively maintained with frequent releases, typically on a monthly or bi-monthly cadence, and is currently at version 0.25.1.

pip install wandb
INSTALL
IMPORT
SIG · WANDB
W
wandb
ai-mlpythonv0.29.0
Install
7.3s avg
Import
4213ms
Disk
136MB
Pass rate
10/ 10
Env Coverage10 / 10
glibc
3.93.13
musl
3.93.13
Install & Compatibility
Where this runs
tested against v0.29.0 · pip install
no network on importno background threads
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
musl
py 3.103.95 runs
installs and imports cleanly · install 0.0s · import 4.842s · 136.2MB
glibc
py 3.103.95 runs
installs and imports cleanly · install 7.3s · import 3.584s · 137MB
136MB installed
● package 136MB
Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

wandb
import wandb
wandb.init
import wandb wandb.init(...)
wandb.login
import wandb wandb.login()

This quickstart demonstrates how to initialize a Weights & Biases run, log hyperparameters using `wandb.config`, and track metrics like loss and accuracy using `run.log()` within a simulated training loop. Before running, ensure you have authenticated with `wandb.login()` or set the `WANDB_API_KEY` environment variable.

import wandb import os # Authenticate with W&B. For automated environments, use an environment variable. # wandb.login() will prompt for an API key if not set. # Set WANDB_API_KEY environment variable for CI/CD or headless environments. # For local development, running `wandb login` in your terminal is common. # os.environ.get('WANDB_API_KEY', '') # Example for fetching from env, but wandb.login() handles this. wandb.login() # Initialize a new W&B run project_name = os.environ.get('WANDB_PROJECT', 'my-awesome-project') config = { 'epochs': 10, 'lr': 0.01, 'batch_size': 32 } with wandb.init(project=project_name, config=config) as run: # Access hyperparameters epochs = run.config.epochs learning_rate = run.config.lr print(f"Starting training for {epochs} epochs with LR: {learning_rate}") # Simulate a training loop for epoch in range(epochs): # Simulate loss and accuracy metrics loss = 1.0 / (epoch + 1) + 0.1 * (epochs - epoch - 1) / epochs accuracy = 0.5 + 0.5 * (epoch + 1) / epochs # Log metrics to W&B run.log({"epoch": epoch, "loss": loss, "accuracy": accuracy}) print(f"Epoch {epoch+1}/{epochs}: Loss = {loss:.4f}, Accuracy = {accuracy:.4f}") print("Training complete!")
wandb --version
Debug
Known issues
breakingPython 3.8 is no longer supported starting from `wandb` version 0.25.0.
fix
Upgrade your Python environment to 3.9 or higher.
affects: >=0.25.0
breakingThe legacy `wandb.beta.workflows` module (including `log_model()`, `use_model()`, `link_model()`) was removed in version 0.24.0. These functions are no longer available and will cause `AttributeError`.
fix
Migrate to the modern artifact API using `Run.log_artifact()`, `Run.use_artifact()`, and `Run.link_artifact()` methods.
affects: >=0.24.0
breakingVersion `0.24.0` was yanked from PyPI due to a critical bug that could cause silent failure to upload some run data. If used, data might be missing from your W&B dashboard.
fix
Immediately upgrade to `wandb` version `0.24.1` or higher. Missing data from `0.24.0` runs can often be recovered by running `wandb sync` on the `.wandb` files.
affects: 0.24.0
deprecatedSeveral `wandb.Run` methods are deprecated in favor of direct properties, including `run.project_name()`, `run.get_url()`, `run.get_project_url()`, and `run.get_sweep_url()`.
fix
Use the direct properties instead: `run.project`, `run.url`, `run.project_url`, and `run.sweep_url` respectively.
affects: Likely from ~0.22.x onwards, to be removed in future versions (already deprecated since #8925).
gotchaThe `wandb: ERROR Run aborted` or `wandb: ERROR Failed to log data` messages indicate an unexpected termination or data logging failure. This can be caused by script errors, system resource constraints, or network connectivity issues.
fix
Check script for exceptions, monitor system resources (CPU/RAM), verify stable network connection, and ensure data logged to `wandb.log()` is in the correct dictionary format.
affects: All versions
gotchaProgrammatic dataset splitting (e.g., using `sklearn.model_selection.train_test_split` without fixing `random_state` or without managing splits as artifacts) can lead to inconsistent train/test sets when new data is added, invalidating comparisons between experiments.
fix
Ensure reproducibility of splits (e.g., set `random_state` or explicitly manage dataset versions as W&B Artifacts) to maintain consistent evaluation benchmarks across experiments.
affects: All versions
gotchaThe `wandb.errors.errors.UsageError: No API key configured` indicates that the W&B API key has not been set up, preventing authentication. This is a common first-time setup error when calling `wandb.login()` or any method that requires authentication.
fix
Ensure you have logged in using `wandb login` in your terminal or script, or by setting the `WANDB_API_KEY` environment variable with your API key (available from your W&B settings page).
affects: All versions
gotchaThe `wandb.login()` function raises `wandb.errors.errors.UsageError: No API key configured` if it cannot find an API key, preventing any W&B operations.
fix
Ensure you have logged in via the command line (`wandb login`), set the `WANDB_API_KEY` environment variable, or passed the API key directly to `wandb.login(key='YOUR_API_KEY')`.
affects: All versions
Errors
Common errors & fixes
ModuleNotFoundError: No module named 'wandb'
The `wandb` library is not installed in the current Python environment.
fix
pip install wandb
wandb: ERROR W&B API key is not set. Please set the WANDB_API_KEY environment variable or run `wandb login`
The Weights & Biases API key is not configured, which is required to authenticate and log runs to the W&B server.
fix
Run `wandb login` in your terminal and follow the prompts, or set the WANDB_API_KEY environment variable.
ValueError: This experiment has already been initialized.
`wandb.init()` was called multiple times within the same process without properly finishing the previous run.
fix
Ensure `wandb.init()` is called only once per experiment run, or explicitly call `wandb.finish()` before subsequent `wandb.init()` calls.
TypeError: Object of type int64 is not JSON serializable
Attempting to log a NumPy `int64` type directly with `wandb.log()`, which is not natively JSON serializable.
fix
Convert the `int64` value to a standard Python integer (`int`) before logging, e.g., `int(numpy_int64_value)`.
wandb: WARNING wandb.finish() was called but there is no active run.
`wandb.finish()` was called when no active Weights & Biases run was initialized or if the run had already finished.
fix
Ensure `wandb.finish()` is called only once at the end of an active `wandb.init()` run, or guard it with `if wandb.run: wandb.finish()`.
Upgrade
Version history
0.29.0latest on PyPI · released Aug 26, 2026
Audit
Dependencies
pythonrequiredRequires Python 3.9 or higher. Python 3.8 support was dropped in version 0.25.0.
Agent activity
74 hits · last 30 days
node
64
Perplexity
1
OpenAI (training)
1
Resources
wandb — pip install wandb · libregistry