confluent-kafka-python icon indicating copy to clipboard operation
confluent-kafka-python copied to clipboard

Install failed in Apple Silicon

Open kination opened this issue 5 years ago • 10 comments

Description

Hello, I've been failed to install package Mac M1 arch(Python 3.9).

ERROR: Command errored out with exit status 1:
     command: /Users/kination/workspace/public/kleine/venv/bin/python3 -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/private/var/folders/y8/fc61kyjd4n53tn444n72rjrm0000gn/T/pip-install-86cf5ce_/confluent-kafka/setup.py'"'"'; __file__='"'"'/private/var/folders/y8/fc61kyjd4n53tn444n72rjrm0000gn/T/pip-install-86cf5ce_/confluent-kafka/setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' install --record /private/var/folders/y8/fc61kyjd4n53tn444n72rjrm0000gn/T/pip-record-apw4qc5s/install-record.txt --single-version-externally-managed --compile --install-headers /Users/kination/workspace/public/kleine/venv/include/site/python3.9/confluent-kafka
         cwd: /private/var/folders/y8/fc61kyjd4n53tn444n72rjrm0000gn/T/pip-install-86cf5ce_/confluent-kafka/
    Complete output (54 lines):
    running install
    running build
    running build_py
    creating build
    creating build/lib.macosx-10.9-universal2-3.9
    creating build/lib.macosx-10.9-universal2-3.9/confluent_kafka
    copying confluent_kafka/error.py -> build/lib.macosx-10.9-universal2-3.9/confluent_kafka
    copying confluent_kafka/serializing_producer.py -> build/lib.macosx-10.9-universal2-3.9/confluent_kafka
    copying confluent_kafka/__init__.py -> build/lib.macosx-10.9-universal2-3.9/confluent_kafka
    copying confluent_kafka/deserializing_consumer.py -> build/lib.macosx-10.9-universal2-3.9/confluent_kafka
    creating build/lib.macosx-10.9-universal2-3.9/confluent_kafka/schema_registry
    copying confluent_kafka/schema_registry/avro.py -> build/lib.macosx-10.9-universal2-3.9/confluent_kafka/schema_registry
    copying confluent_kafka/schema_registry/error.py -> build/lib.macosx-10.9-universal2-3.9/confluent_kafka/schema_registry
    copying confluent_kafka/schema_registry/__init__.py -> build/lib.macosx-10.9-universal2-3.9/confluent_kafka/schema_registry
    copying confluent_kafka/schema_registry/json_schema.py -> build/lib.macosx-10.9-universal2-3.9/confluent_kafka/schema_registry
    copying confluent_kafka/schema_registry/schema_registry_client.py -> build/lib.macosx-10.9-universal2-3.9/confluent_kafka/schema_registry
    copying confluent_kafka/schema_registry/protobuf.py -> build/lib.macosx-10.9-universal2-3.9/confluent_kafka/schema_registry
    creating build/lib.macosx-10.9-universal2-3.9/confluent_kafka/serialization
    copying confluent_kafka/serialization/__init__.py -> build/lib.macosx-10.9-universal2-3.9/confluent_kafka/serialization
    creating build/lib.macosx-10.9-universal2-3.9/confluent_kafka/admin
    copying confluent_kafka/admin/__init__.py -> build/lib.macosx-10.9-universal2-3.9/confluent_kafka/admin
    creating build/lib.macosx-10.9-universal2-3.9/confluent_kafka/avro
    copying confluent_kafka/avro/error.py -> build/lib.macosx-10.9-universal2-3.9/confluent_kafka/avro
    copying confluent_kafka/avro/__init__.py -> build/lib.macosx-10.9-universal2-3.9/confluent_kafka/avro
    copying confluent_kafka/avro/cached_schema_registry_client.py -> build/lib.macosx-10.9-universal2-3.9/confluent_kafka/avro
    copying confluent_kafka/avro/load.py -> build/lib.macosx-10.9-universal2-3.9/confluent_kafka/avro
    creating build/lib.macosx-10.9-universal2-3.9/confluent_kafka/kafkatest
    copying confluent_kafka/kafkatest/verifiable_client.py -> build/lib.macosx-10.9-universal2-3.9/confluent_kafka/kafkatest
    copying confluent_kafka/kafkatest/__init__.py -> build/lib.macosx-10.9-universal2-3.9/confluent_kafka/kafkatest
    copying confluent_kafka/kafkatest/verifiable_consumer.py -> build/lib.macosx-10.9-universal2-3.9/confluent_kafka/kafkatest
    copying confluent_kafka/kafkatest/verifiable_producer.py -> build/lib.macosx-10.9-universal2-3.9/confluent_kafka/kafkatest
    creating build/lib.macosx-10.9-universal2-3.9/confluent_kafka/avro/serializer
    copying confluent_kafka/avro/serializer/__init__.py -> build/lib.macosx-10.9-universal2-3.9/confluent_kafka/avro/serializer
    copying confluent_kafka/avro/serializer/message_serializer.py -> build/lib.macosx-10.9-universal2-3.9/confluent_kafka/avro/serializer
    running build_ext
    building 'confluent_kafka.cimpl' extension
    creating build/temp.macosx-10.9-universal2-3.9
    creating build/temp.macosx-10.9-universal2-3.9/private
    creating build/temp.macosx-10.9-universal2-3.9/private/var
    creating build/temp.macosx-10.9-universal2-3.9/private/var/folders
    creating build/temp.macosx-10.9-universal2-3.9/private/var/folders/y8
    creating build/temp.macosx-10.9-universal2-3.9/private/var/folders/y8/fc61kyjd4n53tn444n72rjrm0000gn
    creating build/temp.macosx-10.9-universal2-3.9/private/var/folders/y8/fc61kyjd4n53tn444n72rjrm0000gn/T
    creating build/temp.macosx-10.9-universal2-3.9/private/var/folders/y8/fc61kyjd4n53tn444n72rjrm0000gn/T/pip-install-86cf5ce_
    creating build/temp.macosx-10.9-universal2-3.9/private/var/folders/y8/fc61kyjd4n53tn444n72rjrm0000gn/T/pip-install-86cf5ce_/confluent-kafka
    creating build/temp.macosx-10.9-universal2-3.9/private/var/folders/y8/fc61kyjd4n53tn444n72rjrm0000gn/T/pip-install-86cf5ce_/confluent-kafka/confluent_kafka
    creating build/temp.macosx-10.9-universal2-3.9/private/var/folders/y8/fc61kyjd4n53tn444n72rjrm0000gn/T/pip-install-86cf5ce_/confluent-kafka/confluent_kafka/src
    gcc -Wno-unused-result -Wsign-compare -Wunreachable-code -fno-common -dynamic -DNDEBUG -g -fwrapv -O3 -Wall -arch arm64 -arch x86_64 -g -I/Users/kination/workspace/public/kleine/venv/include -I/Library/Frameworks/Python.framework/Versions/3.9/include/python3.9 -c /private/var/folders/y8/fc61kyjd4n53tn444n72rjrm0000gn/T/pip-install-86cf5ce_/confluent-kafka/confluent_kafka/src/Admin.c -o build/temp.macosx-10.9-universal2-3.9/private/var/folders/y8/fc61kyjd4n53tn444n72rjrm0000gn/T/pip-install-86cf5ce_/confluent-kafka/confluent_kafka/src/Admin.o
    In file included from /private/var/folders/y8/fc61kyjd4n53tn444n72rjrm0000gn/T/pip-install-86cf5ce_/confluent-kafka/confluent_kafka/src/Admin.c:17:
    /private/var/folders/y8/fc61kyjd4n53tn444n72rjrm0000gn/T/pip-install-86cf5ce_/confluent-kafka/confluent_kafka/src/confluent_kafka.h:22:10: fatal error: 'librdkafka/rdkafka.h' file not found
    #include <librdkafka/rdkafka.h>
             ^~~~~~~~~~~~~~~~~~~~~~
    1 error generated.
    error: command '/usr/bin/gcc' failed with exit code 1
    ----------------------------------------
ERROR: Command errored out with exit status 1: /Users/kination/workspace/public/kleine/venv/bin/python3 -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/private/var/folders/y8/fc61kyjd4n53tn444n72rjrm0000gn/T/pip-install-86cf5ce_/confluent-kafka/setup.py'"'"'; __file__='"'"'/private/var/folders/y8/fc61kyjd4n53tn444n72rjrm0000gn/T/pip-install-86cf5ce_/confluent-kafka/setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' install --record /private/var/folders/y8/fc61kyjd4n53tn444n72rjrm0000gn/T/pip-record-apw4qc5s/install-record.txt --single-version-externally-managed --compile --install-headers /Users/kination/workspace/public/kleine/venv/include/site/python3.9/confluent-kafka Check the logs for full command output.

Please let me know if there's any thing you need to know 🙏

How to reproduce

Install via pip install confluent-kafka in Macbook Air M1(2020)

kination avatar Jan 31 '21 12:01 kination

try installing librdkafka, that should get you librdkafka/rdkafka.h in the system dir (clone the repo, then configure, make, make install).

mhowlett avatar Jan 31 '21 17:01 mhowlett

@mhowlett you man clone the repo of librdkafka? Seems brew install librdkafka is not fixing this issue...

kination avatar Apr 17 '21 01:04 kination

Hello, only this way work for me :-)

M1 Mac: macOS 11.2.3

git clone https://github.com/edenhill/librdkafka.git
cd librdkafka
./configure --install-deps
brew install  openssl zstd pkg-config
./configure
make
sudo make install 

Install via brew brew install librdkafka doesn't work for me :-(

evgmoskalenko avatar Apr 27 '21 15:04 evgmoskalenko

Hello, only this way work for me :-)

M1 Mac: macOS 11.2.3

git clone https://github.com/edenhill/librdkafka.git
cd librdkafka
./configure --install-deps
brew install  openssl zstd pkg-config
./configure
make
sudo make install 

Install via brew brew install librdkafka doesn't work for me :-(

I have the same problem using Python3.8 in Apple M1 with macOS Big Sur 11.2.3 and this solution is work for me.

Winedays avatar May 03 '21 02:05 Winedays

@evgmoskalenko it worked for me too. Thanks~

kination avatar May 03 '21 04:05 kination

On new macos versions, you might have problems with openssl header not being found for librdkafka while configuring, even though it is installed via homebrew.

After installing openssl, just run brew info openssl. Command will list you what to do for the compilers:

For compilers to find [email protected] you may need to set:
  export LDFLAGS="-L/opt/homebrew/opt/[email protected]/lib"
  export CPPFLAGS="-I/opt/homebrew/opt/[email protected]/include"

For pkg-config to find [email protected] you may need to set:
  export PKG_CONFIG_PATH="/opt/homebrew/opt/[email protected]/lib/pkgconfig"

You can make sure that openssl is in place with pkg-config openssl --libs. If it is printing the correct library location, you are good to go.

emrahgunduz avatar Jun 28 '21 09:06 emrahgunduz

Hello, only this way work for me :-)

M1 Mac: macOS 11.2.3

git clone https://github.com/edenhill/librdkafka.git
cd librdkafka
./configure --install-deps
brew install  openssl zstd pkg-config
./configure
make
sudo make install 

Install via brew brew install librdkafka doesn't work for me :-(

that finally works out of the box, 100%

default-work avatar Nov 15 '21 18:11 default-work

Hello, only this way work for me :-)

M1 Mac: macOS 11.2.3

git clone https://github.com/edenhill/librdkafka.git
cd librdkafka
./configure --install-deps
brew install  openssl zstd pkg-config
./configure
make
sudo make install 

Install via brew brew install librdkafka doesn't work for me :-(

Hey that dint work for me I will show you my errors

Install librdkafka to /usr/local /usr/bin/install -d $DESTDIR/usr/local/include/librdkafka /usr/bin/install -d $DESTDIR/usr/local/lib /usr/bin/install rdkafka.h rdkafka_mock.h $DESTDIR/usr/local/include/librdkafka /usr/bin/install librdkafka.a $DESTDIR/usr/local/lib install: librdkafka.a: No such file or directory make[1]: *** [lib-install] Error 71 make: *** [install-subdirs] Error 2

mahdyledurs avatar Nov 27 '21 20:11 mahdyledurs

Hello, only this way work for me :-) M1 Mac: macOS 11.2.3

git clone https://github.com/edenhill/librdkafka.git
cd librdkafka
./configure --install-deps
brew install  openssl zstd pkg-config
./configure
make
sudo make install 

Install via brew brew install librdkafka doesn't work for me :-(

Hey that dint work for me I will show you my errors

Install librdkafka to /usr/local /usr/bin/install -d $DESTDIR/usr/local/include/librdkafka /usr/bin/install -d $DESTDIR/usr/local/lib /usr/bin/install rdkafka.h rdkafka_mock.h $DESTDIR/usr/local/include/librdkafka /usr/bin/install librdkafka.a $DESTDIR/usr/local/lib install: librdkafka.a: No such file or directory make[1]: *** [lib-install] Error 71 make: *** [install-subdirs] Error 2

Same here

JustinShuttleworth avatar Dec 28 '21 17:12 JustinShuttleworth

confluent-kafka-python does NOT install with the brew installed librdkafka

llamahunter avatar Apr 30 '22 01:04 llamahunter