docker-alpine icon indicating copy to clipboard operation
docker-alpine copied to clipboard

Errors when installing python packages using alpine:3.11 tag

Open cpitstick-argo opened this issue 4 years ago • 8 comments

Docker script:

FROM alpine:3.11

RUN set -x &&
         apk -v --update add --no-cache \
             jq \
             python3 \
             py3-pip \
             curl \
             ca-certificates

Results in

+ apk -v --update add --no-cache jq python3 py3-pip curl ca-certificates
fetch http://dl-cdn.alpinelinux.org/alpine/v3.11/main/x86_64/APKINDEX.tar.gz
WARNING: Ignoring http://dl-cdn.alpinelinux.org/alpine/v3.11/main/x86_64/APKINDEX.tar.gz: temporary error (try again later)
fetch http://dl-cdn.alpinelinux.org/alpine/v3.11/community/x86_64/APKINDEX.tar.gz
WARNING: Ignoring http://dl-cdn.alpinelinux.org/alpine/v3.11/community/x86_64/APKINDEX.tar.gz: temporary error (try again later)
ERROR: unsatisfiable constraints:
  ca-certificates (missing):
    required by: world[ca-certificates]
  curl (missing):
    required by: world[curl]
  jq (missing):
    required by: world[jq]
  py3-pip (missing):
    required by: world[py3-pip]
  python3 (missing):
    required by: world[python3]

However, if I switch the image to 3.11.6, it works fine...

What's going on here? 3.11 used to work, and we'd prefer to keep that tag for image stability purposes.

cpitstick-argo avatar May 21 '20 16:05 cpitstick-argo

FROM alpine:3

RUN  apk --no-cache add \
                        curl \
                        libintl \
                        python3-dev \
                        libsodium-dev \
                        openssl-dev \
                        udns-dev \
                        mbedtls-dev \
                        pcre-dev \
                        libev-dev \
                        libtool \
                        libffi-dev            && \
     apk --no-cache add --virtual .build-deps \
                        tar \
                        make \
                        gettext \
                        py3-pip \
                        autoconf \
                        automake \
                        build-base \
                        linux-headers         && \
     ln -s /usr/bin/python3 /usr/bin/python  && \
     ln -s /usr/bin/pip3    /usr/bin/pip     && \
     cp  /usr/bin/envsubst  /usr/local/bin/   && \
     pip install --upgrade pip                && \
     pip install -r requirements.txt          && \
     rm -rf ~/.cache && touch /etc/hosts.deny && \
     apk del --purge .build-deps

"ln -s /usr/bin/pip3 /usr/bin/pip"This line will report an error, it can be build a day ago

lvillis avatar May 30 '20 16:05 lvillis

@cpitstick-argo your provided Dockerfile works fine on my end, maybe 3.11 is stable again ? @sudoii I have what maybe a similar issue with the following Dockerfile:

FROM alpine:3.12

RUN  apk --no-cache add python

Producing:

ERROR: unsatisfiable constraints:
  python (missing):
    required by: world[python]
The command '/bin/sh -c apk --no-cache add python' returned a non-zero code: 1

Current fix: Staying in 3.11 works fine, so fixing both major and minor does the trick

I wonder if the issue is linked to https://github.com/pypa/packaging/issues/308

nbrohee avatar Jun 02 '20 17:06 nbrohee

Nope still seeing this.

cpitstick-argo avatar Jun 02 '20 17:06 cpitstick-argo

FROM alpine3.12 works fine for me, however.

cpitstick-argo avatar Jun 02 '20 17:06 cpitstick-argo

@cpitstick-argo yeah, I have no issue with your provided Dockerfile for 3.12, 3.11 succeed too but seems to silently skip pip3 install:

Sending build context to Docker daemon  3.072kB

Step 1/2 : FROM alpine:3.11
 ---> f70734b6a266
Step 2/2 : RUN set -x &&          apk -v --update add --no-cache              jq              python3              py3-pip              curl              ca-certificates
 ---> Running in f8af0f40185a
