Remove warning `Couldn't extract the list of installed Python packages`

How to remove warning Couldn't extract the list of installed Python packages

Actually there’s no problem, but that warning is annoying me because it tried attempting uninstall every time I want upload and build.

This is full output:

Processing esp32dev (platform: espressif32; framework: espidf; board: esp32dev)
-------------------------------------------------------------------------------------------- 
Verbose mode can be enabled via `-v, --verbose` option
CONFIGURATION: https://docs.platformio.org/page/boards/espressif32/esp32dev.html
PLATFORM: Espressif 32 (4.2.0) > Espressif ESP32 Dev Module
HARDWARE: ESP32 240MHz, 320KB RAM, 4MB Flash
DEBUG: Current (cmsis-dap) External (cmsis-dap, esp-prog, iot-bus-jtag, jlink, minimodule, ol
imex-arm-usb-ocd, olimex-arm-usb-ocd-h, olimex-arm-usb-tiny-h, olimex-jtag-tiny, tumpa)
PACKAGES: 
 - framework-espidf @ 3.40302.0 (4.3.2) 
 - tool-cmake @ 3.16.4 
 - tool-esptoolpy @ 1.30300.0 (3.3.0) 
 - tool-idf @ 1.0.1 
 - tool-mconf @ 1.4060000.20190628 (406.0.0) 
 - tool-mkfatfs @ 2.0.1 
 - tool-mklittlefs @ 1.203.210628 (2.3) 
 - tool-mkspiffs @ 2.230.0 (2.30) 
 - tool-ninja @ 1.9.0 
 - toolchain-esp32ulp @ 1.22851.191205 (2.28.51) 
 - toolchain-xtensa-esp32 @ 8.4.0+2021r2-patch3
Warning! Couldn't extract the list of installed Python packages.
Installing ESP-IDF's Python dependencies
Collecting cryptography<35.0.0,>=2.1.4
  Using cached cryptography-3.4.8-cp36-abi3-win_amd64.whl (1.6 MB)
Collecting future>=0.15.2
  Using cached future-0.18.2-py3-none-any.whl
Collecting pyparsing<2.4.0,>=2.0.3
  Using cached pyparsing-2.3.1-py2.py3-none-any.whl (61 kB)
Collecting kconfiglib==13.7.1
  Using cached kconfiglib-13.7.1-py2.py3-none-any.whl (145 kB)
Collecting cffi>=1.12
  Using cached cffi-1.15.1-cp39-cp39-win_amd64.whl (179 kB)
Collecting pycparser
  Using cached pycparser-2.21-py2.py3-none-any.whl (118 kB)
Installing collected packages: pyparsing, pycparser, kconfiglib, future, cffi, cryptography
  Attempting uninstall: pyparsing
    Found existing installation: pyparsing 2.3.1
    Uninstalling pyparsing-2.3.1:
      Successfully uninstalled pyparsing-2.3.1
  Attempting uninstall: pycparser
    Found existing installation: pycparser 2.21
    Uninstalling pycparser-2.21:
      Successfully uninstalled pycparser-2.21
  Attempting uninstall: kconfiglib
    Found existing installation: kconfiglib 13.7.1
    Uninstalling kconfiglib-13.7.1:
      Successfully uninstalled kconfiglib-13.7.1
  Attempting uninstall: future
    Found existing installation: future 0.18.2
    Uninstalling future-0.18.2:
      Successfully uninstalled future-0.18.2
  Attempting uninstall: cffi
    Found existing installation: cffi 1.15.1
    Uninstalling cffi-1.15.1:
      Successfully uninstalled cffi-1.15.1
  Attempting uninstall: cryptography
    Found existing installation: cryptography 3.4.8
    Uninstalling cryptography-3.4.8:
      Successfully uninstalled cryptography-3.4.8
Successfully installed cffi-1.15.1 cryptography-3.4.8 future-0.18.2 kconfiglib-13.7.1 pycpars
er-2.21 pyparsing-2.3.1

