Set up your Python environment

This guide installs the PubNub Python SDK, the pubnub package. To send your first message after you install it, follow the quickstart.

Check the Python version​

The SDK needs Python 3.9 or later. For supported operating systems and Python versions, see Platform support.

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:

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

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

Install the SDK​

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:

1pip install 'pubnub>=10.9.1'

Install from source​

To build the SDK yourself, clone the Python SDK repository, then install it from the cloned folder:

1git clone https://github.com/pubnub/python
2cd python
3pip install .

Next steps​

Was this page useful?

Last updated on