Install & Compatibility
Where this runs
No compatibility data collected yet for this library.
Code
Verified usage
Verified import paths — ran on the pinned version, not inferred.
SegmentsClient
✓ from segments import SegmentsClient
✗ import segments
Use explicit import to avoid attribute confusion.
SegmentsDataset
✓ from segments import SegmentsDataset
✗ from segments import Dataset
Dataset is not exported; use SegmentsDataset.
Initialize client and list datasets.
from segments import SegmentsClient
import os
client = SegmentsClient(api_key=os.environ.get('SEGMENTS_API_KEY', ''))
# List datasets
datasets = client.get_datasets()
print(datasets)
Debug
Known issues
breakingIn version 1.20.0, Hugging Face integration was dropped. Any code relying on huggingface_hub integration will break.fixRemove any usage of SegmentsClient with Hugging Face Hub; use direct API key authentication instead.
affects: <1.20.0 (removed in >=1.20.0)
deprecatedThe `Client` class was renamed to `SegmentsClient` in v1.0.0. `Client` may be removed in future.fixUse `from segments import SegmentsClient` instead of `from segments import Client`.
affects: >=1.0.0
gotchaRate limiting is enforced. Scripts that make many parallel requests may hit 429 errors.fixImplement exponential backoff or limit concurrency. The SDK raises `RateLimitError` (version >=1.20.0).
affects: all
Errors
Common errors & fixes
ModuleNotFoundError: No module named 'segments'
Package not installed or installed in a different environment.
fixRun `pip install segments-ai` in your current Python environment.
segments.exceptions.AuthenticationError: Invalid API key
Missing or incorrect API key passed to SegmentsClient.
fixPass a valid API key via `SegmentsClient(api_key='your-api-key')` or set the `SEGMENTS_API_KEY` environment variable.
TypeError: __init__() got an unexpected keyword argument 'hub_token'
Hugging Face Hub token argument is no longer supported as of v1.20.0.
fixRemove `hub_token` argument. Use `SegmentsClient(api_key=...)` instead.
Upgrade
Version history
1.25.0latest on PyPI · released Apr 9, 2026
Audit
Dependencies
No dependency data recorded yet.