Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Clarify that pip wheels are incompatible with alpine-based images #904

Closed
smallnamespace opened this issue May 11, 2017 · 5 comments
Closed

Comments

@smallnamespace
Copy link

smallnamespace commented May 11, 2017

The current README.md uses the generic language for other images:

This variant is highly recommended when final image size being as small as possible is desired. The main caveat to note is that it does use musl libc instead of glibc and friends, so certain software might run into issues depending on the depth of their libc requirements. However, most software doesn't have an issue with this, so this variant is usually a very safe choice.

However, for Python specifically, manylinux wheels are incompatible with MUSL, so any docker images that end up pulling native dependencies via pip will likely end up having to build from source (see pypa/manylinux#37). For a popular library like pandas, this is the difference between a 1-minute and a 20-minute build time.

This seems like a significant downside to a Python docker image, and probably should be noted in the documentation.

@stefansedich
Copy link

+1 we are just spinning up some of our Python services into docker and I have since run into this, I attempted to take the route I used for our minimal Ruby containers but soon ran into issues, for now I have moved to 3.5-slim and will eat the larger images but it would be great to seem some compatible manylinux wheels that work with alpine and better clarification in the docs around the caveats.

@tao12345666333
Copy link

In addition, if you pay attention to performance, please check this page http://moelove.info/docker-python-perf/ to see the performance results.

The code is here https://github.com/tao12345666333/docker-python-perf. And the pipeline run every week.

macbre added a commit to Wikia/Mike that referenced this issue Feb 6, 2019
It takes some time to build lxml and alpine is not compatible with Python wheels.

docker-library/docs#904

Image size is bigger, but the build time is under reasonable limits.

REPOSITORY                                      TAG                 IMAGE ID            CREATED             SIZE
mike                                            latest              90628b250c16        57 seconds ago      314MB
vs
macbre/mike                                     latest              9cb9746db092        13 hours ago        177MB
@andelf
Copy link

andelf commented Oct 19, 2019

echo "manylinux1_compatible = True" > $PYTHON_PATH/_manylinux.py

huddlej added a commit to nextstrain/docker-base that referenced this issue Mar 4, 2020
Alpine Linux uses musl libc instead of glibc which means it cannot use most
pre-built Python wheels for glibc-based Linux distributions [1]. As a result, Python
packages need to be built from source, leading to longer build times and
increased complexity in the Dockerfile for more complex packages. For complex
packages like opencv-python, building from source is especially non-trivial.

This commit ports the existing Alpine-based Dockerfile to a minimal Debian-based
file with pre-installed Python 3 (the official Python Docker image) and removes
dependencies that were originally required to build Python packages from
sources (e.g., cvxopt) where installation from a wheel is now possible.

This commit also removes all explicit references to Python 2 dependencies, as
fauna is compatible enough with Python 3 for downloading to work and sacra is
not actively under development.

[1] docker-library/docs#904
huddlej added a commit to nextstrain/docker-base that referenced this issue Mar 4, 2020
Alpine Linux uses musl libc instead of glibc which means it cannot use most
pre-built Python wheels for glibc-based Linux distributions [1]. As a result, Python
packages need to be built from source, leading to longer build times and
increased complexity in the Dockerfile for more complex packages. For complex
packages like opencv-python, building from source is especially non-trivial.

This commit ports the existing Alpine-based Dockerfile to a minimal Debian-based
file with pre-installed Python 3 (the official Python Docker image) and removes
dependencies that were originally required to build Python packages from
sources (e.g., cvxopt) where installation from a wheel is now possible.

This commit also removes all explicit references to Python 2 dependencies, as
fauna is compatible enough with Python 3 for downloading to work and sacra is
not actively under development.

[1] docker-library/docs#904
tsibley pushed a commit to nextstrain/docker-base that referenced this issue Jan 15, 2021
Alpine Linux uses musl libc instead of glibc which means it cannot use most
pre-built Python wheels for glibc-based Linux distributions [1]. As a result, Python
packages need to be built from source, leading to longer build times and
increased complexity in the Dockerfile for more complex packages. For complex
packages like opencv-python, building from source is especially non-trivial.

This commit ports the existing Alpine-based Dockerfile to a minimal Debian-based
file with pre-installed Python 3 (the official Python Docker image) and removes
dependencies that were originally required to build Python packages from
sources (e.g., cvxopt) where installation from a wheel is now possible.

This commit also removes all explicit references to Python 2 dependencies, as
fauna is compatible enough with Python 3 for downloading to work and sacra was
previously removed.

[1] docker-library/docs#904
tsibley pushed a commit to nextstrain/docker-base that referenced this issue Jan 16, 2021
Alpine Linux uses musl libc instead of glibc which means it cannot use most
pre-built Python wheels for glibc-based Linux distributions [1]. As a result, Python
packages need to be built from source, leading to longer build times and
increased complexity in the Dockerfile for more complex packages. For complex
packages like opencv-python, building from source is especially non-trivial.

This commit ports the existing Alpine-based Dockerfile to a minimal Debian-based
file with pre-installed Python 3 (the official Python Docker image) and removes
dependencies that were originally required to build Python packages from
sources (e.g., cvxopt) where installation from a wheel is now possible.

This commit also removes all explicit references to Python 2 dependencies, as
fauna is compatible enough with Python 3 for downloading to work and sacra was
previously removed.

[1] docker-library/docs#904
tsibley pushed a commit to nextstrain/docker-base that referenced this issue Jan 20, 2021
Alpine Linux uses musl libc instead of glibc which means it cannot use most
pre-built Python wheels for glibc-based Linux distributions [1]. As a result, Python
packages need to be built from source, leading to longer build times and
increased complexity in the Dockerfile for more complex packages. For complex
packages like opencv-python, building from source is especially non-trivial.

This commit ports the existing Alpine-based Dockerfile to a minimal Debian-based
file with pre-installed Python 3 (the official Python Docker image) and removes
dependencies that were originally required to build Python packages from
sources (e.g., cvxopt) where installation from a wheel is now possible.

This commit also removes all explicit references to Python 2 dependencies, as
fauna is compatible enough with Python 3 for downloading to work and sacra was
previously removed.

[1] docker-library/docs#904
tsibley pushed a commit to nextstrain/docker-base that referenced this issue Feb 1, 2021
Alpine Linux uses musl libc instead of glibc which means it cannot use most
pre-built Python wheels for glibc-based Linux distributions [1]. As a result, Python
packages need to be built from source, leading to longer build times and
increased complexity in the Dockerfile for more complex packages. For complex
packages like opencv-python, building from source is especially non-trivial.

This commit ports the existing Alpine-based Dockerfile to a minimal Debian-based
file with pre-installed Python 3 (the official Python Docker image) and removes
dependencies that were originally required to build Python packages from
sources (e.g., cvxopt) where installation from a wheel is now possible.

This commit also removes all explicit references to Python 2 dependencies, as
fauna is compatible enough with Python 3 for downloading to work and sacra was
previously removed.

[1] docker-library/docs#904
@tianon
Copy link
Member

tianon commented Nov 5, 2021

This isn't necessarily fixed by #1885, but it's slightly more clear now IMO.

@tianon
Copy link
Member

tianon commented Feb 18, 2022

I think it's time we finally admit this is as fixed as it is probably going to be -- in the meantime, we got https://www.python.org/dev/peps/pep-0656/ which explicitly documents how to support wheels for musl, so the main concern should decrease over time as more libraries add musl wheels.

@tianon tianon closed this as completed Feb 18, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants