Registry / ai-ml / labelbox

labelbox

JSON →
library7.7.0pypiunverified

The Labelbox Python SDK provides a client for interacting with the Labelbox API, allowing users to programmatically manage datasets, projects, annotations, models, and workflows. It's designed for data scientists and MLOps engineers to integrate Labelbox into their machine learning pipelines. The library is actively developed, with frequent updates adding new features and improvements.

pip install labelbox
INSTALL
IMPORT
SIG · LABELBOX
L
labelbox
ai-mlenv7.7.0
Install
6.7s avg
Import
1669ms
Disk
64MB
Pass rate
10/ 10
Env Coverage10 / 10
glibc
3.93.13
musl
3.93.13
Install & Compatibility
Where this runs
tested against v7.7.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.920 runs
installs and imports cleanly · install 0.0s · import 1.867s · 64MB
glibc
py 3.103.920 runs
installs and imports cleanly · install 6.7s · import 1.471s · 65MB
64MB installed
● package 64MB
Code
Verified usage

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

Client
from labelbox import Client
from lbox_clients import Client
The primary SDK is 'labelbox', not the internal/legacy 'lbox-clients'.
DataRow
from labelbox.data.annotation_types import DataRow
Project
from labelbox import Project

Initializes the Labelbox client using an API key from an environment variable and lists available projects. This demonstrates basic connectivity and resource retrieval.

import labelbox import os # Ensure LB_API_KEY is set as an environment variable API_KEY = os.environ.get("LB_API_KEY", "") if not API_KEY: raise ValueError("LB_API_KEY environment variable not set.") client = labelbox.Client(api_key=API_KEY) print("Successfully connected to Labelbox API.") # Example: List all projects projects = client.get_projects() if projects: print(f"Found {len(projects)} projects:") for project in projects: print(f" - Project ID: {project.uid}, Name: {project.name}") else: print("No projects found in your Labelbox workspace.")
Debug
Known issues
breakingVersion 7.0.0 introduced significant changes, including new workflow management, model app ID integration, and project ontology changes. Code written for older versions (pre-6.x) may require substantial refactoring.
fix
Refer to the official upgrade guide for version 7.0.0. Pay close attention to changes in `Project`, `Model`, and `Workflow` related classes and methods.
affects: 7.0.0+
gotchaAPI keys should always be handled securely, preferably via environment variables. Hardcoding API keys is a security risk and is not recommended.
fix
Set the `LB_API_KEY` environment variable (e.g., `export LB_API_KEY='YOUR_API_KEY'`) before running your script, and retrieve it using `os.environ.get('LB_API_KEY')`.
affects: All
gotchaMany SDK methods that return lists of objects (e.g., `client.get_data_rows()`, `project.export_labels()`) are paginated. If you don't iterate properly, you might only get the first page of results.
fix
Always iterate over the returned generator object or explicitly handle pagination parameters (e.g., `skip`, `first`) if available, to ensure all results are processed. For example, `for data_row in client.get_data_rows(): ...` will correctly fetch all pages.
affects: All
deprecatedThe `labelbox.schema` module has undergone refactoring. While older imports might still work for some time, new code should use imports directly from the `labelbox` top-level module or specific sub-modules.
fix
Update imports like `from labelbox.schema.model import Model` to `from labelbox import Model` or refer to the latest documentation for correct paths.
affects: 6.x - 7.x
Errors
Common errors & fixes
ValueError: LB_API_KEY environment variable not set.
The Labelbox API key (LB_API_KEY) was not found in the environment variables.
fix
Set the environment variable: `export LB_API_KEY='YOUR_API_KEY'` (Linux/macOS) or `$env:LB_API_KEY='YOUR_API_KEY'` (PowerShell) before running your script, or pass the key directly to `Client(api_key='YOUR_API_KEY')`.
AttributeError: 'Client' object has no attribute 'get_labelbox_objects'
Attempting to use an old or non-existent method. Method names and object structures evolve between major versions.
fix
Consult the latest SDK documentation or `labelbox` GitHub repository for the correct method name and usage. For example, `get_labelbox_objects` was likely replaced by more specific `get_projects()`, `get_datasets()`, etc.
TypeError: __init__() got an unexpected keyword argument 'api_key_file'
Older SDK versions sometimes supported loading API keys from a file. This method has likely been removed or changed.
fix
Pass the API key directly as a string to the `api_key` argument, or use the `LB_API_KEY` environment variable. `Client(api_key=your_api_key_string)`.
Upgrade
Version history
7.7.0latest on PyPI · released Apr 29, 2026
Audit
Dependencies
requestsrequiredHTTP client for API communication
gqlrequiredGraphQL client for API communication
tqdmoptionalProgress bars for lengthy operations
filelockrequiredFile locking utilities
ndjsonrequiredHandling NDJSON format
DeprecatedrequiredManaging deprecated features and warnings
Agent activity
15 hits · last 30 days
node
14
OpenAI (training)
1
Resources
labelbox — pip install labelbox · libregistry