I'm trying to setup Docker for my first time ever and I've encountered the following error while running the command: docker compose up --build
8.892 ERROR: Could not find a version that satisfies the requirement pywin32==306 (from versions: none)
8.893 ERROR: No matching distribution found for pywin32==306
------
failed to solve: process "/bin/sh -c pip install -r requirements.txt" did not complete successfully: exit code: 1
dockerfile:
FROM python:3
ENV PYTHONUNBUFFERED=1
WORKDIR /code
COPY requirements.txt .
RUN pip install -r requirements.txt
COPY . .
EXPOSE 8000
CMD ["python","manage.py","runserver"]`
requirements.txt:
asgiref==3.7.2
backports.zoneinfo==0.2.1
certifi==2024.2.2
charset-normalizer==3.3.2
Django==4.2.11
docker==7.0.0
idna==3.6
packaging==24.0
pywin32==306
requests==2.31.0
sqlparse==0.4.4
typing_extensions==4.10.0
tzdata==2024.1
urllib3==2.2.1
More info:
after running pip show pywin32 got the following version: Name: pywin32 Version: 306
python:3
base image is a docker image based on debian:12
, a linux distribution.
pywin32
on the other hand has only Windows releases, which makes a lot of sense for it being a package with the description "Python for Win32 extensions".
Hence you get the error ERROR: No matching distribution found
. The architectures are incompatible.
As for what to do for this, these are basically your options.
Do you really need the package? If not, remove it.
Are you building something that is cross-platform and uses pywin32
only conditionally? Use
pywin32==306; platform_system=="Windows"
See also Is there a way to have a conditional requirements.txt file for my Python application based on platform? for other options.