无法从源代码(pypi)使用pipenv安装confluent-kafka 1.4.0 - 没有可行的解决方法。

3

在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

我想知道是否有一些解决方法,是我尚未尝试过的,可以让我在他们修复此问题之前继续工作。

1个回答

3

只需要将其固定在旧版本,直到发布新版本:

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

请注意,安装主要包(confluent-kafka)和带有额外内容的包(confluent-kafka[avro])是不必要的,您只需要安装带有额外内容的包即可。实际上,您相当于把它安装了两次。


网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接