PlatformIO fails to install python dependencies

Whenever I try to do a build (pio run, doesn’t matter whether its from the terminal or from VSCode) platformIO starts reinstalling python dependencies, and fails.

Tried reinstalling VSCode, PlatformIO: no difference. Remoever .platformio and .vscode folders: no difference.

Output:

Processing stillcam (platform: espressif32; board: esp32cam; framework: espidf)

Verbose mode can be enabled via -v, --verbose option
CONFIGURATION: Redirecting...
PLATFORM: Espressif 32 (5.3.0) > AI Thinker ESP32-CAM
HARDWARE: ESP32 240MHz, 320KB RAM, 4MB Flash
DEBUG: Current (jlink) External (cmsis-dap, esp-bridge, esp-prog, iot-bus-jtag, jlink, minimodule, olimex-arm-usb-ocd, olimex-arm-usb-ocd-h, olimex-arm-usb-tiny-h, olimex-jtag-tiny, tumpa)
PACKAGES:

  • framework-espidf @ 3.40403.0 (4.4.3)
  • tool-cmake @ 3.16.4
  • tool-esptoolpy @ 1.40400.0 (4.4.0)
  • tool-idf @ 1.0.1
  • tool-mconf @ 1.4060000.20190628 (406.0.0)
  • tool-ninja @ 1.9.0
  • tool-openocd-esp32 @ 2.1100.20220706 (11.0)
  • toolchain-esp32ulp @ 1.23500.220830 (2.35.0)
  • toolchain-xtensa-esp32 @ 8.4.0+2021r2-patch5
    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 idf-component-manager~=1.0
    Using cached idf_component_manager-1.2.2-py3-none-any.whl (116 kB)
    Collecting cffi>=1.12
    Using cached cffi-1.15.1-cp310-cp310-win_amd64.whl (179 kB)
    Collecting six
    Using cached six-1.16.0-py2.py3-none-any.whl (11 kB)
    Collecting pyyaml>5.2
    Using cached PyYAML-6.0-cp310-cp310-win_amd64.whl (151 kB)
    Collecting packaging
    Using cached packaging-23.0-py3-none-any.whl (42 kB)
    Collecting cachecontrol[filecache]>0.12.6
    Using cached CacheControl-0.12.11-py2.py3-none-any.whl (21 kB)
    Collecting requests-file
    Using cached requests_file-1.5.1-py2.py3-none-any.whl (3.7 kB)
    Collecting contextlib2>0.6.0
    Using cached contextlib2-21.6.0-py2.py3-none-any.whl (13 kB)
    Collecting tqdm<5
    Using cached tqdm-4.65.0-py3-none-any.whl (77 kB)
    Collecting click
    Using cached click-8.1.3-py3-none-any.whl (96 kB)
    Collecting requests-toolbelt
    Using cached requests_toolbelt-0.10.1-py2.py3-none-any.whl (54 kB)
    Collecting colorama
    Using cached colorama-0.4.6-py2.py3-none-any.whl (25 kB)
    Collecting requests<3
    Using cached requests-2.28.2-py3-none-any.whl (62 kB)
    Collecting future
    Using cached future-0.18.3-py3-none-any.whl
    Collecting schema
    Using cached schema-0.7.5-py2.py3-none-any.whl (17 kB)
    Collecting msgpack>=0.5.2
    Using cached msgpack-1.0.5-cp310-cp310-win_amd64.whl (61 kB)
    Collecting lockfile>=0.9
    Using cached lockfile-0.12.2-py2.py3-none-any.whl (13 kB)
    Collecting pycparser
    Using cached pycparser-2.21-py2.py3-none-any.whl (118 kB)
    Collecting certifi>=2017.4.17
    Using cached certifi-2022.12.7-py3-none-any.whl (155 kB)
    Collecting idna<4,>=2.5
    Using cached idna-3.4-py3-none-any.whl (61 kB)
    Collecting charset-normalizer<4,>=2
    Using cached charset_normalizer-3.1.0-cp310-cp310-win_amd64.whl (97 kB)
    Collecting urllib3<1.27,>=1.21.1
    Using cached urllib3-1.26.15-py2.py3-none-any.whl (140 kB)
    Installing collected packages: msgpack, lockfile, urllib3, six, pyyaml, pycparser, packaging, idna, future, contextlib2, colorama, charset-normalizer, certifi, tqdm, schema, requests, click, cffi, requests-toolbelt, requests-file, cryptography, cachecontrol, idf-component-manager
    Attempting uninstall: msgpack
    Found existing installation: msgpack 1.0.5
    Uninstalling msgpack-1.0.5:
    Successfully uninstalled msgpack-1.0.5
    Attempting uninstall: lockfile
    Found existing installation: lockfile 0.12.2
    Uninstalling lockfile-0.12.2:
    Successfully uninstalled lockfile-0.12.2
    Attempting uninstall: urllib3
    Found existing installation: urllib3 1.26.15
    Uninstalling urllib3-1.26.15:
    Successfully uninstalled urllib3-1.26.15
    Attempting uninstall: six
    Found existing installation: six 1.16.0
    Uninstalling six-1.16.0:
    Successfully uninstalled six-1.16.0
    Attempting uninstall: pyyaml
    Found existing installation: PyYAML 6.0
    Uninstalling PyYAML-6.0:
    Successfully uninstalled PyYAML-6.0
    Attempting uninstall: pycparser
    Found existing installation: pycparser 2.21
    Uninstalling pycparser-2.21:
    Successfully uninstalled pycparser-2.21
    Attempting uninstall: packaging
    Found existing installation: packaging 23.0
    Uninstalling packaging-23.0:
    Successfully uninstalled packaging-23.0
    Attempting uninstall: idna
    Found existing installation: idna 3.4
    Uninstalling idna-3.4:
    Successfully uninstalled idna-3.4
    Attempting uninstall: future
    Found existing installation: future 0.18.3
    Uninstalling future-0.18.3:
    Successfully uninstalled future-0.18.3
    Attempting uninstall: contextlib2
    Found existing installation: contextlib2 21.6.0
    Uninstalling contextlib2-21.6.0:
    Successfully uninstalled contextlib2-21.6.0
    Attempting uninstall: colorama
    Found existing installation: colorama 0.4.6
    Uninstalling colorama-0.4.6:
    Successfully uninstalled colorama-0.4.6
    Attempting uninstall: charset-normalizer
    Found existing installation: charset-normalizer 3.1.0
    Uninstalling charset-normalizer-3.1.0:
    Successfully uninstalled charset-normalizer-3.1.0
    ERROR: Could not install packages due to an OSError: [WinError 5] Access is denied: ‘C:\Users\steven\.platformio\penv\Lib\site-packages\~-arset_normalizer\md.cp310-win_amd64.pyd’
    Check the permissions.

