DEV Community

Cover image for What is manylinux?
icncsx
icncsx

Posted on

What is manylinux?

Why Python packaging can be hard

There may be a time in your development career where you need to author a package that extends Python w/ C or C++. In such a case your Python package needs to go through a compilation process, which converts C or C++ to binaries that work for a specific target system. This becomes really tedious when you think about how many flavors and versions of Linux there are. Building a separate binary for Red Hat, SUSE, Ubuntu, etc... Ugh so tiring.

Why Python packaging can be easy w/ manylinux

Fortunately, there is a solution. manylinux was birthed to make it easy for your Python packages to be compatible with most Linux variants. manylinux takes advantage of the fact that most distributions are mindful of backwards compatibility, and intentionally builds bdist wheels on an old version of a distribution. The idea is that if we build on an old supported version, the binaries produced are compatible with current versions.

So what is a manylinux really? Is it a ham sandwich?

No. Even better. It's a Docker image. manylinux is a Docker image built off a certain old versions of the CentOS operating system that comes bundled with libraries that are assumed to be present by default on almost all Linux systems.

You can find an example of manylinux distributions within the pandas project. Here are two (out of many) from the list of available pandas downloads from PyPI:

pandas-1.0.3-cp37-cp37m-manylinux1_x86_64.whl
pandas-1.0.3-cp37-cp37m-manylinux1_i686.whl
Enter fullscreen mode Exit fullscreen mode

In this case, pandas has built manylinux wheels for CPython 3.7 supporting both x86-64 and i686 architectures. It's manylinux so this wheel should be compatible for many linux :)

Happy packaging!

Top comments (1)

Collapse
 
arvindpdmn profile image
Arvind Padmanabhan

Interesting. Good to know.