---
title: How to Install the Gradient CLI and SDK
description: Install the Gradient CLI and SDK on Windows, MacOS, or Linux to launch Notebooks, Workflows, and Deployments programmatically using Python.
product: Reference
url: https://docs.digitalocean.com/reference/paperspace/gradient/install/
last_updated: "2026-09-03"
---

> **For AI agents:** The documentation index is at [https://docs.digitalocean.com/llms.txt](https://docs.digitalocean.com/llms.txt). Markdown versions of pages use the same URL with `index.html.md` in place of the HTML page (for example, append `index.html.md` to the directory path instead of opening the HTML document).

# How to Install the Gradient CLI and SDK

**Warning: Deprecated**:

  As of 15 July 2024, Gradient API endpoints are deprecated and no longer available for Paperspace users.

You can launch Notebooks, Workflows, and Deployments programmatically with the SDK using Python.

The SDK is bundled with the Gradient CLI. The Gradient CLI is available on [PyPI](https://pypi.org/project/gradient/) and works on Windows, MacOS, and Linux.

The CLI requires **Python 3.4+** (or Python 2.7). Use a compatible version of **pip** (or **pip3**) depending on your Python version.

## Installation

**Tip**:

  We recommend installing and using the CLI within a Python virtual environment. This minimizes conflicts with existing libraries on your computer. We recommend **virtualenv**. [See below](#using-a-virtual-environment) for more instructions.

### Pip install

```bash
pip install -U gradient
```

The `-U` option upgrades all specified packages to the newest available version.

You can verify that it is working by running

```bash
gradient version
```

which outputs a version like `v2.0.5`.

### Connect your account

You can either stash your API key on your computer or include your API key on each command. The latter can be useful if you are working on several teams at the same time, as each team has its own API key.

### Obtaining an API key

Sign in to your [Paperspace account](https://www.paperspace.com/account/login) to create a new API key. Once logged in, navigate to your Profile on the top right hand side of your screen and click `Team Settings`.

Under `Team Settings`, click the `API Keys` tab. Enter in a name for your API Key and click the `Add +` button. Make sure to copy your new API key after it is generated. You won’t be able to see it again after leaving the page.

The API keys you generated here are used to authenticate your requests.

### Set active API key

First, [obtain an API Key](#obtaining-an-api-key), and then:

```bash
gradient apiKey XXXXXXXXXXXXXXXXXXX
```

Alternatively, you can set the environment variable `PAPERSPACE_API_KEY` temporarily to override your configured API key.

```bash
export PAPERSPACE_API_KEY=XXXX
gradient workflows run ...
```

**Tip**:

  You can reveal your current API key with `cat ~/.paperspace/config.json`

### Using a virtual environment

For Python 3.4+

First, install `virtualenv`:

```bash
pip install virtualenv
```

Create a new virtual environment:

```bash
python3 -m virtualenv <virtual_env_dir_path>
```

Activate the virtual environment:

```bash
source <virtual_env_dir_path>/bin/activate
```

virtualenvs can also be run in other ways, for example, using `conda`.

### Enable autocomplete

Add the following to your `.bashrc` (or `.zshrc`) to enable autocomplete anytime you activate your shell. If Gradient was installed in a virtual environment, the following has to be added to the `activate` script:

`eval "$(_GRADIENT_COMPLETE=source gradient)"`

Alternatively, you can create an activation script by:

`(_GRADIENT_COMPLETE=source gradient) > ~/paperspace_complete.sh`

and then add `. ~/paperspace_complete.sh` to your `.bashrc`, `.zshrc` or `activate` script.

For more, see [https://click.palletsprojects.com/en/7.x/bashcomplete/](https://click.palletsprojects.com/en/7.x/bashcomplete/) .

### Install the latest pre-release version

If you need a pre-release version of the CLI use the following command to install it:

```bash
pip install -U --pre gradient
```