*** Error 1
Reading CMake configuration…
– Found Git: C:/Program Files/Git/cmd/git.exe (found version “2.36.0.windows.1”)
– The C compiler identification is GNU 8.4.0
– The CXX compiler identification is GNU 8.4.0
– The ASM compiler identification is GNU
– Found assembler: C:/Users/steven/.platformio/packages/toolchain-xtensa-esp32/bin/xtensa-esp32-elf-gcc.exe
– Check for working C compiler: C:/Users/steven/.platformio/packages/toolchain-xtensa-esp32/bin/xtensa-esp32-elf-gcc.exe
– Check for working C compiler: C:/Users/steven/.platformio/packages/toolchain-xtensa-esp32/bin/xtensa-esp32-elf-gcc.exe – works
– Detecting C compiler ABI info
– Detecting C compiler ABI info - done
– Detecting C compile features
– Detecting C compile features - done
– Check for working CXX compiler: C:/Users/steven/.platformio/packages/toolchain-xtensa-esp32/bin/xtensa-esp32-elf-g++.exe
– Check for working CXX compiler: C:/Users/steven/.platformio/packages/toolchain-xtensa-esp32/bin/xtensa-esp32-elf-g++.exe – works
– Detecting CXX compiler ABI info
– Detecting CXX compiler ABI info - done
– Detecting CXX compile features
– Detecting CXX compile features - done
– Building ESP-IDF components for target esp32
– Configuring incomplete, errors occurred!
See also “C:/redkitedesign/Design/healthyclimate/climate_inside_esp32/esp32-stillcam/.pio/build/stillcam/CMakeFiles/CMakeOutput.log”.

fatal: not a git repository (or any of the parent directories): .git
CMake Error at C:/Users/steven/.platformio/packages/framework-espidf/tools/cmake/build.cmake:452 (message):
C:\Users\steven.platformio\penv\Scripts\python.exe: Error while finding
module specification for ‘idf_component_manager.prepare_components’
(ModuleNotFoundError: No module named ‘idf_component_manager’)

Call Stack (most recent call first):
C:/Users/steven/.platformio/packages/framework-espidf/tools/cmake/project.cmake:384 (idf_build_process)
CMakeLists.txt:4 (project)

Update: Using ESP-IDF 5.0 (Platform-espressif32 release 6.1) seems to work fine.

The ESP-IDF 4.4 release (platform-espressif32 release 5.2) used to work fine on my system, so I suspect it is an interaction with something on my system, or something that does not get deleted when removing the .platformio folder.

Putting the PlatformIO Scripts directory before the Python 3.1 directory in the PATH makes no difference.

Already known in

and

so the 5.x platform does not have the fix Better handling of ESP IDF Python dependencies · platformio/platform-espressif32@8507dd8 · GitHub but 6.1.0 does.

Ah, thanks for the pointers.

Since I have a project based on ESP-IDF 4.4, and no options to move to ESP-IDF 5.0 I’m willing to cut corners.

Copying the PlatformIO 6.1 espidf.py file into the PlatformIO 5.3 tree (at .platformio\platforms\espressif32@5.3.0\builder\frameworks) seems to work as a workaround.

1 Like

This worked for me, I was panicking for a few days. No more sir!