Skip to content

Commit e7e0661

Browse files
committed
More verbose source installation instructions
1 parent 0b2e874 commit e7e0661

File tree

2 files changed

+126
-26
lines changed

2 files changed

+126
-26
lines changed

INSTALL.md

+121
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,121 @@
1+
# confluent-kafka-python installation instructions
2+
3+
## Install pre-built wheels (recommended)
4+
5+
Confluent provides pre-built Python wheels of confluent-kafka-python with
6+
all dependencies included.
7+
8+
To install, simply do:
9+
10+
```bash
11+
python3 -m pip install confluent-kafka
12+
```
13+
14+
If you get a build error or require Kerberos/GSSAPI support please read the next section: *Install from source*
15+
16+
17+
## Install from source
18+
19+
It is sometimes necessary to install confluent-kafka from source, rather
20+
than from prebuilt binary wheels, such as when:
21+
- You need GSSAPI/Kerberos authentication.
22+
- You're on a Python version we do not provide prebuilt wheels for.
23+
- You're on an architecture or platform we do not provide prebuilt wheels for.
24+
- You want to build confluent-kafka-python from the master branch.
25+
26+
27+
### Install from source on RedHat, CentOS, Fedora, etc
28+
29+
```bash
30+
#
31+
# Perform these steps as the root user (e.g., in a 'sudo bash' shell)
32+
#
33+
34+
# Install build tools and Kerberos support.
35+
36+
yum install -y python3 python3-pip python3-devel gcc make cyrus-sasl-gssapi krb5-workstation
37+
38+
# Install the latest version of librdkafka:
39+
40+
rpm --import https://packages.confluent.io/rpm/7.0/archive.key
41+
42+
echo '
43+
[Confluent-Clients]
44+
name=Confluent Clients repository
45+
baseurl=https://packages.confluent.io/clients/rpm/centos/$releasever/$basearch
46+
gpgcheck=1
47+
gpgkey=https://packages.confluent.io/clients/rpm/archive.key
48+
enabled=1' > /etc/yum.repos.d/confluent.repo
49+
50+
yum install -y librdkafka-devel
51+
52+
53+
#
54+
# Now build and install confluent-kafka-python as your standard user
55+
# (e.g., exit the root shell first).
56+
#
57+
58+
python3 -m pip install --no-binary confluent-kafka confluent-kafka
59+
60+
61+
# Verify that confluent_kafka is installed:
62+
63+
python3 -c 'import confluent_kafka; print(confluent_kafka.version())'
64+
```
65+
66+
### Install from source on Debian or Ubuntu
67+
68+
```bash
69+
#
70+
# Perform these steps as the root user (e.g., in a 'sudo bash' shell)
71+
#
72+
73+
# Install build tools and Kerberos support.
74+
75+
apt install -y wget software-properties-common lsb-release gcc make python3 python3-pip python3-dev libsasl2-modules-gssapi-mit krb5-user
76+
77+
78+
# Install the latest version of librdkafka:
79+
80+
wget -qO - https://packages.confluent.io/deb/7.0/archive.key | apt-key add -
81+
82+
add-apt-repository "deb https://packages.confluent.io/clients/deb $(lsb_release -cs) main"
83+
84+
apt update
85+
86+
apt install -y librdkafka-dev
87+
88+
89+
#
90+
# Now build and install confluent-kafka-python as your standard user
91+
# (e.g., exit the root shell first).
92+
#
93+
94+
python3 -m pip install --no-binary confluent-kafka confluent-kafka
95+
96+
97+
# Verify that confluent_kafka is installed:
98+
99+
python3 -c 'import confluent_kafka; print(confluent_kafka.version())'
100+
```
101+
102+
103+
### Install from source on Mac OS X
104+
105+
```bash
106+
107+
# Install librdkafka from homebrew
108+
109+
brew install librdkafka
110+
111+
112+
# Build and install confluent-kafka-python
113+
114+
python3 -m pip install --no-binary confluent-kafka confluent-kafka
115+
116+
117+
# Verify that confluent_kafka is installed:
118+
119+
python3 -c 'import confluent_kafka; print(confluent_kafka.version())'
120+
121+
```

README.md

+5-26
Original file line numberDiff line numberDiff line change
@@ -222,20 +222,16 @@ Install
222222
**NOTE:** The pre-built Linux wheels do NOT contain SASL Kerberos/GSSAPI support.
223223
If you need SASL Kerberos/GSSAPI support you must install librdkafka and
224224
its dependencies using the repositories below and then build
225-
confluent-kafka using the command in the "Install from
226-
source from PyPi" section below.
225+
confluent-kafka using the instructions in the
226+
"Install from source" section below.
227227

228228
**Install AvroProducer and AvroConsumer**
229229

230230
$ pip install "confluent-kafka[avro]"
231231

232-
**Install from source from PyPi**
233-
*(requires librdkafka + dependencies to be installed separately)*:
232+
**Install from source**
234233

235-
$ pip install --no-binary :all: confluent-kafka
236-
237-
238-
For source install, see *Prerequisites* below.
234+
For source install, see the *Install from source* section in [INSTALL.md](INSTALL.md).
239235

240236

241237
Broker Compatibility
@@ -274,30 +270,13 @@ Linux distribution's `ca-certificates` package which needs to be installed
274270
through `apt`, `yum`, et.al.
275271

276272
If your system stores CA certificates in another location you will need to
277-
configure the client with `'ssl.ca.location': '/path/to/cacert.pem'`.
273+
configure the client with `'ssl.ca.location': '/path/to/cacert.pem'`.
278274

279275
Alternatively, the CA certificates can be provided by the [certifi](https://pypi.org/project/certifi/)
280276
Python package. To use certifi, add an `import certifi` line and configure the
281277
client's CA location with `'ssl.ca.location': certifi.where()`.
282278

283279

284-
Prerequisites
285-
=============
286-
287-
* Python >= 2.7 or Python 3.x
288-
* [librdkafka](https://github.com/edenhill/librdkafka) >= 1.6.0 (latest release is embedded in wheels)
289-
290-
librdkafka is embedded in the macosx manylinux wheels, for other platforms, SASL Kerberos/GSSAPI support or
291-
when a specific version of librdkafka is desired, following these guidelines:
292-
293-
* For **Debian/Ubuntu** based systems, add this APT repo and then do `sudo apt-get install librdkafka-dev python-dev`:
294-
http://docs.confluent.io/current/installation.html#installation-apt
295-
296-
* For **RedHat** and **RPM**-based distros, add this YUM repo and then do `sudo yum install librdkafka-devel python-devel`:
297-
http://docs.confluent.io/current/installation.html#rpm-packages-via-yum
298-
299-
* On **OSX**, use **homebrew** and do `brew install librdkafka`
300-
301280

302281
License
303282
=======

0 commit comments

Comments
 (0)