# Install the Python SDK

#### **For getting access to the Distributional platform,** [**please reach out to our team**](https://distributional.com/sign-up/)**.**

## Installing Distributional

The dbnl SDK supports [Python versions 3.9-3.12](https://www.python.org/downloads/). You can install the latest release of the SDK with the following command on Linux or macOS, install a specific release, and install :

### 1. Latest Stable Release

To install the latest stable release of the `dbnl` package:

```bash
pip install dbnl
```

### 2. Specific Release

To install a specific version (e.g., version `0.22.0`):

```bash
pip install "dbnl==0.22.0"
```

### 3. Installing with the `eval` Extra

The `dbnl.eval` extra includes additional features and requires an external spaCy model.

#### 3.1. Install the Required spaCy Model

To install the required `en_core_web_sm` pretrained English-language NLP model model for spaCy:

```bash
pip install https://github.com/explosion/spacy-models/releases/download/en_core_web_sm-3.8.0/en_core_web_sm-3.8.0-py3-none-any.whl
```

#### 3.2. Install `dbnl` with the `eval` Extra

To install `dbnl` with evaluation extras:

```bash
pip install "dbnl[eval]"
```

If you need a specific version with evaluation extras (e.g., version `0.22.0`):

```bash
pip install "dbnl[eval]==0.22.0"
```

## 4. Accessing the Distributional UI and API token

You should have already received an invite email from the Distributional team to create your account. If that is not the case, please reach out to your Distributional contact. You can access and/or generate your token at <https://app.dbnl.com/tokens> (which will prompt you to login if you are not already).

We recommend setting your API token as an environment variable, see below.

## 5. Environment Variables

DBNL has three reserved environment variables that it reads in before execution.

<table><thead><tr><th width="223">Variable Name</th><th>Description</th></tr></thead><tbody><tr><td><code>DBNL_API_TOKEN</code></td><td>The API token used to authenticate your dbnl account. </td></tr><tr><td><code>DBNL_API_URL</code></td><td>The base url of the Distributional API. For SaaS users, set this variable to <code>api.dbnl.com</code>. For other users, please contact your sys admin.</td></tr><tr><td><code>DBNL_APP_URL</code></td><td>An optional base url of the Distributional app. If this variable is not set, the app url is inferred from the <code>DBNL_API_URL</code> variable. For on-prem users, please contact your sys admin if you cannot reach the Distributional UI.</td></tr></tbody></table>

### Set up for various deployment types

DBNL has three available deployment types, SaaS, [Sandbox](https://docs.dbnl.com/v0.24.x/platform/sandbox), and [Full On-Premise](https://docs.dbnl.com/v0.24.x/platform/self-hosted).

{% tabs %}
{% tab title="SaaS Deployment" %}

```bash
#Run the following commands in your terminal. Make sure to wrap the API token in quotes.

export DBNL_API_TOKEN="copy_paste_dbnl_api_token"
export DBNL_API_URL="api.dbnl.com"
export DBNL_APP_URL="app.dbnl.com"
```

{% endtab %}

{% tab title="Sandbox Deployment" %}

```bash
export DBNL_API_URL="localhost:8080/api"
export DBNL_APP_URL="localhost:8080"
```

{% endtab %}

{% tab title="On-Premise Deployment" %}

```bash
export DBNL_API_URL="<CUSTOMER_SPECIFIC_API_URL>"
export DBNL_APP_URL="<CUSTOMER_SPECIFIC_APP_URL>"
```

{% endtab %}
{% endtabs %}

### Version Matching Requirements

{% hint style="info" %}
DBNL provides different versions of the API and SDK. Ensuring compatibility is critical for proper functionality. SDK and API server versions must match major and minor version numbers.
{% endhint %}

To check your SDK version:

```python
import dbnl
print(dbnl.__version__)
```

To check your API server version:

* Logging into the web app
* Clicking the hamburger menu (☰) on the top-left corner
* Viewing the version number listed in the footer
