alpine package py-pip missing
DockerDockerfileAlpineDocker Problem Overview
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
Docker Solutions
Solution 1 - Docker
Do update
first:
apk add --update py-pip
Or:
apk update
apk add py-pip
Solution 2 - Docker
For python3 on alpine edge:
apk add py3-setuptools
Solution 3 - Docker
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
Solution 4 - Docker
For me --no-cache
option worked.
> apk add --no-cache py-pip
Solution 5 - Docker
I've found the following:
$ apk add --update py3-pip
Solution 6 - Docker
This worked for me:
curl https://bootstrap.pypa.io/pip/2.7/get-pip.py -o get-pip.py && python get-pip.py
Solution 7 - Docker
The command '/bin/sh -c pip install django-mass-edit && pip install django-admin-list-filter-dropdown && pip install SQLAlchemy && pip
Solution 8 - Docker
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.
Solution 9 - Docker
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