Python 尝试使用Dockerfile下载requirements.txt时哈希值出错

Python 尝试使用Dockerfile下载requirements.txt时哈希值出错,python,python-3.x,docker,dockerfile,ubuntu-16.04,Python,Python 3.x,Docker,Dockerfile,Ubuntu 16.04,Dockerfile: FROM ubuntu:16.04 MAINTAINER ABC ENV DEBIAN_FRONTEND noninteractive RUN rm -rf /var/lib/apt/lists/* RUN apt clean RUN apt-get update RUN apt-get install -y --no-install-recommends \ apt-transport-https \ ca-certificates \ curl \

Dockerfile:

FROM ubuntu:16.04
MAINTAINER ABC

ENV DEBIAN_FRONTEND noninteractive

RUN rm -rf /var/lib/apt/lists/*
RUN apt clean
RUN apt-get update
RUN apt-get install -y --no-install-recommends \
  apt-transport-https \
  ca-certificates \
  curl \
  software-properties-common
RUN add-apt-repository ppa:deadsnakes/ppa
RUN apt-get update
RUN apt-get update && apt-get -y upgrade
RUN apt-get install -y python3-pip
RUN apt-get install -y python3-dev
RUN apt-get install -y libmysqlclient-dev
RUN apt-get install -y libpq-dev
RUN apt-get install -y mysql-server
RUN apt-get install -y postgresql
RUN apt-get install -y postgresql-server-dev-9.5
RUN apt-get install -y python3.6

COPY ./requirements.txt /requirements.txt
RUN mkdir /var/crackd_setup/ \
   && cd /var/crackd_setup/
RUN apt-get install -y python3.6-venv
RUN python3.6 -m venv MyDjangoEnv
RUN /bin/bash -c "source MyDjangoEnv/bin/activate" \
   && python3.6 -m pip install --upgrade pip setuptools wheel
RUN apt-get update

RUN rm ~/.cache/pip -rf
RUN pip install --no-cache-dir -r /requirements.txt
每次生成命令后仍会出现错误:

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.
    matplotlib==3.1.1 from https://files.pythonhosted.org/packages/57/4f/dd381ecf6c6ab9bcdaa8ea912e866dedc6e696756156d8ecc087e20817e2/matplotlib-3.1.1-cp36-cp36m-manylinux1_x86_64.whl#sha256=bab9d848dbf1517bc58d1f486772e99919b19efef5dd8596d4b26f9f5ee08b6b (from -r /requirements.txt (line 38)):
        Expected sha256 bab9d848dbf1517bc58d1f486772e99919b19efef5dd8596d4b26f9f5ee08b6b
             Got        7a00dd0dff395d85a9dd815ba813e3a8f82c7ce0d58f600a0c176ab68bf1a2d9

    torch==1.1.0 from https://files.pythonhosted.org/packages/69/60/f685fb2cfb3088736bafbc9bdbb455327bdc8906b606da9c9a81bae1c81e/torch-1.1.0-cp36-cp36m-manylinux1_x86_64.whl#sha256=40c644abef1767dcac58f3285021ea963123b392e5628d402e985123ea8701ca (from -r /requirements.txt (line 65)):
        Expected sha256 40c644abef1767dcac58f3285021ea963123b392e5628d402e985123ea8701ca
             Got        ab6fd553cbe1d9bbd2d0ac874a0ca7ad790166345eb70bac7bac55aea24d9bfd

The command '/bin/sh -c pip install --no-cache-dir -r /requirements.txt' returned a non-zero code: 1
我是不是遗漏了什么

提到这一点:

但到目前为止还没有成功


另外,我可以减少最后一条语句的构建时间吗?requirements.txt中大约有85个库,每个构建结果大约需要10分钟。

您能检查一下包是否已完全下载吗?由于此处加密检查失败:

选中此项:

您可以尝试独立安装错误的软件包(如pip install matplotlib==3.1.1),以查看问题是否与批安装完全一致


希望这有帮助

你好,Ashutosh,谢谢。问题发生在下载这些库的轮子时。我从
requirements.txt
文件中删除了pytorch,并执行了以下步骤,它成功了<代码>运行wgethttps://files.pythonhosted.org/packages/69/60/f685fb2cfb3088736bafbc9bdbb455327bdc8906b606da9c9a81bae1c81e/torch-1.1.0-cp36-cp36m-manylinux1_x86_64.whl 运行pip安装--无缓存目录torch-1.1.0-cp36-cp36m-manylinux1_x86_64.whl运行pip安装--无缓存目录-r/requirements.txt