本文介绍了在 aws linux 机器上通过 yum 安装 librdkafka1 时出现 libsasl 依赖性问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试使用 pip 安装 python confluent-kafka 包.我正在运行 amazon linux(版本 Amazon Linux AMI 版本 2016.09)的 aws ec2 实例上尝试此操作.我只是在做:

I'm trying to install the python confluent-kafka package using pip. I'm attempting this on an aws ec2 instance that is running amazon linux (version Amazon Linux AMI release 2016.09). I'm simply doing:

pip install pip install confluent-kafka

然而,这会产生以下错误:

This however produces the following error:

In file included from confluent_kafka/src/confluent_kafka.c:17:0:
confluent_kafka/src/confluent_kafka.h:21:32: fatal error: librdkafka/rdkafka.h: No such file or directory
 #include <librdkafka/rdkafka.h>
                                ^
compilation terminated.
error: command 'gcc' failed with exit status 1

为了解决这个问题,我做了两件事:

To resolve this, I did two things:

1) 按照此页面上的说明进行操作 并添加文件/etc/yum.repos.d/confluent.repo 的内容:

1) Followed the instructions on this page and added the file /etc/yum.repos.d/confluent.repo with the contents:

[Confluent.dist]
name=Confluent repository (dist)
baseurl=http://packages.confluent.io/rpm/3.0/6
gpgcheck=1
gpgkey=http://packages.confluent.io/rpm/3.0/archive.key
enabled=1

[Confluent]
name=Confluent repository
baseurl=http://packages.confluent.io/rpm/3.0
gpgcheck=1
gpgkey=http://packages.confluent.io/rpm/3.0/archive.key
enabled=1

2) 尝试使用以下命令安装 librdkafka 库:

2) attempted to install the librdkafka library using this command:

sudo yum clean all
sudo yum install -y librdkafka1 librdkafka-devel

然而,Yum 吐出了这个错误:

Yum spits out this error however:

Error: Package: librdkafka1-0.9.1_confluent3.0.1-1.el7.x86_64 (Confluent.dist)
       Requires: openssl-libs
Error: Package: librdkafka1-0.9.1_confluent3.0.1-1.el7.x86_64 (Confluent.dist)
       Requires: libsasl2.so.3()(64bit)

一些谷歌搜索之后,我尝试了:

sudo ln /usr/lib64/libsasl2.so.2 /usr/lib64/libsasl2.so.3

这没有效果.我尝试进行 yum 升级,但这也没有解决问题.经过多次谷歌搜索,这个 kafka 用户组帖子是唯一的我可以找到远程有用的东西,但遗憾的是它不包含问题的解决方案.

This had no effect. I tried doing a yum upgrade and this also did not solve the issue. After much googling, this kafka user group post is the only remotely helpful thing I can find, but it sadly does not contain a solution to the problem.

我真的很想在这个实例上启动并运行 kafka python,所以任何建议都将不胜感激.

I'd really like to get kafka python up and running on this instance, so any suggestions would be greatly appreciated.

推荐答案

Amazon Linux 2016.19 似乎基于 RHEL 6,因此您需要参考 Confluent docs,即通过将以下内容写入/etc/yum.repos.d/confluent:

Amazon Linux 2016.19 seems to be based on RHEL 6 so you will need to reference Confluent's RHEL 6 Yum repo as described in Confluent docs, namely by writing the following to /etc/yum.repos.d/confluent:

[Confluent.dist]
name=Confluent repository (dist)
baseurl=http://packages.confluent.io/rpm/3.1/6
gpgcheck=1
gpgkey=http://packages.confluent.io/rpm/3.1/archive.key
enabled=1

[Confluent]
name=Confluent repository
baseurl=http://packages.confluent.io/rpm/3.1
gpgcheck=1
gpgkey=http://packages.confluent.io/rpm/3.1/archive.key
enabled=1

关注:

$ sudo yum clean all
$ sudo yum install gcc librdkafka1 librdkafka-devel cyrus-sasl-devel openssl-libs python-devel
$ pip install confluent-kafka  (possibly in a virtualenv)

这篇关于在 aws linux 机器上通过 yum 安装 librdkafka1 时出现 libsasl 依赖性问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

09-24 21:47