Introduction
Hybrid & On-prem
Hybrid cloud
Cloud data overview
Restrict data access by IP range
How to generate signed URLs
How to generate non-expiring signed URLs
On-prem
App
Overview
Ontology management
Projects
Data import
Labeling guides
Label export
Members
Workforce
Quality assurance
Automation
Model-assisted labeling
MAL import formats
Webhooks setup
Queue system
Real-time human-in-the-loop labeling
Custom label interface
Images
Videos
Text
Geospatial data
Python SDK
Getting started
Creating your first project
Project setup script
Projects
Datasets
Data Rows
Import annotations
Labels
General concepts
Python SDK FAQ
API reference
Model-assisted labeling Python script
GraphQL API
Intro to the GraphQL API
Getting started
Data types overview
Ontologies
Datasets
Data Rows
Bulk import requests
Labeling parameters
Labels
Members
Attachments
Review queue
Webhooks
Legacy editor
Migration guide
Legacy vs new editor ontology
Legacy vs new editor JSON exports
Legacy vs new editor hotkeys
Model predictions (legacy)
Multistep labeling
Release notes
Release definitions
January 6, 2021
December 7, 2020
November 4, 2020
October 9, 2020
September 25, 2020
August 21, 2020
August 6, 2020
July 6, 2020
June 22, 2020
June 2, 2020
May 19, 2020
April 14, 2020
April 1, 2020
March 3, 2020
February 18, 2020
February 5, 2020
January 17, 2020
Terms of use
Table of Contents
- All Categories
- Python SDK
- Getting started
Getting started
Updated
by Alex Cota
Overview
The Python SDK allows you to access all of the functionalities of the Labelbox API without having to use GraphQL. This documentation guides you through installation, setup, and some common use cases.
See the Python SDK repo in Github.
pip install --upgrade labelbox
to upgrade (please consult the Changelog before upgrading). The Python SDK supports Python versions 3.6 and 3.7.Installation & authentication
Step 1 Create your API key
You must have an API key for authentication. For instructions on creating a key, see API keys.
Step 2 Install
Install Labelbox using pip.
user@machine:~$ pip install labelbox
Step 3 Authenticate
In the command line, pass your API key as an environment variable and open the Python interpreter.
user@machine:~$ export LABELBOX_API_KEY="<your_api_key>"
user@machine:~$ python3
Then, import and initialize the API Client.
from labelbox import Client
client = Client()
Passing in a custom endpoint is only applicable for on-premises use cases. If this applies to you, you may pass the API key and server endpoint explicitly when you initialize the Client object. Otherwise, refer to the step above.
from labelbox import Client
client = Client("<your_api_key_here>", "https://app.your-domain.com/api/graphql")
Here is a Python snippet you can also use to connect to the API. Run this as a python script and pass your API key as a string.
from labelbox import Client
if __name__ == '__main__':
API_KEY = "<your_api_key_here>"
client = Client(API_KEY)
Step 4 Create a project
For a step-by-step guide for creating a basic project, see Creating your first project.
For a full end-to-end Python code sample for setting up a complete project in Labelbox, see Project setup script.