pystack is a command-line tool developed by Bloomberg for analyzing the stack of remote Python processes. It attaches to a running Python process (supporting Python >=3.7) and dumps the Python stack frames, including local variables and source references, without requiring debug symbols or ptrace. The current version is 1.6.0, with a stable maintenance release cadence.
pip install pystackVerified import paths — ran on the pinned version, not inferred.
Run pystack via CLI from Python. The tool must be installed and the process must be a Python process >=3.7.
Ensure target process uses Python >=3.7. Use `pystack --version` to check compatible versions.
Verify target is a Python process and OS is Linux (official support). Use `file /proc/<pid>/exe` to check.
Run as root or adjust ptrace settings: `echo 0 | sudo tee /proc/sys/kernel/yama/ptrace_scope`
Provide a valid integer process ID. Example: `pystack 1234`
Verify the process exists: `ps aux | grep 1234`. Check permissions and ptrace settings.
Run as root or temporarily disable ptrace_scope: `echo 0 | sudo tee /proc/sys/kernel/yama/ptrace_scope`
No dependency data recorded yet.