Docker Alpine Linux python (missing)

一笑奈何 提交于 2020-06-22 14:14:20

问题


EDIT: To fix it you need to specify the version of Python directly, e.g.:

apk add python2
apk add python3

I have a pipeline which deploys my container from GitLab. Last deployment was 5 days ago and went without any problems. Today I deploy it and get the following error:

$ apk add --no-cache curl python py-pip
 fetch http://dl-cdn.alpinelinux.org/alpine/v3.12/main/x86_64/APKINDEX.tar.gz
 fetch http://dl-cdn.alpinelinux.org/alpine/v3.12/community/x86_64/APKINDEX.tar.gz
 ERROR: unsatisfiable constraints:
   python (missing):
     required by: world[python]

My job definition is:

my-deploy:
  type: my-deploy
  image: docker:stable
  script:
    - apk update
    - apk add --no-cache curl python py-pip <-- Here the erorr happens
    ...

Edit: I also opened an issue on Docker (https://github.com/docker-library/docker/issues/240).

From there: This was "broken" while updating our base from alpine:3.11 to alpine:3.12


回答1:


Could you try this command?

apk add --update --no-cache curl py-pip

It will install python3 automatically with pip.

My understanding is, python (version 2) has been decommissioned from latest alpine packages.




回答2:


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


来源:https://stackoverflow.com/questions/62169568/docker-alpine-linux-python-missing

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!