6

一个特别奇怪的 pip 包依赖版本问题

 3 years ago
source link: https://www.v2ex.com/t/782631
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.

V2EX  ›  Python

一个特别奇怪的 pip 包依赖版本问题

  dangyuluo · 19 小时 35 分钟前 · 398 次点击

我有一个自己打包 Docker image,里面安装了 numpy 和 matplotlib 。一年前我调试好后 freeze 了所有的 pip package 版本,numpy==1.19.2, matplotlib==3.3.2,自此之后一直没有重新打包 Docker image 。

最近我需要更改一些东西,因此需要重新打包一下,但是安装这两个 pip 包的时候居然失败了!

RUN pip3 install numpy==1.19.2 matplotlib==3.3.2

Collecting numpy==1.19.2
  Downloading numpy-1.19.2-cp36-cp36m-manylinux2014_aarch64.whl (12.2 MB)
Collecting matplotlib==3.3.2
  Downloading matplotlib-3.3.2.tar.gz (37.9 MB)
    ERROR: Command errored out with exit status 1:
     command: /usr/bin/python3 -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-install-vrrk_zeh/matplotlib/setup.py'"'"
'; __file__='"'"'/tmp/pip-install-vrrk_zeh/matplotlib/setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().rep
lace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' egg_info --egg-base /tmp/pip-pip-egg-info-13y
9rlc7
...
      File "/usr/lib/python3/dist-packages/setuptools/sandbox.py", line 250, in run_setup
        _execfile(setup_script, ns)
      File "/usr/lib/python3/dist-packages/setuptools/sandbox.py", line 45, in _execfile
        exec(code, globals, locals)
      File "/tmp/easy_install-sdqaijla/numpy-1.21.0rc2/setup.py", line 34, in <module>
        # The setuptools version of sdist adds a setup.cfg file to the tree.
    RuntimeError: Python version >= 3.7 required.

错误似乎是在说Matplotlib想安装更新的numpy-1.21.0 which 需要 Python3.7 以上。但是我明明有在命令行里指定我想要的 numpy 版本呀?为什么 pip 没有执行呢?

另外,如果我单独安装numpy,再安装matplotlib问题就消失了。

RUN pip3 install numpy==1.19.2
RUN pip3 install matplotlib==3.3.2 # everything works fine

再另外,这个问题只出现在 aarch64 机器上,x86_64 机器一点问题也没有。

哪位能看出来问题所在?谢谢


About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK