Skip to content

Does not work correctly in pipx/uvx-style environments due to missing pip dependency #5305

@cgranade

Description

@cgranade

When using uvx or uv tool install to run PlatformIO, many commands fail due to a missing dependency on pip:

$ mkdir esp-example
$ cd esp-example
$ uvx platformio init --board esp32s3usbotg
The following files/directories have been created in /home/cgranade/tmp/esp-example
include - Put project header files here
lib - Put project specific (private) libraries here
src - Put project source files here
platformio.ini - Project Configuration File
Resolving esp32s3usbotg dependencies...
Platform Manager: Installing espressif32
Downloading  [####################################]  100%
Unpacking  [####################################]  100%
Platform Manager: espressif32@6.12.0 has been installed!
Tool Manager: Installing espressif/toolchain-xtensa-esp32s3 @ 8.4.0+2021r2-patch5
Downloading  [####################################]  100%          
Unpacking  [####################################]  100%          
Tool Manager: toolchain-xtensa-esp32s3@8.4.0+2021r2-patch5 has been installed!
Tool Manager: Installing espressif/toolchain-riscv32-esp @ 8.4.0+2021r2-patch5
Downloading  [####################################]  100%          
Unpacking  [####################################]  100%          
Tool Manager: toolchain-riscv32-esp@8.4.0+2021r2-patch5 has been installed!
Tool Manager: Installing platformio/framework-arduinoespressif32 @ ~3.20017.0
Downloading  [####################################]  100%          
Unpacking  [####################################]  100%          
Tool Manager: framework-arduinoespressif32@3.20017.241212+sha.dcc1105b has been installed!
Tool Manager: Installing platformio/tool-esptoolpy @ ~2.40900.0
Downloading  [####################################]  100%
Unpacking  [####################################]  100%
/home/cgranade/.cache/uv/archive-v0/UqYPTk0VrTbywRTRcX1sL/bin/python: No module named pip


Please ensure that the following packages are installed:

sudo apt install python3-dev libffi-dev libssl-dev


Cleaning...
Tool Manager: tool-esptoolpy@2.40900.250804 has been installed!
MissingPackageManifestError: Could not find one of 'package.json' manifest files in the package

The problem can be confirmed by noting that re-running uvx with the pip dependency added manually causes the command to complete successfully:

$ uvx --with pip platformio init --board esp32s3usbotg
Installed 24 packages in 37ms
The following files/directories have been created in /home/cgranade/tmp/esp-example
include - Put project header files here
lib - Put project specific (private) libraries here
src - Put project source files here
platformio.ini - Project Configuration File
Resolving esp32s3usbotg dependencies...
Tool Manager: Installing platformio/tool-esptoolpy @ ~2.40900.0
Unpacking  [####################################]  100%
Collecting cryptography~=45.0.3
  Downloading cryptography-45.0.7-cp311-abi3-manylinux_2_34_x86_64.whl.metadata (5.7 kB)
Collecting ecdsa~=0.19.1
  Downloading ecdsa-0.19.1-py2.py3-none-any.whl.metadata (29 kB)
Collecting bitstring~=4.3.1
  Downloading bitstring-4.3.1-py3-none-any.whl.metadata (5.3 kB)
Collecting reedsolo~=1.7.0
  Downloading reedsolo-1.7.0-py3-none-any.whl.metadata (23 kB)
Collecting intelhex~=2.3.0
  Downloading intelhex-2.3.0-py2.py3-none-any.whl.metadata (2.7 kB)
Collecting cffi>=1.14 (from cryptography~=45.0.3)
  Downloading cffi-2.0.0-cp311-cp311-manylinux2014_x86_64.manylinux_2_17_x86_64.whl.metadata (2.6 kB)
Collecting six>=1.9.0 (from ecdsa~=0.19.1)
  Downloading six-1.17.0-py2.py3-none-any.whl.metadata (1.7 kB)
Collecting bitarray<4.0,>=3.0.0 (from bitstring~=4.3.1)
  Downloading bitarray-3.8.0-cp311-cp311-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl.metadata (34 kB)
Collecting pycparser (from cffi>=1.14->cryptography~=45.0.3)
  Downloading pycparser-2.23-py3-none-any.whl.metadata (993 bytes)
Downloading cryptography-45.0.7-cp311-abi3-manylinux_2_34_x86_64.whl (4.5 MB)
   ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 4.5/4.5 MB 90.3 MB/s  0:00:00
Downloading ecdsa-0.19.1-py2.py3-none-any.whl (150 kB)
Downloading bitstring-4.3.1-py3-none-any.whl (71 kB)
Downloading reedsolo-1.7.0-py3-none-any.whl (32 kB)
Downloading intelhex-2.3.0-py2.py3-none-any.whl (50 kB)
Downloading bitarray-3.8.0-cp311-cp311-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl (337 kB)
Downloading cffi-2.0.0-cp311-cp311-manylinux2014_x86_64.manylinux_2_17_x86_64.whl (215 kB)
Downloading six-1.17.0-py2.py3-none-any.whl (11 kB)
Downloading pycparser-2.23-py3-none-any.whl (118 kB)
Installing collected packages: reedsolo, intelhex, bitarray, six, pycparser, bitstring, ecdsa, cffi, cryptography
Successfully installed bitarray-3.8.0 bitstring-4.3.1 cffi-2.0.0 cryptography-45.0.7 ecdsa-0.19.1 intelhex-2.3.0 pycparser-2.23 reedsolo-1.7.0 six-1.17.0
Tool Manager: tool-esptoolpy@2.40900.250804 has been installed!
Tool Manager: Installing platformio/tool-scons @ ~4.40801.0
Downloading  [####################################]  100%
Unpacking  [####################################]  100%
Tool Manager: tool-scons@4.40801.0 has been installed!
Already up-to-date.
Project has been successfully initialized!

In particular, it appears that the platformio Python package takes a hard dependency on pip, but that that dependency is not listed at https://github.com/platformio/platformio-core/blob/develop/platformio/dependencies.py#L29 as called by https://github.com/platformio/platformio-core/blob/develop/setup.py#L37, such that uvx platformio creates a virtual environment that does not contain pip.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions