首页 > 解决方案 > 无法 pipenv 从源代码(pypi)安装 confluent-kafka 1.4.0 - 似乎没有解决方法有效

问题描述

pypi 上当前的 Confluent-Kafka 包似乎记录了一个问题:

我有一个带有以下代码的 Dockerfile,该代码问题发生之前一直有效:

RUN cd /tmp && git clone https://github.com/edenhill/librdkafka.git \
&& cd librdkafka \
&& ./configure --prefix /usr \
&& make \
&& make install \
&& cd .. \
&& rm -rf librdkafka

RUN apk --update add \
......
pip3 install -U setuptools &&\
pip3 install --upgrade pip \
avro-python3\
confluent-kafka[avro]\
confluent-kafka\

ERROR after the issue: Command errored out with exit status 1:
 command: /usr/bin/python3.6 -c 'import sys, setuptools, tokenize; sys.argv[0] = 
 '"'"'/tmp/pip-req-build-14u6lptl/setup.py'"'"'; __file__='"'"'/tmp/pip-req-build-
 14u6lptl/setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)
 (__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, 
 __file__, '"'"'exec'"'"'))' egg_info --egg-base /tmp/pip-req-build-14u6lptl/pip-egg-info
     cwd: /tmp/pip-req-build-14u6lptl/
 Complete output (5 lines):
 Traceback (most recent call last):
  File "<string>", line 1, in <module>
  File "/tmp/pip-req-build-14u6lptl/setup.py", line 12, in <module>
    with open(os.path.join(mod_dir, 'requirements.txt')) as f:
 FileNotFoundError: [Errno 2] No such file or directory: '/tmp/pip-req-build- 
 14u6lptl/confluent_kafka/requirements.txt'

在该问题的 github 页面上,有一些解决该问题的建议,我已经尝试过这样的建议:

1)没有工作的解决方法:

ENV LIBRDKAFKA_VERSION v1.4.0 \
RUN cd /tmp && git clone https://github.com/edenhill/librdkafka.git \
  && cd librdkafka \
  && git checkout $LIBRDKAFKA_VERSION \
  && ./configure --install-deps --prefix /usr \
  && make \
  && make install 

RUN apk --update add \
......
pip3 install -U setuptools &&\
pip3 install --upgrade pip \
avro-python3\
confluent-kafka[avro]\
confluent-kafka\
....

2)没有工作的解决方法:

ENV LIBRDKAFKA_VERSION v1.4.0 \
RUN cd /tmp && git clone https://github.com/edenhill/librdkafka.git \
  && cd librdkafka \
  && git checkout $LIBRDKAFKA_VERSION \
  && ./configure --install-deps --prefix /usr \
  && make \
  && make install

RUN apk --update add \
.....
pip3 install -U setuptools &&\
pip3 install --upgrade pip \
avro-python3\
confluent-kafka[avro]\
--no-binary :all: -i https://test.pypi.org/simple/ confluent-kafka==v1.4.0.1 \
....

ERROR: 
Service 'xxxx' failed to build: The command '/bin/sh -c apk --update add 
avro-python3    
confluent-kafka[avro]    
--no-binary :all: -i https://test.pypi.org/simple/ confluent-kafka==v1.4.0.1 
returned a non-zero code: 1

我想知道是否有一种解决方法我没有尝试过有人可以建议让我继续,直到他们解决这个问题..

标签: pythonpipconfluent-platformlibrdkafka

解决方案


只需固定到旧版本,直到他们发布新版本:

pip3 install --upgrade pip \
avro-python3\
confluent-kafka[avro]==1.3.0\

另请注意,无需安装主包(confluent-kafka)和带有附加包( )的包confluent-kafka[avro],您只需要安装带有附加包的包。您实际上是在安装它两次。


推荐阅读