Install & Compatibility
Where this runs
tested against v? · pip install
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
muslpy 3.10–3.910 runs
build_error
glibcpy 3.10–3.910 runs
build_error
Code
Verified usage
Verified import paths — ran on the pinned version, not inferred.
version
✓ from patchelf_wrapper import version
✗ from patchelf_wrapper.patchelf import find_patchelf_cmd
This quickstart demonstrates how to locate the `patchelf` binary installed by `patchelf-wrapper` and then execute it via `subprocess` to perform common operations like printing its version or an ELF binary's RPATH.
import subprocess
from patchelf_wrapper.patchelf import find_patchelf_cmd
try:
patchelf_path = find_patchelf_cmd()
print(f"Found patchelf at: {patchelf_path}")
# Example: Print the version of the installed patchelf
result = subprocess.run([patchelf_path, '--version'], capture_output=True, text=True, check=True)
print("patchelf version:\n", result.stdout.strip())
# Example: Print RPATH of an ELF binary (replace 'your_binary' with an actual path)
# It's important to use a real ELF file for this, or it will error.
# try:
# some_elf_binary = "/bin/ls" # Replace with a test ELF binary path
# rpath_result = subprocess.run([patchelf_path, '--print-rpath', some_elf_binary], capture_output=True, text=True, check=True)
# print(f"RPATH of {some_elf_binary}: {rpath_result.stdout.strip()}")
# except FileNotFoundError:
# print(f"Warning: Could not find '{some_elf_binary}' to demonstrate RPATH printing.")
# except subprocess.CalledProcessError as e:
# print(f"Error running patchelf on {some_elf_binary}: {e.stderr.strip()}")
except RuntimeError as e:
print(f"Error: {e}")
except FileNotFoundError:
print("Error: patchelf binary not found. Ensure patchelf-wrapper is correctly installed.")
Debug
Known issues
gotchaThe project's author explicitly recommends installing `patchelf` through your operating system's package manager rather than using `patchelf-wrapper` for general end-user needs, as the wrapper is primarily for PyPI-hosted projects requiring `patchelf` as a build dependency.fixFor end-users, prefer `sudo apt-get install patchelf` (Debian/Ubuntu) or `sudo dnf install patchelf` (Fedora/RedHat/CentOS), etc.
affects: All versions
gotcha`patchelf-wrapper` currently installs `patchelf` version 0.11. A separate, official `patchelf` package on PyPI (`pip install patchelf`) offers version 0.17.2.4 (as of July 2025), and system package managers often provide newer versions than 0.11. This version discrepancy can lead to missing features or unexpected behavior if a project expects a more recent `patchelf` utility.fixVerify the `patchelf` version installed by `patchelf-wrapper`. If a newer version is required, consider using the direct `patchelf` PyPI package or system-level installation. Ensure compatibility if integrating into a build process.
affects: All versions
gotchaEarlier versions (e.g., v1.0.2, v1.0.3, v1.0.4, v0.2.0) had installation issues with `bdist_egg`, `python setup.py install`, and very old versions of `setuptools`. These issues have been fixed in more recent `patchelf-wrapper` releases.fixEnsure you are using `patchelf-wrapper` version 1.1.0 or newer and have an up-to-date `setuptools` package to avoid installation problems.
affects: <= 1.0.4
breakingThe underlying `patchelf` utility, which this wrapper provides, has historically had bugs that could lead to binary corruption with certain operations, such as `--set-soname` or when run multiple times on the same binary, especially with older versions of `patchelf`.fixAlways back up ELF binaries before modifying them. Test `patchelf` operations thoroughly in a controlled environment. For critical or complex ELF modifications, consult the `patchelf` changelog for known issues or consider alternative libraries like LIEF for programmatic ELF manipulation.
affects: All versions (due to underlying `patchelf` utility)
Upgrade
Version history
1.2.0latest on PyPI · released Jul 4, 2020
Audit
Dependencies
No dependency data recorded yet.