Python SDK | Clarifai Docs

Discover the power of the Python SDK

The Python SDK is designed to streamline your AI workflows, making it easier than ever to interact with the Clarifai API. Whether you're building AI applications or integrating Clarifai into your existing systems, the Python SDK is your go-to tool for effortless API interaction.

With an intuitive, object-oriented approach, you can accelerate your AI development with just a few lines of code.

Installation

Install via PyPI

You can install the latest stable version of the Clarifai Python SDK using pip:

pip install -U clarifai

For additional functionality, you can install all the optional libraries mentioned here by running:

pip install "clarifai[all]"

Once installed, you can confirm the version by running the following command:

clarifai --version

Install from Source (for Development)

If you’re contributing to development or need the latest updates, install from source:

git clone https://github.com/Clarifai/clarifai-python.git
cd clarifai-python
python3 -m venv .venv
source .venv/bin/activate
pip install -e .

Authentication

Clarifai uses Personal Access Tokens (PATs) to authenticate API requests. You can obtain one from your personal settings page by navigating to the Security section.

To set your PAT as an environment variable and use it with the Python SDK, run:

 export CLARIFAI_PAT=YOUR_PERSONAL_ACCESS_TOKEN_HERE
 set CLARIFAI_PAT=YOUR_PERSONAL_ACCESS_TOKEN_HERE

Minimum System Requirements

The Clarifai Python package is lightweight and designed to run on most modern systems. No special hardware is required. It will run on standard consumer-grade laptops and desktops.

Below are the minimum system requirements for different operating systems.

Supported Operating Systems

Python Requirements

Hardware Requirements