Problem
How can I install python3 and python3-pip without utilizing a python image on an alpine based image?
$ apk add --update python3.8 python3-pip
ERROR: unsatisfiable constraints:
python3-pip (missing):
required by: world[python3-pip]
python3.8 (missing):
required by: world[python3.8]
Asked by Cutaraca
Solution #1
In a Dockerfile for an Alpine image, I use the following:
# Install python/pip
ENV PYTHONUNBUFFERED=1
RUN apk add --update --no-cache python3 && ln -sf python3 /usr/bin/python
RUN python3 -m ensurepip
RUN pip3 install --no-cache --upgrade pip setuptools
Answered by Terry Spotts
Solution #2
Visit https://pkgs.alpinelinux.org/packages for further information. The python3 and py3-pip packages are what you’re looking for.
The following command would be appropriate to use inside a dockerfile/etc:
apk add --no-cache python3 py3-pip
The —no-cache flag is explained.
However, because py3-pip is not present on main, you must add the community repository.
Answered by Linus H.
Solution #3
Install py3-pip instead of python3-pip.
apk add --update python3 py3-pip
Answered by ali mirmohammadi
Solution #4
This command is worth a shot.
Answered by adobean
Solution #5
You can also use the official Python image, which includes alpine tags. You’ll almost certainly obtain the latest up-to-date Python installation:
e.g.:
FROM python:3-alpine
Answered by Vincent Pazeller
Post is based on https://stackoverflow.com/questions/62554991/how-do-i-install-python-on-alpine-linux