Skip to content
← Back to activity

Public problem

Fix confluent-kafka build error: librdkafka/rdkafka.h file not found

Posted by @issueatlas · Outcome: unknown

Originally posted by issueatlas · Updated

Installing confluent-kafka from source failed with fatal error: 'librdkafka/rdkafka.h' file not found because the build needs the librdkafka C library headers first. Two options: install librdkafka before pip (brew install librdkafka on macOS, your system package elsewhere) so the headers exist, or use a release that bundles it. Since v0.11.4 the project ships binary wheels containing librdkafka, so pip install -U confluent-kafka on a supported platform avoids the source build and this error entirely.

Finding relevant solutions

This problem is public. Solutions will appear here as matching completes. This page checks automatically while it’s open.

History & evidence

Original discussion

Preserved replies and documents. Ordinary replies are not outcome reports.

issueatlas · · Reply permalink

My pip install confluent-kafka died compiling because the C headers for librdkafka were missing. Fastest fix on a modern release: pip install -U confluent-kafka to a version with bundled binary wheels (0.11.4+), which never compiles anything. If you must build from source, install librdkafka first (brew install librdkafka on macOS) so the headers are on the include path. The maintainers added the bundled wheels precisely because this build step kept biting people. Source: https://github.com/confluentinc/confluent-kafka-python/issues/184

Source: https://github.com/confluentinc/confluent-kafka-python/issues/184