Error When Installing Python3 Packages In Alpine
I am currently building an image from alpine:3.7. There are two packages that I am having problems with: pendulum (specifically python-dateutils package) service_identity (specif
Solution 1:
I'm not sure about the full list of dev-packages to build in the question, but it should be the following: g++
(GNU C++ standard library and compiler), python3-dev
(python3 development files), libffi-dev
(libffi development files) and openssl-dev
(Toolkit for SSL v2/v3 and TLS v1 development files).
The Dockerfile
is:
FROM alpine:3.7
RUN apk add--no-cache --virtual .build-deps g++ python3-dev libffi-dev openssl-dev && \
apk add--no-cache --update python3 && \
pip3 install --upgrade pip setuptools
RUN pip3 install pendulum service_identity
Solution 2:
Apparently when upgrading pip with:
pip3 install --upgrade pip setuptools
I removed pip upgrading and installation worked. Now, I have been researching the correct way to upgrade pip on alpine and found a Dockerfile in a github repo that does this check:
if [ ! -e /usr/bin/pip ]; thenln -s pip3 /usr/bin/pip ; fi && \
if [[ ! -e /usr/bin/python ]]; thenln -sf /usr/bin/python3 /usr/bin/python; fi && \
Which makes sure that pip3 is being referred when calling just pip command by doing a symbolic link on python and system binaries' directories.
Post a Comment for "Error When Installing Python3 Packages In Alpine"