I am new in python and using python:3.7.13-alpine3.15 docker image, while downloading the packages, I am seeing the below error. Can someone suggest something?
I have already tried changing the docker image to non-alpine image. but that did not help.
Error:
executor failed running [/bin/sh -c apk add –no-cache –virtual .build-deps g++ libxml2 libxml2-dev alpine-sdk py3-cffi libffi-dev libxslt-dev python3-dev]: exit code: 2
Docker file:
FROM python:3.7.13-alpine3.15
RUN apk update
RUN apk add --no-cache --virtual .build-deps g++ libxml2 libxml2-dev alpine-sdk py3-cffi libffi-dev libxslt-dev python3-dev
RUN pip install --upgrade pip setuptools
RUN pip --version
RUN python --version
WORKDIR ./
RUN apk add --update alpine-sdk py3-cffi libffi-dev
RUN python -m venv /opt/venv
# Enable venv
ENV PATH="/opt/venv/bin:$PATH"
COPY requirements.txt .
RUN pip3 install -Ur "requirements.txt"
Requirements.txt:
following packages are being installed
beautifulsoup4==4.9.3
certifi==2020.12.5
chardet==4.0.0
idna==2.10
lxml==4.6.2
nuclio-sdk==0.2.0
pycparser==2.20
PyJWT==2.0.1
pymongo==3.11.2
pysolr==3.9.0
py7zr==0.16.1
python-memcached==1.59
PyYAML==5.4
requests==2.25.1
six==1.15.0
urllib3==1.26.2
zeep==4.1.0
requests-kerberos==0.14.0
2
Answers
If I
pip install bcj-cffi
in a shell using that image, the error message is much more descriptive and points to the source of the problem:The problem here is that that the
bcj-cffi
module has a number of non-Python depdendencies. In order to successfully installbcf-cffi
, I had to first install:After this, I was able to sucessfully
pip install bcj-cffi
.(The
alpine-sdk
package is effectively shorthand for "a reasonable C build environment".)The solution in my case was because I was using an "alpine" image on my DockerFile. Avoid to use alpine, in my case was causing problem with incompatibilities with my MacOs M1