1. Python
  2. Tutorial

Create Project

Note

Please ensure you use version 2.6.0 or later of the confluent-kafka library.

StreamNative Cloud does not support librdkafka versions 2.5.0 and 2.5.3, or any client SDKs based on these versions (including confluent-kafka-python 2.5.0 and 2.5.3). This is due to a backward compatibility regression in librdkafka that was fixed in version 2.6.0. For more information, see librdkafka #4871.

For more details about version compatibility, see StreamNative Cloud Kafka Compatibility.

Create a new directory anywhere you’d like for this project:

mkdir kafka-python-getting-started && cd kafka-python-getting-started

Create and activate a Python virtual environment to give yourself a clean, isolated environment for this project. You may use other virtual environment managers like venv if you prefer.

virtualenv venv
source venv/bin/activate

Install the Apache Kafka Python client library:

pip install confluent-kafka
Previous
Prerequisites