News for hackers. Stuff that matters.
Re:Alpine makes Python Docker builds slower, and images larger by mumblemumble on Wednesday January 29, 2020 @02:55PM (#22185079)
You've got it. Wheels in Python are like gems in ruby. (Or eggs in [python minus a few years].) The official Python package index has binary images, but they're compiled against glibc, and therefore don't work with Alpine. So when you `pip install` a package with binary dependencies on Alpine, it needs to compile them. Which can lead to a bit of a trip down a rabbit hole.

As others have mentioned, Alpine's repository does include Alpine-compatible binary versions of many popular Python packages. So you can often save yourself a lot of trouble by using apk instead of pip to get those.

Re:Alpine makes Python Docker builds slower, and images larger by oefrha on Wednesday January 29, 2020 @03:17PM (#22185320)
> The official Python package index has binary images, but they're compiled against glibc, and therefore don't work with Alpine.

That’s a false statement (depending on interpretation). Whether a PyPI package has wheels is entirely at the discretion of the package maintainer, who is responsible for compiling all source and binary distributions; PyPI does not compile anything and only accepts uploads, verbatim. If the maintainer doesn’t upload wheels or doesn’t upload wheels for your platform, then no wheels for you (not from PyPI). In general compiling statically linked wheels (when you have C extensions and external dependencies) is a fairly involved process.

At the moment there are six platform tags for Linux wheels supported by PyPI: manylinux{1,2010,2014}_{x86_64,i686}. Each is based on a CentOS release with very old glibc. See

https://github.com/pypa/manylinux

PEP 513 - maynylinux1 https://www.python.org/dev/peps/pep-0513/

PEP 571 - manylinux2010 https://www.python.org/dev/peps/pep-0571/

PEP 599 - manylinux2014 https://www.python.org/dev/peps/pep-0599/