Dockerfile:
FROM python:3.10-slim
ENV PYTHONUNBUFFERED 1
WORKDIR /app
COPY ./requirements.txt .
RUN pip install --trusted-host mirrors.aliyun.com --no-cache-dir --upgrade -r requirements.txt
Error during build:
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/'
It seems a permission error while deleting a folder. As root is the default user in Docker, I don't understand why lack of permission.
Without knowing the contents of your requirements.txt
file it's not possible to say with certainty but my guess is that you included setuptools
which is already in the python standard library. Remove this line and it should work
If this isn't the case, add your requirements.txt
file contents so that the error is reproducible ( docker build
with an empty file doesn't throw errors)
OSError has a number of root causes but error number 39 states
39: 'Destination address required',
found via
import os
import errno
from pprint import pprint
pprint( {i:os.strerror(i) for i in sorted(errno.errorcode)})
A couple of related posts:
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.