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
...
From this issue on the Docker's repo:
This was "broken" while updating our base from alpine:3.11 to alpine: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
What solved it for me is this solution posted on GitHub.
RUN echo -e "http://nl.alpinelinux.org/alpine/v3.5/main\nhttp://nl.alpinelinux.org/alpine/v3.5/community" > /etc/apk/repositories
Related
'Sup fam, I'm trying to build a site using GetTogether and I'm following the instructions herein: https://github.com/GetTogetherComm/GetTogether
Everything has went okay so far; I had to use python3 -m for some of the python commands, but other than that the build went fine.
Then I tried to build the Docker image.
It does not want to build the Docker image.
This is what happens when I try to build the Docker image:
Sending build context to Docker daemon 74.93MB
Step 1/19 : FROM python:3-alpine as builder
---> 872c3118ec53
Step 2/19 : WORKDIR /home/python
---> Using cache
---> 203fb3a9909b
Step 3/19 : RUN apk add --no-cache zlib-dev build-base python-dev jpeg-dev
---> Running in 87f4f8436424
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-dev (missing):
required by: world[python-dev]
The command '/bin/sh -c apk add --no-cache zlib-dev build-base python-dev jpeg-dev' returned a non-zero code: 1
I tried everything. I tried Googling for these supposed missing packages. I tried bribery. I tried singing gentle lullabies to it and rubbing its back. I even gave it some of my weed. Nothing makes it work. NOTHING.
Please help. For my sanity. For my weed stash.
Use python3-dev instead of python-dev found here
I'm in an alpine linux docker container, and I'm trying to install py3-scipy. Here is info on that package: https://pkgs.alpinelinux.org/package/edge/community/x86/py3-scipy. I want to do this because pip install scipy takes way too long.
Here is what I get:
/ # apk add py3-scipy
ERROR: unsatisfiable constraints:
py3-scipy (missing):
required by: world[py3-scipy]
My Dockerfile:
FROM alpine:3.9
RUN apk add --update python3-dev g++ gcc libxslt-dev cython lapack-dev gfortran build-base py3-scipy
What is causing this error?
I think this issue sometimes happen when alpine moves a package from edge/testing to edge/community so old versions of alpine will keep referring to the old url. So you need to try to use the latest alpine version alpine:latest instead of a specific version.
I was missing the echo step, with that I was able to install it:
echo "#testing http://dl-cdn.alpinelinux.org/alpine/edge/testing" >> /etc/apk/repositories
apk add --update --no-cache py3-scipy
I'm trying to install git-lfs in a Docker alpine image, but I'm getting an error indicating:
ERROR: unsatisfiable constraints:
git-lfs (missing):
required by: world[git-lfs]
It seems that there has been many issues related to apk not finding packages (see here and there), and in many cases these have been solved by using the --no-cache option with apk add. But I am not being that lucky and cannot understand the origin of this error, specially considering that git-lfs is up to date in alpine repo.
The following small Dockerfile should reproduce the error:
FROM alpine:3.4
RUN apk update && apk add --no-cache \
build-base \
git \
git-lfs
The problem is that git-lfs is available only from alpine:3.7.
To fix the issue you should either rebuild it on your own or use an alpine version >=3.7.
Btw, you don't need to execute apk update.
My Dckerfile
FROM python:3.7-alpine
ADD requirements.txt /code/requirements.txt
RUN apk --no-cache add --virtual build-dependencies \
build-base \
py-mysqldb \
gcc \
libc-dev \
libffi-dev \
mariadb-dev \
&& pip install -r /code/requirements.txt \
&& rm -rf .cache/pip \
&& apk del build-dependencies
RUN apk -q --no-cache add mariadb-client-libs
COPY . /code
...
I am able to build the image locally.
But when google (cloud build) tries to build the image I get the following error:
...
(28/28) Purging python2 (2.7.15-r0)
Executing busybox-1.28.4-r0.trigger
OK: 17 MiB in 34 packages
Removing intermediate container bc1fb0b1da92
---> bf2c564de5a5
Step 4/7 : RUN apk -q --no-cache add mariadb-client-libs
---> Running in 9c4fcad1f632
ERROR: unsatisfiable constraints:
**mariadb-client-libs (missing):**
required by: world[mariadb-client-libs]
The command '**/bin/sh -c apk -q --no-cache add mariadb-client-libs**' returned a non-zero code: 1
ERROR
ERROR: build step 0 "gcr.io/cloud-builders/docker" failed: exit status 1
A quick search online suggested that the repo could be offline, but I doubt that's the case. It seems Google Cloud build is blocking the access to the repo. Anyone else run into this issue? Any pointers on how to fix this?
On #helado's suggestion, I'm posting my comment from above as the answer:
#helado: I hesitated from posting this as the answer as its a solution that bypasses the problem. But i think the more important point is an issue like this should'nt stop folks from making progress :)
---- Copy pasted comment from above ----
It works for me when I try to build it locally, but fails on google
cloud. Also, its not the correct way to solve the problem, but I
switched my dependency form mariadb-client-libs to py-mysqldb and
all is working now. Just in case it helps you :)
Im trying to install python pip in my alpine using Docker compose file but get the following error.
ERROR: unsatisfiable constraints:
py-pip (missing):
required by: world[py-pip]
ERROR: Service 'web' failed to build: The command '/bin/sh -c apk add py-pip' returned a non-zero code: 1
Do update first:
apk add --update py-pip
Or:
apk update
apk add py-pip
For python3 on alpine edge:
apk add py3-setuptools
You have to use appropriate pip version depending on Alpine branch:
Alpine v3.12 or newer, use apk add --update py3-pip
Alpine v3.5 - v3.11, use apk add --update py2-pip
Alpine v3.3 - v3.4, use apk add --update py-pip
For me --no-cache option worked.
apk add --no-cache py-pip
I've found the following:
$ apk add --update py3-pip
AlpineWSL 3.14.0 | Last commands is a solution, info from ircs://irc.oftc.net/alpine-linux
apk update
apk upgrade
apk add python2
python -m ensurepip --upgrade
Example
pip install -r requirements.txt
DEPRECATION: Python 2.7 will reach the end of its life on January 1st, 2020. Please upgrade your Python as Python 2.7 won't be maintained after that date. A future version of pip will drop support for Python 2.7. More details about Python 2 support in pip, can be found at https://pip.pypa.io/en/latest/development/release-process/#python-2-support
...
Successfully installed certifi-2021.10.8 chardet-4.0.0 idna-2.10 requests-2.26.0 urllib3-1.26.7
WARNING: You are using pip version 19.2.3, however version 20.3.4 is available.
You should consider upgrading via the 'pip install --upgrade pip' command.
Following command in the console should work with any linux distro:
python -m ensurepip --upgrade
Tested succesfully with Alpine v3.17 the VM edition. More details here.
This worked for me:
curl https://bootstrap.pypa.io/pip/2.7/get-pip.py -o get-pip.py && python get-pip.py
You need to modify your repository:
Modify the file /etc/apk/repositories
Add the repository community
g.e.:
/media/mmcblk0p1/apks
http://alpine.42.fr/v3.14/main
http://alpine.42.fr/v3.14/community
For me, the server used is http://alpine.42.fr, but you can use another server
Don't forget to commit your change if you want to have this configuration permanently
lbu commit -d
The command '/bin/sh -c pip install django-mass-edit && pip install django-admin-list-filter-dropdown && pip install SQLAlchemy && pip