0

Firstly, I add a lots of package in requirements.txt, docker build it and works better. and then I changed my requirements.txt like below.

Django==2.2.6 
django-filter==2.4.0
djangorestframework==3.12.1
djongo==1.3.3
Pillow==8.0.0
pylint==2.6.0
requests==2.24.0
sqlparse==0.2.4
urllib3==1.25.11

but when I try docker-compose up again, pip still install other pacakge that I removed.

Step 8/22 : RUN pip install --no-cache-dir -r /requirements.txt
 ---> Running in 55fcc339ce74
Collecting Django==2.2.6
  Downloading Django-2.2.6-py3-none-any.whl (7.5 MB)
Collecting django-filter==2.4.0
  Downloading django_filter-2.4.0-py3-none-any.whl (73 kB)
Collecting djangorestframework==3.12.1
  Downloading djangorestframework-3.12.1-py3-none-any.whl (913 kB)
Collecting djongo==1.3.3
  Downloading djongo-1.3.3.tar.gz (334 kB)
Collecting Pillow==8.0.0
  Downloading Pillow-8.0.0.tar.gz (44.6 MB)
Collecting pylint==2.6.0
  Downloading pylint-2.6.0-py3-none-any.whl (325 kB)
Collecting requests==2.24.0
  Downloading requests-2.24.0-py2.py3-none-any.whl (61 kB)
Collecting sqlparse==0.2.4
  Downloading sqlparse-0.2.4-py2.py3-none-any.whl (38 kB)
Collecting urllib3==1.25.11
  Downloading urllib3-1.25.11-py2.py3-none-any.whl (127 kB)
Collecting pytz
  Downloading pytz-2020.4-py2.py3-none-any.whl (509 kB)
Collecting pymongo>=3.2.0
  Downloading pymongo-3.11.0.tar.gz (771 kB)
Collecting astroid<=2.5,>=2.4.0
  Downloading astroid-2.4.2-py3-none-any.whl (213 kB)
Collecting toml>=0.7.1
  Downloading toml-0.10.2-py2.py3-none-any.whl (16 kB)
Collecting mccabe<0.7,>=0.6
  Downloading mccabe-0.6.1-py2.py3-none-any.whl (8.6 kB)
Collecting isort<6,>=4.2.5
  Downloading isort-5.6.4-py3-none-any.whl (98 kB)
Collecting idna<3,>=2.5
  Downloading idna-2.10-py2.py3-none-any.whl (58 kB)
Collecting chardet<4,>=3.0.2
  Downloading chardet-3.0.4-py2.py3-none-any.whl (133 kB)
Collecting certifi>=2017.4.17
  Downloading certifi-2020.11.8-py2.py3-none-any.whl (155 kB)
Collecting wrapt~=1.11
  Downloading wrapt-1.12.1.tar.gz (27 kB)

I don't know why this happen again and again. I thought something cache in my docker system. I already tried remove all the docker images, docker cache deleted... etc...

How can I fix it?

FROM python:3.8-alpine

ENV PATH="/scripts:${PATH}"
ENV LIBRARY_PATH=/lib:/usr/lib

COPY ./requirements.txt /requirements.txt
RUN apk add --update --no-cache --virtual .tmp gcc libc-dev linux-headers jpeg-dev libjpeg-turbo
RUN apk add build-base python3-dev zlib-dev
RUN pip install --upgrade pip
RUN pip install --no-cache-dir -r /requirements.txt
RUN apk add libjpeg
RUN apk del .tmp

RUN mkdir /webserver
COPY ./webserver /webserver
WORKDIR /webserver
COPY ./scripts /scripts

RUN chmod +x /scripts/*

RUN mkdir -p /vol/web/media
RUN mkdir -p /vol/web/

RUN adduser -D user
RUN chown -R user:user /vol
RUN chmod -R 755 /vol/web
USER user

CMD ["entrypoint.sh"]

This is my docker file. pip install --no-cache-dir doesn't work either...

한승욱
  • 51
  • 1
  • 6
  • What did your `requirements.txt` look like initially? – Jared Cleghorn Nov 16 '20 at 08:25
  • Which packages are installed, but you do not want them? – Elmar Brauch Nov 16 '20 at 08:28
  • Thank you for your reply. so other packages are automatically installed. – 한승욱 Nov 16 '20 at 08:34
  • @ElmarBrauch pytz, pymongo, astroid, toml, mccabe, isort, idna, chardet, certifi, wrapt – 한승욱 Nov 16 '20 at 08:36
  • 1
    @JaredCleghorn + pytz, pymongo, astroid, toml, mccabe, isort, idna, chardet, certifi, wrapt – 한승욱 Nov 16 '20 at 08:37
  • Could you add your docker-compose.yml file? – Jared Cleghorn Nov 16 '20 at 09:02
  • @JaredCleghorn Sure docker-compose is work! but my question is why other package automacally installed! – 한승욱 Nov 16 '20 at 09:21
  • Sorry, maybe I wasn't clear, I meant could you add your the contents of your `docker-compose.yml` file to the question. I want to match your setup so that I can try to reproduce the problem. If this is really a duplicate of [Why does pip install requirements.txt install extra packages?](https://stackoverflow.com/questions/42919181/why-does-pip-install-requirements-txt-install-extra-packages), then I should get the same output even if I start with the modified `requirements.txt`, but I suspect that I will not. – Jared Cleghorn Nov 16 '20 at 10:04
  • @JaredCleghorn Thanks sir. I can show you my docker-compose.yml but too long in this reply... How about build tho docker-file?! – 한승욱 Nov 17 '20 at 01:30
  • Ah okay, looks like this is actually the same problem: the additional packages that get installed are just dependencies of your dependencies – Jared Cleghorn Nov 17 '20 at 08:34

0 Answers0