> ## Documentation Index
> Fetch the complete documentation index at: https://docs.labelbox.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Installation

> Describes how to install, update, and authenticate to the Labelbox Python SDK.

Many actions and workflows available in the Labelbox app can be automated using the [Python SDK](https://github.com/Labelbox/labelbox-python/), which provides access to the [Labelbox API](https://labelbox-python.readthedocs.io/en/latest/).

## Requirements

* Make sure `pip` is installed and up-to-date.

* Use the **Workspace settings** menu of the Labelbox app to [create an API key](/reference/create-api-key). Store your key in a safe place, as you cannot view it after it has been created.

* Python: 3.9 - 3.13

## Install or upgrade SDK

After you [create an API key](/reference/create-api-key), you can start using our Python SDK.

To install, run either `pip install labelbox` or`pip install "labelbox[data]"` in your command line.

<CodeGroup>
  ```shell shell theme={null}
  pip install "labelbox[data]"
  # or
  pip install labelbox
  ```
</CodeGroup>

| Module             | Description                                                                                                                                                              |
| ------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
| `"labelbox[data]"` | Installs all [required dependencies](https://github.com/Labelbox/labelbox-python/blob/develop/requirements.lock) (libraries, tools to manipulate annotations, and more.) |
| `labelbox`         | Installs all required libraries for client-only functionality                                                                                                            |

<CodeGroup>
  ```python Python theme={null}
  # install latest labelbox version
  !pip install labelbox

  import labelbox as lb

  # Enter your Labelbox API key here
  LB_API_KEY = None

  # Create Labelbox client
  client = lb.Client(api_key=LB_API_KEY)
  ```
</CodeGroup>

To upgrade to the latest version, use your package manager: `pip install --upgrade labelbox`

To run the Python SDK in a Docker container, use the [included Dockerfile](https://github.com/Labelbox/labelbox-python/blob/develop/libs/labelbox/Dockerfile) as a starting place.

Related info:

* The Python SDK [GitHub repository](https://github.com/Labelbox/labelbox-python/)
* The most recent update to the Python SDK can be found at: [`https://github.com/Labelbox/labelbox-python/releases/latest/`](https://github.com/Labelbox/labelbox-python/releases/latest)
* [Changelog](https://github.com/Labelbox/labelbox-python/blob/develop/libs/labelbox/CHANGELOG.md) of recent changes.

## Authentication

You need an [API key](/reference/create-api-key) to authenticate your client. You can:

* Save your key to an environment variable:

  <CodeGroup>
    ```shell shell theme={null}
    user@machine:~$ export LABELBOX_API_KEY="<your_api_key>"
    user@machine:~$ python3
    ```
  </CodeGroup>

  Then, import and initialize the API Client.

  <CodeGroup>
    ```python Python theme={null}
    import labelbox as lb

    client = lb.Client()
    ```
  </CodeGroup>

* Paste your API key directly into your script (*not recommended*)

  <CodeGroup>
    ```python Python theme={null}
    import labelbox as lb

    if __name__ == '__main__':
        API_KEY = "<your_api_key_here>"
        client = lb.Client(API_KEY)
    ```
  </CodeGroup>

Remember that your API key authorizes access to Labelbox, your account, and your data assets; treat it as carefully as any other set of credentials, and make sure the [scope of the key](/reference/create-api-key) is set according to the usage is meant for.
