patchelf
A small utility to modify the dynamic linker and RPATH of ELF executables.
What it is and what it does
patchelf is a packaging of the upstream NixOS patchelf utility, distributed via PyPI for easy installation. It modifies ELF executables' dynamic linker and RPATH settings, which is essential for binary wheel portability and compatibility across Linux distributions. The package provides pre-built binaries for multiple architectures and libc variants (glibc, musl), eliminating the need to compile patchelf from source.
This is primarily a command-line tool packaged for Python environments. It has no runtime dependencies and is commonly used in build pipelines for auditwheel, manylinux, and musllinux workflows—scenarios where you need to adjust how compiled binaries locate their dependencies. The package is actively maintained and supports modern Python versions.
Use it for:
- Building manylinux or musllinux wheels that need to adjust RPATH in compiled extensions
- Automating binary patching in CI/CD pipelines without requiring system package managers
- Modifying ELF executables' dynamic linker for cross-distribution compatibility
- Dependency for auditwheel or similar tools that repair wheel portability
- Development environments where patchelf must be available as a Python dependency
Worth the install?
AI-flagged interpretation of the facts on this page — verify before relying
Provides a PyPI-packaged binary of patchelf, a utility for modifying the dynamic linker and RPATH of ELF executables.
Yes, if you need patchelf in a Python environment or build pipeline. It offers zero runtime dependencies, active maintenance, and broad platform coverage via pre-built wheels. The GPLv3+ copyleft applies only to modifications; using the binary carries no redistribution obligation. Install friction is medium due to platform-specific wheels, but that is unavoidable for a compiled utility.
Install
patchelf on PyPI
pip
pip install patchelfuv
uv add patchelfpoetry
poetry add patchelfInstalling patchelf
Before you install
Medium install friction due to platform-specific binary wheels. Active maintenance with recent releases (6 days since last update). No runtime dependencies simplifies deployment.
License in practice
Dual-licensed under Apache 2.0 and GPLv3+. The copyleft GPLv3+ component means derivative works or modifications must be released under compatible terms; using the binary as-is carries no obligation, but redistributing modified versions requires GPL compliance.
Quickstart
pip install patchelf
import patchelf
# patchelf is primarily a command-line tool; Python usage depends on the underlying binary
Requires a supported platform with a pre-built wheel (Linux x86_64, aarch64, armv7l, ppc64le, s390x, riscv64, i686, or macOS universal2). Python >= 3.7.
Verify before relying
- Whether the package exposes a Python API or is primarily a CLI wrapper around the patchelf binary
- Specific use cases within auditwheel, manylinux, or musllinux workflows that this packaging enables
Package facts
| License | GPL-3.0-or-later (copyleft) |
| Python support | supports the current Python release (>=3.7) |
| Install friction | medium — platform-specific wheel |
| Runtime dependencies | none |
| Maintenance | actively maintained — 6 days since the last release |
| Last repo commit | |
| First released | |
| Downloads | 13,780,922/month — #1,264 on PyPI (30-day window, as of 2026-08-14) |
| Known vulnerabilities | none known (OSV.dev, checked 2026-08-14) |
Evidence: patchelf-0.19.1.0-py3-none-macosx_10_9_universal2.whl; patchelf-0.19.1.0-py3-none-manylinux1_i686.manylinux_2_5_i686.musllinux_1_1_i686.whl; patchelf-0.19.1.0-py3-none-manylinux1_x86_64.manylinux_2_5_x86_64.musllinux_1_1_x86_64.whl; patchelf-0.19.1.0-py3-none-manylinux2014_aarch64.manylinux_2_17_aarch64.musllinux_1_1_aarch64.whl; patchelf-0.19.1.0-py3-none-manylinux2014_armv7l.manylinux_2_17_armv7l.musllinux_1_1_armv7l.whl; patchelf-0.19.1.0-py3-none-manylinux2014_ppc64le.manylinux_2_17_ppc64le.musllinux_1_1_ppc64le.whl; patchelf-0.19.1.0-py3-none-manylinux2014_s390x.manylinux_2_17_s390x.musllinux_1_1_s390x.whl; patchelf-0.19.1.0-py3-none-manylinux_2_31_riscv64.musllinux_1_1_riscv64.whl
Keywords: auditwheel, elf, manylinux, musllinux, patchelf
Tags
More Build Tools packages
Provides reusable utilities for Python…
permissive · top 100 on PyPI
tqdmWraps any iterable to display a real-time…
copyleft · top 100 on PyPI
pippip is the standard installer for Python…
permissive · top 100 on PyPI
hatchlingHatchling is a standards-compliant Python build…
permissive · top 100 on PyPI
grpcio-toolsGenerates Python gRPC service stubs and message…
permissive · top 1,000 on PyPI
pre-commitpre-commit is a framework for installing and…
permissive · top 1,000 on PyPI
auditwheelAudits and repairs Linux and Android wheel…
permissive · top 5,000 on PyPI
patchelf-wrapperProvides a Python wrapper that downloads and…
permissive · top 5,000 on PyPI
change-wheel-versionModifies the version metadata in an…
unclear · top 15,000 on PyPI
repairwheelRepairs wheels for cross-platform distribution…
permissive · top 15,000 on PyPI
pyelftoolspyelftools parses and analyzes ELF binary files…
permissive · top 5,000 on PyPI
pyvips-binaryProvides pre-built binary wheels of libvips and…
copyleft · top 15,000 on PyPI
cleCLE loads binary executables and shared…
permissive · top 5,000 on PyPI
liefLIEF parses, modifies, and abstracts binary…
permissive · top 5,000 on PyPI
s5cmdProvides a Python wheel distribution that…
permissive · top 5,000 on PyPI
cibuildwheelAutomates building and testing Python wheels…
permissive · top 5,000 on PyPI