Search code examples
pythondockerpiprasa

python pip- These packages do not match the hashes from the requirements file installing rasa with docker


I am building this image from this docker file

FROM python:3.8.0

WORKDIR /app

# Install system libraries
RUN apt-get update && \
    apt-get install -y git && \
    apt-get install -y gcc

# Install project dependencies
COPY ./requirements.txt .

RUN pip install --upgrade pip
RUN pip install --no-cache-dir -r requirements.txt --use-deprecated=legacy-resolver

# Don't use terminal buffering, print all to stdout / err right away
ENV PYTHONUNBUFFERED 1

and this is my requirements.txt file

aiohttp==3.6.2
rasa==2.4.1
rasa-sdk==2.4.1

# Rasa requirements
python-dateutil~=2.8
SQLAlchemy==1.3.23
gast==0.3.3

the command to build the image

docker build -f base_Dockerfile -t rasa_base:latest

but this is showing this error

#9 529.6 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.
#9 529.6     tensorflow<2.4,>=2.3 from https://files.pythonhosted.org/packages/10/f9/283e82c10958fc24eb120fea6c40f1d8a66507a85818de420138bbbf88bf/tensorflow-2.3.2-cp38-cp38-manylinux2010_x86_64.whl#sha256=c85d29c7b5c000b196200a25e18a5905cc04f75c989e508f8fd110f3b2c4b4fe (from rasa==2.4.1->-r requirements.txt (line 2)):
#9 529.6         Expected sha256 c85d29c7b5c000b196200a25e18a5905cc04f75c989e508f8fd110f3b2c4b4fe
#9 529.6              Got        c29a17cebd72dd06fecffd646fa0990c9b7f7b5781d8746b70d821109125f9c9
#9 529.6
------
executor failed running [/bin/sh -c pip install --no-cache-dir -r requirements.txt --use-deprecated=legacy-resolver]: exit code: 1

I have deleted all the images, and even I am using --no-cache-dir while installing the deps.


Solution

  • The issue was with cache and unused images. This command helped me

    docker system prune -a
    

    Remove all dangling images. If -a is specified, will also remove all images not referenced by any container