close
Skip to main content

Cross-distribution Linux wheels

Project description

https://travis-ci.org/pypa/auditwheel.svg?branch=main https://badge.fury.io/py/auditwheel.svg https://pepy.tech/badge/auditwheel/month

Auditing and relabeling of Linux and Android wheels.

Overview

auditwheel is a command line tool to facilitate the creation of Python wheel packages (containing pre-compiled binary extensions) that are compatible with a wide variety of distributions, consistent with the PEP 600 manylinux_x_y, PEP 513 manylinux1, PEP 571 manylinux2010, PEP 599 manylinux2014 and PEP 738 android platform tags.

auditwheel show: shows external shared libraries that the wheel depends on (beyond the libraries included in the manylinux policies), and checks the extension modules for the use of versioned symbols that exceed the manylinux ABI.

auditwheel repair: copies these external shared libraries into the wheel itself, and automatically modifies the appropriate RPATH entries such that these libraries will be picked up at runtime. This accomplishes a similar result as if the libraries had been statically linked without requiring changes to the build system. Packagers are advised that bundling, like static linking, may implicate copyright concerns.

Requirements

  • OS: Linux (for Android wheels, macOS may also be used)

  • Python: 3.10+

  • patchelf: 0.14+

Only systems that use ELF-based linkage are supported (this should be essentially every Linux).

In general, building manylinux1 wheels requires running on a CentOS5 machine, building manylinux2010 wheels requires running on a CentOS6 machine, and building manylinux2014 wheels requires running on a CentOS7 machine, so we recommend using the pre-built manylinux Docker images, e.g.

$ docker run -i -t -v `pwd`:/io quay.io/pypa/manylinux_2_28_x86_64 /bin/bash

Installation

auditwheel can be installed using pip:

$ pip3 install auditwheel

Examples

Inspecting a wheel:

$ auditwheel show cffi-1.5.0-cp35-cp35m-linux_x86_64.whl

cffi-1.5.0-cp35-cp35m-linux_x86_64.whl is consistent with the
following platform tag: "linux_x86_64".

The wheel references the following external versioned symbols in
system-provided shared libraries: GLIBC_2.3.

The following external shared libraries are required by the wheel:
{
    "libc.so.6": "/lib64/libc-2.5.so",
    "libffi.so.5": "/usr/lib64/libffi.so.5.0.6",
    "libpthread.so.0": "/lib64/libpthread-2.5.so"
}

In order to achieve the tag platform tag "manylinux1_x86_64" the
following shared library dependencies will need to be eliminated:

libffi.so.5

Repairing a wheel.

$ auditwheel repair cffi-1.5.2-cp35-cp35m-linux_x86_64.whl
Repairing cffi-1.5.2-cp35-cp35m-linux_x86_64.whl
Grafting: /usr/lib64/libffi.so.5.0.6
Setting RPATH: _cffi_backend.cpython-35m-x86_64-linux-gnu.so to "$ORIGIN/.libs_cffi_backend"
Previous filename tags: linux_x86_64
New filename tags: manylinux1_x86_64
Previous WHEEL info tags: cp35-cp35m-linux_x86_64
New WHEEL info tags: cp35-cp35m-manylinux1_x86_64

Fixed-up wheel written to /wheelhouse/cffi-1.5.2-cp35-cp35m-manylinux1_x86_64.whl

Limitations

  1. auditwheel uses the DT_NEEDED information (like ldd) from the Python extension modules to determine which system libraries they depend on. Code that dynamically loads libraries at runtime using ctypes / cffi (from Python) or dlopen (from C/C++) doesn’t contain this information in a way that can be statically determined, so dependencies that are loaded via those mechanisms will be missed.

  2. There’s nothing we can do about “fixing” binaries if they were compiled and linked against a too-recent version of libc or libstdc++. These libraries (and some others) use symbol versioning for backward compatibility. In general, this means that code that was compiled against an old version of glibc will run fine on systems with a newer version of glibc, but code what was compiled on a new system won’t / might not run on older system.

    So, to compile widely-compatible binaries, you’re best off doing the build on an old Linux distribution, such as a manylinux Docker image.

Testing

The tests can be run with nox, which will automatically install test dependencies.

Some of the integration tests also require a running and accessible Docker daemon. These tests will pull a number of docker images if they are not already available on your system, but it won’t update existing images. To update these images manually, run:

docker pull python:3.10-slim-trixie
docker pull quay.io/pypa/manylinux2010_x86_64
docker pull quay.io/pypa/manylinux2014_x86_64
docker pull quay.io/pypa/manylinux_2_28_x86_64
docker pull quay.io/pypa/manylinux_2_34_x86_64
docker pull quay.io/pypa/musllinux_1_2_x86_64

You may also remove these images using docker rmi.

Code of Conduct

Everyone interacting in the auditwheel project’s codebases, issue trackers, chat rooms, and mailing lists is expected to follow the PSF Code of Conduct.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

auditwheel-6.7.0.tar.gz (4.7 MB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

auditwheel-6.7.0-py3-none-any.whl (62.3 kB view details)

Uploaded Python 3

File details

Details for the file auditwheel-6.7.0.tar.gz.

File metadata

  • Download URL: auditwheel-6.7.0.tar.gz
  • Upload date:
  • Size: 4.7 MB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.13

File hashes

Hashes for auditwheel-6.7.0.tar.gz
Algorithm Hash digest
SHA256 70aa4fe8e24d447e9fb47082f0aa0de2d6bde8aaa9bbfe517020328cea80e0f1
MD5 ece7a4e51376ed4862c74e92687e346b
BLAKE2b-256 f64d2684ff85bbc51d2acfe9d6184aea70e4f6a50d8de2de6cb41a23e501e4ef

See more details on using hashes here.

Provenance

The following attestation bundles were made for auditwheel-6.7.0.tar.gz:

Publisher: release.yml on pypa/auditwheel

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file auditwheel-6.7.0-py3-none-any.whl.

File metadata

  • Download URL: auditwheel-6.7.0-py3-none-any.whl
  • Upload date:
  • Size: 62.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.13

File hashes

Hashes for auditwheel-6.7.0-py3-none-any.whl
Algorithm Hash digest
SHA256 34e93e1b64ca54116fc110c3e975d3c884c4d47c87a590d42a89e4edf23e2af8
MD5 f4f6cfe92d1183810c00d1713a6d3747
BLAKE2b-256 17a02e7d17e36a3741a9aaf1a952ccff308d2078148d62327db180f94979d963

See more details on using hashes here.

Provenance

The following attestation bundles were made for auditwheel-6.7.0-py3-none-any.whl:

Publisher: release.yml on pypa/auditwheel

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

BERJAYA AWS Cloud computing and Security Sponsor BERJAYA Datadog Monitoring BERJAYA Depot Continuous Integration BERJAYA Fastly CDN BERJAYA Google Download Analytics BERJAYA Pingdom Monitoring BERJAYA Sentry Error logging BERJAYA StatusPage Status page