loading...
Cover image for How to Solve: "ERROR: unsatisfiable constraints (python)"

How to Solve: "ERROR: unsatisfiable constraints (python)"

gustavorglima profile image Gustavo Lima ・1 min read

When try to install python2:

apk add --update --no-cache build-base python2-dev libffi-dev libressl-dev bash python git gettext curl

Get this Error:

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]

To solve change python and python2 to python3, E.g.:

RUN apk add --update --no-cache build-base python3-dev python3 libffi-dev libressl-dev bash git gettext curl \
 && curl -O https://bootstrap.pypa.io/get-pip.py \
 && python3 get-pip.py \
 && pip install --upgrade six awscli awsebcli

Discussion

pic
Editor guide
Collapse
adeyemitj profile image
Adeyemi Taiwo

Nice tutorial, weldone!
Please i have a similar problem but my own case is on postgresql-client. see below:

WARNING: Ignoring dl-cdn.alpinelinux.org/alpine/v3.1... temporary error (try again later)
WARNING: Ignoring dl-cdn.alpinelinux.org/alpine/v3.1... temporary error (try again later)
ERROR: unsatisfiable constraints:
postgresql-client (missing):
required by: world[postgresql-client]

Please, how can you be of help.
Thanks.

Collapse
dvsingh9 profile image
DV Singh

apk add --no-cache curl jq python3 py3-pip

Collapse
vickvasquez profile image
Vick Vasquez

Thanks man 😃

Collapse
xiemenger profile image
Dian xx

I still need python2 in short term. Is it possible to install python2 in alpine using any other methods?

Collapse
mrosata profile image
Michael Rosata

replacing python-dev with python2-dev should still work. You can try the install by running apk add python2-dev inside an alpine:edge container

docker run --rm -ti alpine:edge sh           
/ # apk add python2-dev
fetch http://dl-cdn.alpinelinux.org/alpine/edge/main/x86_64/APKINDEX.tar.gz
fetch http://dl-cdn.alpinelinux.org/alpine/edge/community/x86_64/APKINDEX.tar.gz
(1/11) Installing pkgconf (1.7.3-r0)
(2/11) Installing libbz2 (1.0.8-r1)
(3/11) Installing expat (2.2.9-r1)
(4/11) Installing libffi (3.3-r2)
(5/11) Installing gdbm (1.13-r1)
(6/11) Installing ncurses-terminfo-base (6.2_p20200613-r0)
(7/11) Installing ncurses-libs (6.2_p20200613-r0)
(8/11) Installing readline (8.0.4-r0)
(9/11) Installing sqlite-libs (3.32.2-r0)
(10/11) Installing python2 (2.7.18-r0)
(11/11) Installing python2-dev (2.7.18-r0)
Executing busybox-1.31.1-r14.trigger
OK: 58 MiB in 25 packages
Collapse
gustavorglima profile image
Gustavo Lima Author

I didn’t find another method... Sorry.

Collapse
vekmaster profile image
Kevin D. Agudelo Gallego

Hey bro, excellent, I solved my issue in my CI

Thanks

Collapse
gustavorglima profile image
Collapse
jnsmit profile image
Jaco Smit

Thank you, you solved this non-dev's problem too.

Collapse
franceso_8 profile image
Francesco

thanks man, you saved the day!