Registry / devops / pystack

pystack

JSON →
library1.6.0pypypi✓ verified 87d ago

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 pystack
INSTALL
IMPORT
SIG · PYSTACK
P
pystack
devopspythonv1.6.0
Install
1.8s avg
Import
115ms
Disk
40MB
Pass rate
10/ 10
Env Coverage10 / 10
glibc
3.93.13
musl
3.93.13
Install & Compatibility
Where this runs
tested against v1.6.0 · 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.103.95 runs
installs and imports cleanly · install 0.0s · import 0.118s · 40.7MB
glibc
py 3.103.95 runs
installs and imports cleanly · install 1.8s · import 0.112s · 43MB
40MB installed
● package 40MB
Code
Verified usage

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

pystack
import pystack
pystack is a command-line tool; the Python module is typically used via subprocess or CLI. Importing is valid but uncommon.

Run pystack via CLI from Python. The tool must be installed and the process must be a Python process >=3.7.

import subprocess import os # Attach to a Python process by PID (replace 1234) result = subprocess.run(['pystack', '1234'], capture_output=True, text=True) print(result.stdout)
pystack --version
Debug
Known issues
breakingpystack requires the target Python process to have a compatible version (>=3.7). Attaching to an older Python version will fail.
fix
Ensure target process uses Python >=3.7. Use `pystack --version` to check compatible versions.
affects: <=1.6.0
gotchaRunning pystack on a process that is not a Python process or on a non-Linux platform will produce confusing errors.
fix
Verify target is a Python process and OS is Linux (official support). Use `file /proc/<pid>/exe` to check.
affects: all
gotchapystack requires permissions to attach to a remote process (e.g., same user or ptrace scope). Without them, it fails silently or with 'No such process'.
fix
Run as root or adjust ptrace settings: `echo 0 | sudo tee /proc/sys/kernel/yama/ptrace_scope`
affects: all
Errors
Common errors & fixes
pystack: error: argument PID: invalid integer value: 'abc'
Non-numeric PID argument passed to pystack CLI.
fix
Provide a valid integer process ID. Example: `pystack 1234`
pystack: Process 1234 not found
The target PID does not exist or pystack cannot access it.
fix
Verify the process exists: `ps aux | grep 1234`. Check permissions and ptrace settings.
OSError: [Errno 1] Operation not permitted
Insufficient permissions to attach to the process (e.g., ptrace restrictions).
fix
Run as root or temporarily disable ptrace_scope: `echo 0 | sudo tee /proc/sys/kernel/yama/ptrace_scope`
Upgrade
Version history
1.6.0latest on PyPI · released Jan 25, 2026
Audit
Dependencies

No dependency data recorded yet.

Agent activity
27 hits · last 30 days
node
24
OpenAI (training)
2
Resources
pystack — pip install pystack · libregistry