Docker Alpine Linux python (missing)
From this issue on the Docker's repo:
This was "broken" while updating our base from
alpine:3.11
toalpine:3.12
.
In order to fix it you need to specify the version of Python directly, e.g.:
apk add python2
// or
apk add python3
Try this command:
apk add --update --no-cache curl py-pip
It will install python3
automatically with pip.
My understanding is that Python 2 has been decommissioned from the latest Alpine packages.
For future readers:
I got a similar error with node:14-alpine
ERROR: unable to select packages:
python2 (no such package):
required by: world[python2]
But I couldn't use the other answers listed in this question because I needed exactly python2
and running apk add python2
was giving me the error above.
After a while I realized that in the latest alpine version, there's only python3
(there's no python2).
So the solution was to use an older version of alpine that have python2
(alpine v3.15).
So the fix was changing node:14-alpine
to node:14-alpine3.15
I know this isn't the exact same error, but while trying to find an answer for my error, I always ended up here, so I'm leaving this for future readers that might have the same problem.
I've fix following this https://gitlab.alpinelinux.org/alpine/aports/-/issues/11605
Updating your code to install python3:
before_script:
- apk add --update --no-cache curl jq py3-configobj py3-pip py3-setuptools python3 python3-dev