I am trying to build an image for my flask server, I generated the requirements.txt using pipreqs.
The requirements.txt contains cryptography==2.8 and everytime the build fails on while trying to install this version. Not too sure why, it even shows that the version is right there.
Here is the docker build error
22.90 ERROR: Could not find a version that satisfies the requirement cryptography==2.8
(from versions: 0.1, 0.2, 0.2.1, 0.2.2, 0.3, 0.4, 0.5, 0.5.1, 0.5.2, 0.5.3, 0.5.4, 0.6, 0.6.1, 0.7, 0.7.1, 0.7.2, 0.8, 0.8.1, 0.8.2, 0.9, 0.9.1, 0.9.2, 0.9.3, 1.0, 1.0.1, 1.0.2, 1.1, 1.1.1, 1.1.2, 1.2, 1.2.1, 1.2.2, 1.2.3, 1.3, 1.3.1, 1.3.2, 1.3.3, 1.3.4, 1.4, 1.5, 1.5.1, 1.5.2, 1.5.3, 1.6, 1.7, 1.7.1, 1.7.2, 1.8, 1.8.1, 1.8.2, 1.9, 2.0, 2.0.1, 2.0.2, 2.0.3, 2.1, 2.1.1, 2.1.2, 2.1.3, 2.1.4, 2.2, 2.2.1, 2.2.2, 2.3, 2.3.1, 2.4, 2.4.1, 2.4.2, 2.5, 2.6, 2.6.1, 2.7, 2.8, 2.9, 2.9.1, 2.9.2, 3.0, 3.1, 3.1.1, 3.2, 3.2.1, 3.3, 3.3.1, 3.3.2, 3.4, 3.4.1, 3.4.2, 3.4.3, 3.4.4, 3.4.5, 3.4.6, 3.4.7, 3.4.8, 35.0.0, 36.0.0, 36.0.1)
#8 22.90 ERROR: No matching distribution found for cryptography==2.8
#8 22.92 WARNING: You are using pip version 21.2.4; however, version 21.3.1 is available.
#8 22.92 You should consider upgrading via the '/usr/local/bin/python -m pip install --upgrade pip' command.
------
executor failed running [/bin/sh -c pip3 install -r requirements.txt]: exit code: 1
EDIT : Even without copying any of the flask code, the following build fails
FROM python:3.8.10-alpine3.13
RUN pip install cryptography==2.8
Please have a look and let me know if more info is needed or where I am going wrong. Thanks
CodePudding user response:
I think your problem in with alpine linux image, I mean the base image used for building python:3.9.10-alpine3.15 you should try to install cryptography manually by following the code mentioned below:
RUN apk add --no-cache \
libressl-dev \
musl-dev \
libffi-dev && \
pip install --no-cache-dir cryptography==2.8 && \
apk del \
libressl-dev \
musl-dev \
libffi-dev
Cryptography documentation also has the information as how to download it
RUN apk add gcc musl-dev libffi-dev openssl-dev cargo
CodePudding user response:
There appears to be a problem with the base image as pointed out by @Soheb, it works perfectly with python:3.8.10-slim-buster. Not too sure what was the issue with the previous base image though
