2

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

Muhammed Fayis
  • 215
  • 3
  • 9
  • 1
    Does this answer your question? [pip install Command errored out with exit status 1](https://stackoverflow.com/questions/68139151/pip-install-command-errored-out-with-exit-status-1) – rzlvmp May 23 '22 at 04:30

2 Answers2

7

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

orion_tvv
  • 1,681
  • 4
  • 17
  • 29
omotto
  • 1,721
  • 19
  • 20
3

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.

  • This does not provide an answer to the question. Once you have sufficient [reputation](https://stackoverflow.com/help/whats-reputation) you will be able to [comment on any post](https://stackoverflow.com/help/privileges/comment); instead, [provide answers that don't require clarification from the asker](https://meta.stackexchange.com/questions/214173/why-do-i-need-50-reputation-to-comment-what-can-i-do-instead). - [From Review](/review/late-answers/32115744) – Wouter Jul 03 '22 at 10:45