Python SDK Installation & Setup
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.
Our latest Python SDK release is 0.5.1. You can view our full release history on PyPi.
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.
python3 -m pip install octoai-sdk
Please refer to CLI & SDK Installation for how to install the SDK in conjunction with the CLI.
Setting API token as an environment variable:
In order to access endpoints from OctoAI, an API token needs to be set, for more information on how to generate an access token see How to Create an OctoAI Access Token.
Wherever you set your environment variables for example in your .bashrc
or .env
file set OCTOAI_TOKEN
to the value from the web.
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.
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.
from octoai.client import Client
client = Client(token=YOUR_OCTOAI_API_TOKEN_HERE)
Updated 12 days ago