Skip to content

PlatformIO fails in pipx/uvx environments — pip not declared as a dependency #5418

@mahdirajaee

Description

@mahdirajaee

Description

PlatformIO's tool manager internally calls pip install to install Python-based tool dependencies (e.g., esptool crypto dependencies), but pip is not listed in platformio/dependencies.py.

Modern Python tool runners (pipx, uvx, uv tool install) create isolated virtual environments that only include declared dependencies. Since pip is not declared, it is absent from the environment, and tool installation fails with:

ModuleNotFoundError: No module named 'pip'

Reproduction

pipx install platformio
pio run -e esp32dev  # fails when trying to install esptool dependencies

Proposed Fix

Option A (one-line fix): Add pip to get_pip_dependencies() in dependencies.py:

def get_pip_dependencies():
    return [
        "pip",
        # ... existing dependencies
    ]

Option B (long-term): Refactor the tool manager to use importlib and direct wheel installation instead of shelling out to pip. This removes the runtime dependency entirely.

Context

Related to #5305. The Python ecosystem is rapidly moving toward uv-based tooling, making this an increasingly common failure mode for new users.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions