Reputation: 285
When i tried pip install confluent-kafka
got the following error
#include <librdkafka/rdkafka.h>
^~~~~~~~~~~~~~~~~~~~~~
1 error generated.
error: command '/usr/bin/gcc' failed with exit code 1
I'm using python version 3.9 and macOs Monterey
Upvotes: 4
Views: 8949
Reputation: 1879
Install the librdkafka library
brew install librdkafka
Set the environment variables
export C_INCLUDE_PATH=/usr/local/Cellar/librdkafka/2.2.0/include
export LIBRARY_PATH=/usr/local/Cellar/librdkafka/2.2.0/lib
Then you can install it through pip install
Upvotes: 12
Reputation: 409
Omotto's answer solves the issue.
Just a note, replace the version 1.8.2
with the version you have. You can check the version by going to this path /opt/homebrew/Cellar/librdkafka
(Since Homebrew is installed here if it's an M1 Mac). The name of the folder inside will give you the version number.
Upvotes: 4