Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Can't install Python package on Alpine Docker anymore [duplicate]

I have a problem that started very recently. The Docker Alpine Python library is not installable any more:

apk update && apk upgrade && apk add python
fetch https://dl-cdn.alpinelinux.org/alpine/v3.14/main/x86_64/APKINDEX.tar.gz
fetch https://dl-cdn.alpinelinux.org/alpine/v3.14/community/x86_64/APKINDEX.tar.gz
v3.14.2-119-g9c4e1aa60c [https://dl-cdn.alpinelinux.org/alpine/v3.14/main]
v3.14.2-120-g90167408c8 [https://dl-cdn.alpinelinux.org/alpine/v3.14/community]
OK: 14943 distinct packages available
(1/1) Upgrading alpine-keys (2.3-r1 -> 2.4-r0)
  0%                                               2% #                                             5% ##                                            7% ###                                          10% ####                                         12% #####                                        15% ######                                       17% #######                                      20% #########                                    23% ##########                                   25% ###########                                  28% ############                                 30% #############                                33% ##############                               35% ###############                              38% ################                             41% ##################                           43% ###################                          46% ####################                         48% #####################                        51% ######################                       53% #######################                     % ############################################OK: 7 MiB in 16 packages
ERROR: unable to select packages:
  python (no such package):
    required by: world[python]

Exited with code exit status 1
like image 339
Tv Dev Avatar asked Nov 05 '21 23:11

Tv Dev


People also ask

Does Docker alpine have Python?

Need to ship quickly, and don't have time to figure out every detail on your own? Read the concise, action-oriented Python on Docker Production Handbook. As promised, Alpine images build faster and are smaller: 15 seconds instead of 30 seconds, and the image is 105MB instead of 150MB.

Does alpine come with Python?

Alpine Linux doesn't come with Python3 pre-installed. You have to install it manually. It's very simple to do with the alpine package manager, apk .

Should I use alpine for Docker?

Alpine Linux won't always be the right OS choice for IT teams, but it's an option worth consideration when lightweight container images are the goal. When it comes to Docker, sometimes less is more -- a maxim that applies especially to the base OS images installed in each Docker image.


1 Answers

You are trying to use the python (alias) library instead of python3.

Try to use apk update && apk upgrade && apk add python3 instead.

like image 154
Idan Gozlan Avatar answered Oct 23 '22 10:10

Idan Gozlan