[91m+ apk -v --update add --no-cache jq python3 py3-pip curl ca-certificates
[0mfetch http://dl-cdn.alpinelinux.org/alpine/v3.11/main/x86_64/APKINDEX.tar.gz
fetch http://dl-cdn.alpinelinux.org/alpine/v3.11/community/x86_64/APKINDEX.tar.gz
(1/16) Installing ca-certificates (20191127-r1)
(2/16) Installing nghttp2-libs (1.40.0-r0)
(3/16) Installing libcurl (7.67.0-r0)
(4/16) Installing curl (7.67.0-r0)
(5/16) Installing oniguruma (6.9.4-r0)
(6/16) Installing jq (1.6-r0)
(7/16) Installing libbz2 (1.0.8-r1)
(8/16) Installing expat (2.2.9-r1)
(9/16) Installing libffi (3.2.1-r6)
(10/16) Installing gdbm (1.13-r1)
(11/16) Installing xz-libs (5.2.4-r0)
(12/16) Installing ncurses-terminfo-base (6.1_p20200118-r4)
(13/16) Installing ncurses-libs (6.1_p20200118-r4)
(14/16) Installing readline (8.0.1-r0)
(15/16) Installing sqlite-libs (3.30.1-r2)
(16/16) Installing python3 (3.8.2-r0)
Executing busybox-1.31.1-r9.trigger
Executing ca-certificates-20191127-r1.trigger
OK: 30 packages, 305 dirs, 3784 files, 67 MiB
Removing intermediate container f8af0f40185a
 ---> 63a7c5a902d8
Successfully built 63a7c5a902d8

in 3.12

Sending build context to Docker daemon  3.072kB

Step 1/2 : FROM alpine:3.12
 ---> a24bb4013296
Step 2/2 : RUN set -x &&          apk -v --update add --no-cache              jq              python3              py3-pip              curl              ca-certificates
 ---> Running in bb45bda63c31
[91m+ apk -v --update add --no-cache jq python3 py3-pip curl ca-certificates
[0mfetch 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
(1/42) Installing ca-certificates (20191127-r2)
(2/42) Installing nghttp2-libs (1.40.0-r0)
(3/42) Installing libcurl (7.69.1-r0)
(4/42) Installing curl (7.69.1-r0)
(5/42) Installing oniguruma (6.9.5-r1)
(6/42) Installing jq (1.6-r1)
(7/42) Installing libbz2 (1.0.8-r1)
(8/42) Installing expat (2.2.9-r1)
(9/42) Installing libffi (3.3-r2)
(10/42) Installing gdbm (1.13-r1)
(11/42) Installing xz-libs (5.2.5-r0)
(12/42) Installing ncurses-terminfo-base (6.2_p20200523-r0)
(13/42) Installing ncurses-libs (6.2_p20200523-r0)
(14/42) Installing readline (8.0.4-r0)
(15/42) Installing sqlite-libs (3.32.1-r0)
(16/42) Installing python3 (3.8.3-r0)
(17/42) Installing py3-appdirs (1.4.4-r1)
(18/42) Installing py3-ordered-set (4.0.1-r0)
(19/42) Installing py3-parsing (2.4.7-r0)
(20/42) Installing py3-six (1.15.0-r0)
(21/42) Installing py3-packaging (20.4-r0)
(22/42) Installing py3-setuptools (47.0.0-r0)
(23/42) Installing py3-chardet (3.0.4-r4)
(24/42) Installing py3-idna (2.9-r0)
(25/42) Installing py3-certifi (2020.4.5.1-r0)
(26/42) Installing py3-urllib3 (1.25.9-r0)
(27/42) Installing py3-requests (2.23.0-r0)
(28/42) Installing py3-msgpack (1.0.0-r0)
(29/42) Installing py3-lockfile (0.12.2-r3)
(30/42) Installing py3-cachecontrol (0.12.6-r0)
(31/42) Installing py3-colorama (0.4.3-r0)
(32/42) Installing py3-distlib (0.3.0-r0)
(33/42) Installing py3-distro (1.5.0-r1)
(34/42) Installing py3-webencodings (0.5.1-r3)
(35/42) Installing py3-html5lib (1.0.1-r4)
(36/42) Installing py3-pytoml (0.1.21-r0)
(37/42) Installing py3-pep517 (0.8.2-r0)
(38/42) Installing py3-progress (1.5-r0)
(39/42) Installing py3-toml (0.10.1-r0)
(40/42) Installing py3-retrying (1.3.3-r0)
(41/42) Installing py3-contextlib2 (0.6.0-r0)
(42/42) Installing py3-pip (20.1.1-r0)
Executing busybox-1.31.1-r16.trigger
Executing ca-certificates-20191127-r2.trigger
OK: 56 packages, 323 dirs, 3952 files, 68 MiB
Removing intermediate container bb45bda63c31
 ---> 93c0c489a90d
Successfully built 93c0c489a90d

nbrohee avatar Jun 02 '20 17:06 nbrohee

The silent skipping of the pip install for 3.11 is the problem.

cpitstick-argo avatar Jun 02 '20 22:06 cpitstick-argo

Maybe docker pull alpine:3.11 helps? I am not able to reproduce:

$ docker run --rm -it alpine:3.11 apk -v --update add --no-cache jq python3 py3-pip curl ca-certificates
fetch http://dl-cdn.alpinelinux.org/alpine/v3.11/main/x86_64/APKINDEX.tar.gz
fetch http://dl-cdn.alpinelinux.org/alpine/v3.11/community/x86_64/APKINDEX.tar.gz
(1/16) Installing ca-certificates (20191127-r2)
(2/16) Installing nghttp2-libs (1.40.0-r1)
(3/16) Installing libcurl (7.67.0-r0)
(4/16) Installing curl (7.67.0-r0)
(5/16) Installing oniguruma (6.9.4-r0)
(6/16) Installing jq (1.6-r0)
(7/16) Installing libbz2 (1.0.8-r1)
(8/16) Installing expat (2.2.9-r1)
(9/16) Installing libffi (3.2.1-r6)
(10/16) Installing gdbm (1.13-r1)
(11/16) Installing xz-libs (5.2.4-r0)
(12/16) Installing ncurses-terminfo-base (6.1_p20200118-r4)
(13/16) Installing ncurses-libs (6.1_p20200118-r4)
(14/16) Installing readline (8.0.1-r0)
(15/16) Installing sqlite-libs (3.30.1-r2)
(16/16) Installing python3 (3.8.2-r0)
Executing busybox-1.31.1-r9.trigger
Executing ca-certificates-20191127-r2.trigger
OK: 30 packages, 305 dirs, 3783 files, 67 MiB

The silent skipping of the pip install for 3.11 is the problem.

It is not silently skipped. python3 provides py3-pip so apk add py3-pip will install python3

$ docker run --rm -it alpine:3.11 sh -c "apk update -q && apk info --provides python3"
python3-3.8.2-r0 provides:
py3-pip
...

ncopa avatar Jun 09 '20 09:06 ncopa

...

ERROR: unsatisfiable constraints:
  python (missing):
    required by: world[python]
The command '/bin/sh -c apk --no-cache add python' returned a non-zero code: 1

This is because we've stopped providing the python package for 3.12: http://dup.pw/alpine/aports/5ad0ec7d

Please explicitly install python2 if you still need python2, or install python3 if you need python3

Cogitri avatar Jun 09 '20 09:06 Cogitri