Registry / data / pyvex
library9.2.221pypypi✓ verified 87d ago

PyVEX is a Python interface to libVEX, Valgrind's VEX Intermediate Representation (IR) engine. It provides bindings to translate machine code from various architectures into a common, architecture-agnostic, side-effects-free IR, facilitating static and dynamic program analysis. PyVEX is a foundational component of the angr binary analysis framework and is actively maintained with frequent releases, typically alongside the broader angr project.

pip install pyvex
INSTALL
IMPORT
SIG · PYVEX
P
pyvex
datapythonv9.2.221
Install
2.8s avg
Import
530ms
Disk
27MB
Pass rate
5/ 10
Env Coverage5 / 10
glibc
3.9–3.13
musl
3.9–3.13
Install & Compatibility
Where this runs
tested against v9.2.213 · pip install
no network on importno background threads
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
musl
py 3.10–3.920 runs
build_error
glibc
py 3.10–3.920 runs
installs and imports cleanly · install 2.8s · import 0.530s · 28MB
27MB installed
● package 27MB
Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

pyvex
✓ import pyvex
✗ import pyvex import archinfo
IRSBCaller
✓ from pyvex import IRSBCaller
✗ pyvex.lift
IRExpr
✓ from pyvex import IRExpr

This quickstart demonstrates how to lift a small block of AMD64 NOP instructions into PyVEX's IRSB (Intermediate Representation Super-Block). It then pretty-prints the entire IRSB, iterates through its statements, and shows how to access the default exit (jump target) expression and kind. This requires `archinfo` to be installed.

import pyvex import archinfo # Binary code: 5 NOPs (0x90) for AMD64 binary_code = b"\x90\x90\x90\x90\x90" # Base address for the code base_address = 0x400400 # Architecture definition architecture = archinfo.ArchAMD64() # Lift the binary code into a VEX Intermediate Representation Super-Block (IRSB) irsb = pyvex.lift(binary_code, base_address, architecture) print("--- Lifted IRSB ---") irsb.pp() # Pretty-print the IRSB print("\n--- IRSB Statements ---") for stmt in irsb.statements: stmt.pp() print("\n--- Next IR Expression (Jump Target) ---") irsb.next.pp() print(f"Jump Kind: {irsb.jumpkind}")
Debug
Known issues
breakingMajor version bumps (e.g., from 8.x to 9.x) in pyvex, especially as part of the broader angr project, can introduce API changes and require specific dependency versions. This can necessitate updating related libraries like `archinfo` and `angr` in tandem to maintain compatibility.
fix
Consult the `angr` and `pyvex` release notes for detailed migration guides. Ensure all `angr` ecosystem libraries are updated to compatible versions.
affects: <9.0.0
gotchaWhen lifting certain instruction types (e.g., MIPS branches or jumps) with `max_inst=1` (limiting to one instruction), PyVEX might return an empty IRSB because these instructions often require 'delay slots' to be processed together. This can lead to a `SimIRSBError` if an empty block is passed to downstream analysis.
fix
Avoid `max_inst=1` for architectures with delay slots or complex instruction semantics. Allow PyVEX to lift more bytes/instructions or handle `SimIRSBError` gracefully by checking if the IRSB is empty (`len(irsb.statements) == 0`).
affects: All versions
gotchaPyVEX provides a *syntactic* representation of a basic block. This means it describes the operations and control flow but does not inherently provide semantic context like the actual data written by a store instruction or the live values of registers at a given point without further analysis.
fix
For deeper semantic analysis (e.g., dataflow, symbolic execution), integrate PyVEX with higher-level binary analysis frameworks like `angr` which build this context upon the VEX IR.
affects: All versions
gotchaWindows installations might encounter C compiler errors, often related to missing include files (e.g., 'stdarg.h') during the build process of the underlying libVEX C component, even with Visual Studio installed.
fix
Ensure that the necessary C/C++ build tools for Visual Studio are fully installed, including desktop development with C++ workloads. Sometimes, manually launching the appropriate 'x64 Native Tools Command Prompt for VS' and running `pip install pyvex` from there can resolve environment path issues.
affects: All versions on Windows
Upgrade
Version history
9.2.221latest on PyPI · released Jun 3, 2026
Audit
Dependencies
pythonrequiredRequired Python version.
bitstringrequiredRuntime dependency for bit manipulation.
cffirequiredUsed for Python Foreign Function Interface to interact with libVEX (C library).
archinforequiredProvides architecture definitions necessary for lifting binary code into VEX IR. While not a hard PyPI dependency, it is practically required for most usage.
Agent activity
32 hits · last 30 days
node
26
OpenAI (training)
2
Amazon
1
Resources