从docker文件安装时哈希不匹配-'pkgs与req文件中的哈希不匹配'

问题描述

我有从requirements.txt文件安装的dockerfile。安装librosa lib时,它拉了许多其他需要的lib,安装pycparser时出现此错误

 Downloading pycparser-2.20-py2.py3-none-any.whl (112 kB)
ERROR: THESE PACKAGES DO NOT MATCH THE HASHES FROM THE REQUIREMENTS FILE. If you have updated the package versions,please update the hashes. Otherwise,examine the package contents carefully; someone 
may have tampered with them.
    torch from https://files.pythonhosted.org/packages/8c/5d/faf0d8ac260c7f1eda7d063001c137da5223be1c137658384d2d45dcd0d5/torch-1.6.0-cp38-cp38-manylinux1_x86_64.whl#sha256=5357873e243bcfa804c32dc341f564e9a4c12addfc9baae4ee857fcc09a0a216 (from -r requirements.txt (line 4)):
        Expected sha256 5357873e243bcfa804c32dc341f564e9a4c12addfc9baae4ee857fcc09a0a216
             Got        eb3c7b3621d64e9d9955ec0546729291338556d4ee8ccbf347169f574816f089

哈希有什么问题?我没有在我的reqs文件中指出任何哈希或ID。

我的需求文件

flask
pydub
scipy
torch
numpy
librosa

dockerfile:

FROM voice

RUN mkdir -p ./voice_flask/d
workdir /voice_flask/d
copY . /voice_flask/d

RUN pip install -r requirements.txt
CMD ["python","server.py"]

解决方法

我建议您使用--no-cache-dir

重新安装软件包
RUN pip install -r requirements.txt --no-cache-dir

查看此Issue