subprocess32
A backport of the subprocess module from Python 3 for use on 2.x.
What it is and what it does
subprocess32 is a backport of Python 3's subprocess module for Python 2, designed to bring reliability improvements and modern APIs to older Python environments on POSIX systems. It includes a C extension that handles the fork/exec code path safely in multithreaded applications, addressing concurrency bugs present in Python 2's standard subprocess. The package backports timeout support from Python 3.3 and the run() API from Python 3.5, while keeping other features frozen at Python 3.2 level.
This package is intended as a drop-in replacement for Python 2's subprocess module on POSIX platforms (Linux, macOS, BSD, Solaris). However, the project is now abandoned—the repository was archived in 2020 and the last release was in May 2019. Python 2 itself reached end-of-life years ago, making this package primarily useful only for maintaining legacy Python 2 codebases that cannot be migrated.
Use it for:
- Fixing concurrency bugs in legacy Python 2.7 applications that spawn subprocesses from multithreaded code.
- Adding timeout support to subprocess calls in Python 2.6 or 2.7 without upgrading to Python 3.
- Providing a unified subprocess API across Python 2 and 3 for codebases that must support both versions.
- Replacing Python 2's built-in subprocess module on POSIX systems to gain thread-safe fork/exec handling.
Worth the install?
AI-flagged interpretation of the facts on this page — verify before relying
A backport of Python 3's subprocess module to Python 2, with thread-safe fork/exec handling and timeout support for POSIX systems.
No, unless you are maintaining a legacy Python 2 codebase that cannot be migrated. The project is abandoned, the repository archived, and Python 2 itself is long past end-of-life. The C extension may not compile on modern build systems. If you control the codebase, upgrade to Python 3; if you cannot, use this only as a temporary measure while planning migration.
Install
subprocess32 on PyPI
pip
pip install subprocess32uv
uv add subprocess32poetry
poetry add subprocess32Installing subprocess32
Before you install
Medium install friction due to compiled C extension. Repository archived since 2020 and project abandoned; last release was 2019-05-20, over 2643 days ago. Not maintained.
License in practice
Licensed under PSF license (permissive). No licensing restrictions on use or redistribution.
Quickstart
import sys, os
if os.name == 'posix' and sys.version_info[0] < 3:
import subprocess32 as subprocess
else:
import subprocess
result = subprocess.run(['echo', 'hello'], timeout=5)
Python 2 only (2.6, 2.7); requires POSIX platform; C extension compilation needed at install time.
Verify before relying
- Whether the C extension compiles cleanly on modern build systems given the 2020 last commit date.
- Current status of the archived repository and whether security patches or critical fixes are still available.
Package facts
| License | PSF license (permissive) |
| Python support | supports the current Python release (>=2.6, !=3.0.*, !=3.1.*, !=3.2.*, <4) |
| Install friction | medium — platform-specific wheel |
| Runtime dependencies | none |
| Maintenance | abandoned — 2,643 days since the last release |
| Last repo commit | (repository archived) |
| First released | |
| Downloads | 710,240/month — #5,260 on PyPI (30-day window, as of 2026-08-14) |
| Known vulnerabilities | none known (OSV.dev, checked 2026-08-14) |
Evidence: subprocess32-3.5.4-cp27-cp27m-macosx_10_6_intel.whl; subprocess32-3.5.4-cp27-cp27mu-manylinux2014_x86_64.whl
Tags
More Libraries packages
urllib3 is an HTTP client library that provides…
permissive · top 100 on PyPI
requestsRequests is a Python HTTP library that…
permissive · top 100 on PyPI
pluggyPluggy provides a plugin system that lets you…
permissive · top 100 on PyPI
python-dateutilProvides parsing, arithmetic, and recurrence…
permissive · top 100 on PyPI
sixSix provides utility functions to write Python…
permissive · top 100 on PyPI
pytestpytest is a testing framework that lets you…
permissive · top 100 on PyPI
multiprocessingBackport of Python 2.6/3.0 multiprocessing to…
permissive · top 15,000 on PyPI
taskgroupBackports asyncio.TaskGroup, asyncio.Runner,…
permissive · top 5,000 on PyPI
futuresBackport of Python 3's concurrent.futures…
permissive · top 5,000 on PyPI
EasyProcessEasyProcess wraps Python's subprocess module to…
permissive · top 5,000 on PyPI
functools32Backport of Python 3.2's functools module…
permissive · top 15,000 on PyPI
pathlibProvides object-oriented filesystem path…
permissive · top 5,000 on PyPI
fissixfissix is a backport of Python's lib2to3…
permissive · top 15,000 on PyPI
backports.tempfileProvides the TemporaryDirectory context manager…
permissive · top 5,000 on PyPI
wrapt-timeout-decoratorApplies timeout limits to Python functions and…
permissive · top 5,000 on PyPI
selectors2Provides a backported, cross-platform…
permissive · top 15,000 on PyPI