Skip to content

Critical MemoryError in standalone_python.py _unpack function #1691

@pareshjoshij

Description

@pareshjoshij

Component: src/pipx/standalone_python.py

The _unpack function in standalone_python.py contains a critical bug that can cause a MemoryError and crash pipx on low-RAM systems (like CI runners, containers, or Raspberry Pi).

The _download function is carefully written to download the large Python archive in small 32KB chunks to "avoid ballooning memory usage."

However, the _unpack function, which runs immediately after, reads the entire downloaded archive into memory at once to calculate its sha256 checksum. This defeats the purpose of the chunked download and can easily exhaust system memory.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions