Installation Guide

The SDK currently supports Python versions 3.8.1 and upwards. It is strongly recommended that you use a virtual environment such as Conda or venv to manage Python packages for your development environment. This helps prevent incompatible dependencies with packages installed irrelevant to your current project or that conflict with system dependencies.

You can view our full release history on PyPi for the latest version of the Python SDK.

For Mac and Linux, use pip to install the octoai-sdk. Python package. We strongly recommend that you install OctoAI in a virtualenv, to avoid conflicting with your system packages.

shell
python3 -m pip install octoai-sdk

Please refer to CLI & SDK Installation for how to install the SDK in conjunction with the CLI for the authoring tool.

Setting API token as an environment variable

In order to access endpoints, create an OctoAI API token. Set OCTOAI_TOKEN to the token value wherever you set your environment variables, such as your .bashrc or .env file.

bash
export OCTOAI_TOKEN=YOUR_TOKEN_HERE

Then when you instantiate the client, it will detect the OCTOAI_TOKEN as an envvar and set it for you.

Python
from octoai.client import Client

client = Client()

Alternatively, on creation of the Client class, you can set your token, or the Client also accepts a path to where you’ve stored your API token from the config_path variable. Please see the Client docs for more information.

Python
from octoai.client import Client

client = Client(token=YOUR_OCTOAI_API_TOKEN_HERE)