[notice] A new release of pip available: 22.1.2 -> 22.2
[notice] To update, run: python.exe -m pip install --upgrade pip
Reading CMake configuration...
LDF: Library Dependency Finder -> https://bit.ly/configure-pio-ldf
LDF Modes: Finder ~ chain, Compatibility ~ soft
Found 0 compatible libraries
Scanning dependencies...
No dependencies
Building in release mode
Retrieving maximum program size .pio\build\esp32dev\firmware.elf
Checking size .pio\build\esp32dev\firmware.elf
Advanced Memory Usage is available via "PlatformIO Home > Project Inspect"
RAM:   [          ]   3.9% (used 12904 bytes from 327680 bytes)
Flash: [==        ]  15.8% (used 165841 bytes from 1048576 bytes)
Configuring upload protocol...
AVAILABLE: cmsis-dap, esp-prog, espota, esptool, iot-bus-jtag, jlink, minimodule, olimex-arm-
usb-ocd, olimex-arm-usb-ocd-h, olimex-arm-usb-tiny-h, olimex-jtag-tiny, tumpa
CURRENT: upload_protocol = esptool
Looking for upload port...
Auto-detected: COM5
Uploading .pio\build\esp32dev\firmware.bin
esptool.py v3.3
Serial port COM5
Connecting....
Chip is ESP32-D0WDQ6-V3 (revision 3)
Features: WiFi, BT, Dual Core, 240MHz, VRef calibration in efuse, Coding Scheme None
Crystal is 40MHz
MAC: 30:c6:f7:20:71:64
Uploading stub...
Running stub...
Stub running...
Changing baud rate to 460800
Changed.
Configuring flash size...
Flash will be erased from 0x00001000 to 0x00007fff...
Flash will be erased from 0x00008000 to 0x00008fff...
Flash will be erased from 0x00010000 to 0x00038fff...
Compressed 26256 bytes to 16028...
Writing at 0x00001000... (100 %)
Wrote 26256 bytes (16028 compressed) at 0x00001000 in 0.8 seconds (effective 274.1 kbit/s)...
Hash of data verified.
Compressed 3072 bytes to 103...
Writing at 0x00008000... (100 %)
Wrote 3072 bytes (103 compressed) at 0x00008000 in 0.1 seconds (effective 186.2 kbit/s)...
Hash of data verified.
Compressed 166224 bytes to 86297...
Writing at 0x00010000... (16 %)
Writing at 0x0001b2ac... (33 %)
Writing at 0x00020a39... (50 %)
Writing at 0x00026364... (66 %)
Writing at 0x0002fb34... (83 %)
Writing at 0x00036f58... (100 %)
Wrote 166224 bytes (86297 compressed) at 0x00010000 in 2.6 seconds (effective 504.7 kbit/s)..
.
Hash of data verified.

Leaving...
Hard resetting via RTS pin...
=============================== [SUCCESS] Took 99.53 seconds ===============================

This error can only appear if

Please open a CLI and execute

pio system info

There will be a line with

Python Executable           C:\Users\Max Gerhardt\.platformio\penv\Scripts\python.exe

Use this path to construct the same command as the builder script path, so in this case,

"C:\Users\Max Gerhardt\.platformio\penv\Scripts\python.exe" -m pip list --format=json

and post the output.

I’m kind of suspecting that the notice message

[notice] A new release of pip available: 22.1.2 -> 22.2

appears in the output so the JSON parsing fails.

Thank you for your answer, I just need upgrade PIP to remove that warning.

But then the _get_installed_pip_packages() function isn’t safe against that. Please open an issue at Issues · platformio/platform-espressif32 · GitHub if that really fixed the issue.

I just ran into this same issue, but I had already upgraded PIP to the latest version. In my case it turns out the VS Code PIO plugin was using a different Python interpreter than I was using in the terminal.

From the plugin I was getting /Users/$USER/.platformio/penv/bin/python, but from the terminal I was getting /Users/$USER/.pyenv/versions/3.10.0/bin/python3.10. You can check the plugin interpreter path by running the Verbose Build All task.

Once I found the plugin interpreter path, I was able to upgrade PIP using that specific interpreter and the problem went away.