---
source_url: https://www.pubnub.com/docs/sdks/python/set-up-your-environment
title: Set up your Python environment
updated_at: 2026-11-25T12:28:11.000Z
sdk_name: PubNub Python SDK
sdk_version: 10.9.1
description: Install the PubNub Python SDK with pip in a virtual environment or from source, and check which Python versions it supports.
---

# Set up your Python environment

PubNub Python SDK, use the latest version: 10.9.1

Install:

```bash
pip install pubnub==10.9.1
```

> For AI agents: documentation index at https://www.pubnub.com/llms-full.txt

This guide installs the PubNub Python SDK, the `pubnub` package. To send your first message after you install it, follow the [quickstart](https://www.pubnub.com/docs/sdks/python/quickstart.md).

## Check the Python version

The SDK needs Python 3.9 or later. For supported operating systems and Python versions, see [Platform support](https://www.pubnub.com/docs/sdks/python/platform-support.md).

## Create a virtual environment

A virtual environment separates the SDK and its dependencies from other Python projects. Create and activate one in your project folder:

```bash
python -m venv .venv
source .venv/bin/activate
```

On Windows, run `.venv\Scripts\activate` to activate it.

## Install the SDK

:::note SDK version
Always use the latest SDK version to have access to the newest features and avoid security vulnerabilities, bugs, and performance issues.
:::

Install the SDK with `pip`:

```bash
pip install 'pubnub>=10.9.1'
```

## Install from source

To build the SDK yourself, clone the [Python SDK](https://github.com/pubnub/python/) repository, then install it from the cloned folder:

```bash
git clone https://github.com/pubnub/python
cd python
pip install .
```

## Next steps

* Send your first message with the [quickstart](https://www.pubnub.com/docs/sdks/python/quickstart.md).
* Initialize the client with the [Configuration](https://www.pubnub.com/docs/sdks/python/api-reference/configuration.md) options.

Last updated at: 2026-11-25T12:28:11.000Z
