【问题标题】:Why does pyarrow installation fail with cython not found when cython is included in requirements.txt?当 cython 包含在 requirements.txt 中时,为什么 pyarrow 安装失败并找不到 cython?
【发布时间】:2022-01-06 18:05:01
【问题描述】:

所以,我有一个 docker 文件,其中的说明之一是:

RUN pip3 install -r requirements.txt

在我的requirements.txt:

...
uwsgi==2.0.19.1
cython==0.29
dependency-injector==4.37.0
pyyaml==6.0
apscheduler==3.7.0
pyarrow==5.0.0
...

当我运行 docker build 时,我看到 Cython 已安装,但 pyarrow 仍然失败。我找到了这个链接 - https://github.com/apache/arrow/issues/2163 - 它提到 cmake & cython 是必需的,我在我的 requirements.txt 中添加了它,但它仍然没有帮助。我是否必须在我的Dockerfile 中添加其他语句才能安装cython

Dockerfile 构建的输出:

Collecting cython==0.29 (from -r requirements.txt (line 8))
  Downloading https://files.pythonhosted.org/packages/64/3f/cac281f3f019b825bbc03fa8cb7eb03d9c355f4aa9eef978279a4966cb21/Cython-0.29-cp36-cp36m-manylinux1_x86_64.whl (2.1MB)
...
Collecting pyarrow==5.0.0 (from -r requirements.txt (line 12))
  Downloading https://files.pythonhosted.org/packages/68/7c/0e38bfb949ededdd9b648d54cba47972835704543d7409d6f853504d0581/pyarrow-5.0.0.tar.gz (739kB)
    Complete output from command python setup.py egg_info:
    Traceback (most recent call last):
      File "<string>", line 1, in <module>
      File "/tmp/pip-build-395casa1/pyarrow/setup.py", line 39, in <module>
        from Cython.Distutils import build_ext as _build_ext
    ModuleNotFoundError: No module named 'Cython'

Python 3.6 安装在这个基础镜像上

【问题讨论】:

  • 在安装pyarrow之前尝试单独安装cython
  • 是的,我做到了,但它失败了 - pip3 升级创造了奇迹!

标签: python-3.x docker pip cython pyarrow


【解决方案1】:

呃,这可能是我愚蠢的时刻之一,但这是有效的:

RUN pip3 install --upgrade pip && pip install -r requirements.txt

我什至不必在requirements.txt 中指定cython

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2020-09-09
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多