Install & Compatibility
Where this runs
tested against v0.23.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
muslpy 3.10–3.95 runs
installs and imports cleanly · install 0.0s · import 0.402s · 27MB
glibcpy 3.10–3.95 runs
installs and imports cleanly · install 2.9s · import 0.372s · 30MB
27MB installed
● package 27MB
Code
Verified usage
Verified import paths — ran on the pinned version, not inferred.
post_live_metrics
✓ from dvc_studio_client import post_live_metrics
get_access_token
✓ from dvc_studio_client import get_access_token
This quickstart demonstrates how to use `dvc-studio-client` to post live experiment metrics to Iterative Studio. It simulates an experiment run, capturing metrics and parameters, and then uses the `post_live_metrics` function to send this data. Ensure you have a DVC_STUDIO_TOKEN environment variable set or replace the placeholder.
import os
from dvc_studio_client import post_live_metrics, get_access_token
# A real token would be obtained from Iterative Studio or DVC CLI configuration
studio_token = os.environ.get("DVC_STUDIO_TOKEN", "your_studio_token_here")
if studio_token == "your_studio_token_here":
print("WARNING: DVC_STUDIO_TOKEN not set. Using placeholder.")
# Mock metrics and parameters for an experiment
metrics_data = {
"exp_name": "my-first-studio-experiment",
"metrics": {"train/accuracy": 0.88, "val/loss": 0.12},
"params": {"learning_rate": 0.005, "batch_size": 64, "epochs": 10},
"step": 50,
"dvc_env": {"dvc_version": "3.0.0"}
}
try:
# Post metrics to Iterative Studio
# Replace 'https://github.com/iterative/example-repo.git' with your actual repository URL
# Replace 'abcdef0123...' with a real Git commit SHA (e.g., from your baseline experiment)
response = post_live_metrics(
token=studio_token,
repo_url="https://github.com/iterative/example-repo.git",
baseline_sha="abcdef0123456789abcdef0123456789abcdef01",
**metrics_data
)
print(f"Successfully posted metrics. Response: {response.get('url', 'N/A')}")
except Exception as e:
print(f"Failed to post metrics: {e}")
# The get_access_token function is typically used in more interactive/programmatic authentication flows.
# For quickstart, we acknowledge its presence. Actual usage might open a browser.
# print(f"get_access_token function is available: {get_access_token}")
Errors
Common errors & fixes
Errors occurring with dvc-studio-client when using Python 3.8 or older (e.g., SyntaxError for newer Python features, or general unexpected behavior).
dvc-studio-client dropped support for Python 3.8 in version 0.21.0 and later, making it incompatible with older Python environments.
fixUpgrade your Python environment to 3.9 or newer.
requests.exceptions.ConnectionError: ('Connection aborted.', RemoteDisconnected('Remote end closed connection without response',)) or requests.exceptions.SSLError: HTTPSConnectionPool(...) when connecting to Iterative Studio.
The default Studio URL was updated in dvc-studio-client versions 0.21.0 and 0.22.0, causing older client versions to attempt connection to an outdated or incorrect domain.
fixUpgrade `dvc-studio-client` to the latest version to ensure it uses the correct Studio endpoint: `pip install --upgrade dvc-studio-client`.
AttributeError: module 'dvc_studio_client' has no attribute 'initiate_authentication' or similar errors related to 'Authorization' vs 'Authentication'.
Authentication functions were renamed (e.g., `initiate_authentication` to `get_access_token`) and refactored from 'Authorization' to 'Authentication' in dvc-studio-client versions 0.17.0 and 0.17.1.
fixUpdate calls from `initiate_authentication` to `get_access_token` and adapt any custom authentication logic to the new `Authentication` terminology and structure.
ModuleNotFoundError: No module named 'dvc_studio_client'
The `dvc-studio-client` library is not installed in the current Python environment or the environment is not activated correctly.
fixInstall the library using pip: `pip install dvc-studio-client`.
Output of `dvc studio login` shows a link to `https://studio.iterative.ai/auth/device-login?code=...` even after `dvc config studio.url <custom_url>` was set.
The `dvc studio login` command might ignore the `studio.url` configuration and default to `studio.iterative.ai`.
fixManually navigate to your custom Studio URL with the provided device code, or ensure the `DVC_STUDIO_URL` environment variable is set to your custom Studio instance URL before running the command.
Upgrade
Version history
0.23.0latest on PyPI · released Jun 1, 2026
Audit
Dependencies
dulwichrequiredUsed for Git repository operations.
requestsrequiredHandles HTTP requests to the Studio API.
voluptuousrequiredUsed for data validation.