Python 'manylinux' wheels
Python wheels are a mechanism for distributing Python packages. They can contain machine- (i.e. non Python-) code, which obviously is platform dependent but can also be specific distribution dependent. The manylinux standard is a way of minimising the dependence on the Linux distribution.
Key documents on this are available here:
-
Demo of how to build manylinux wheels https://github.com/pypa/python-manylinux-demo/blob/master/travis/build-wheels.sh
Here are some of my own notes:
-
Compilation is against an old ABI of libc and using an old C++ ABI. This provides for maximum forward compatibility
-
Typically the wheels are built in a docker container with the an old distribution image (CentOS 5 and more lately 6), and then copied out and used outside the container. Example is referenced above.
-
Shared library dependencies are dealt with by distributing them with the wheel itself. There is an excellent automated tool to do this,
auditwheel
which recursively searches for shared library dependencies and uses$ORIGIN
andpatchelf
to rewrite the shared library dependencies so that they are easily found by the resultant Python wheel when installed. -
If
auditwheel
can not find a dependent library, add it to theLD_LIBRARY_PATH
environment variable.