I’m trying install my project in a container:
requirements.txt
is generated by poetry
FROM python:3.10-slim
ENV PYTHONUNBUFFERED 1
WORKDIR /app
COPY ./requirements.txt .
RUN pip install --no-cache-dir --upgrade -r requirements.txt
Then the following error occurs because setuptools
is included in requirements.txt
, but there is already a setuptools
in standard lib:
Attempting uninstall: setuptools
Found existing installation: setuptools 65.5.0
Uninstalling setuptools-65.5.0:
ERROR: Could not install packages due to an OSError: [Errno 39] Directory not empty: '/usr/local/lib/python3.10/site-packages/_distutils_hack/'
I found setuptools
is dependency of matplotlib
:
[[package]]
name = "matplotlib"
version = "3.6.2"
description = "Python plotting package"
category = "main"
optional = false
python-versions = ">=3.8"
[package.dependencies]
contourpy = ">=1.0.1"
cycler = ">=0.10"
fonttools = ">=4.22.0"
kiwisolver = ">=1.0.1"
numpy = ">=1.19"
packaging = ">=20.0"
pillow = ">=6.2.0"
pyparsing = ">=2.2.1"
python-dateutil = ">=2.7"
setuptools_scm = ">=7"
Why it is a dependency instead of a devdependency?