Label Studio Tools
raw JSON → 0.0.4 verified Fri May 01 auth: no python
Common tools for Label Studio, including data loading, config parsing, and video keyframe extraction. Current version is 0.0.4, requires Python >=3.6, and is maintained by HumanSignal (formerly Heartex). Releases are infrequent.
pip install label-studio-tools Common errors
error ModuleNotFoundError: No module named 'label_studio_tools' ↓
cause Package not installed or installed in a different environment.
fix
Run 'pip install label-studio-tools' and ensure you are using the correct Python interpreter.
error AttributeError: module 'label_studio_tools' has no attribute 'core' ↓
cause Likely installed very old version (0.0.1) where 'core' didn't exist, or import path is wrong.
fix
Upgrade to version 0.0.2+: 'pip install --upgrade label-studio-tools'. Then use correct import paths.
error ValueError: You must set LS_API_KEY environment variable to use get_local_path for storage downloads. ↓
cause Missing LS_API_KEY when using get_local_path with a non-local URL (e.g., cloud storage).
fix
Set the environment variable LS_API_KEY to your Label Studio API key, or use get_local_path only with local file paths.
Warnings
breaking In version 0.0.4, get_local_path now requires LS_API_KEY and a valid task_id to download files from cloud storage. If you omit these, it may fall back to local path or raise an error. Breaking change from earlier versions that did not support cloud storage. ↓
fix Set LS_API_KEY environment variable and pass a valid task_id to get_local_path to use cloud storage. For local files, ensure the path is a local file.
gotcha The package structure changed between 0.0.1 and 0.0.2. Import paths include 'core' (e.g., label_studio_tools.core.utils.io). Attempting flat imports (label_studio_tools.utils.io) will fail. ↓
fix Use imports with 'core' module: from label_studio_tools.core.utils.io import get_local_path
gotcha parse_config returns a dictionary; not a string or an object with methods. Do not call it expecting a string representation. ↓
fix Ensure you treat the output as a dict for further processing.
Imports
- get_local_path wrong
from label_studio_tools.utils.io import get_local_pathcorrectfrom label_studio_tools.core.utils.io import get_local_path - parse_config wrong
from label_studio_tools.utils.config import parse_configcorrectfrom label_studio_tools.core.utils.config import parse_config - is_video_object_tracking wrong
from label_studio_tools.video import is_video_object_trackingcorrectfrom label_studio_tools.core.video import is_video_object_tracking
Quickstart
from label_studio_tools.core.utils.io import get_local_path
from label_studio_tools.core.utils.config import parse_config
# Parse a Label Studio config XML string
config_xml = """<View><Text name="text" value="$text"/><Choices name="label" toName="text"><Choice value="A"/><Choice value="B"/></Choices></View>"""
parsed = parse_config(config_xml)
print(parsed)
# Get local path for a task's data (requires LS_API_KEY env var for non-local storage)
import os
os.environ['LS_API_KEY'] = os.environ.get('LS_API_KEY', '')
# task_id is needed for storage downloads; for local files, just provide the path
try:
path = get_local_path('/path/to/data', task_id=123)
print(path)
except Exception as e:
print(e)