Creating new ESP-IDF project fails with (ModuleNotFoundError: No module named 'idf_component_manager') message

So I just uninstalled and reinstalled VScode, uninstalled Platformio, deleted all existing projects and the .platformio directory in users/xxxx/. Next I restarted and reinstalled Platformio.

Now when I try and create a new project (espidf) it fails with the following log.

PIO Core Call Error: "The current working directory D:\Documents\PlatformIO\Projects\EspIdfTestProject will be used for the project.

The next files/directories have been created in D:\Documents\PlatformIO\Projects\EspIdfTestProject
include - Put project header files here
lib - Put here project specific (private) libraries
src - Put project source files here
platformio.ini - Project Configuration File
Resolving lolin_d32_pro dependencies...
Already up-to-date.
Updating metadata for the vscode IDE...


Error: Processing lolin_d32_pro (platform: espressif32; board: lolin_d32_pro; framework: espidf)
--------------------------------------------------------------------------------
Verbose mode can be enabled via `-v, --verbose` option
CONFIGURATION: https://docs.platformio.org/page/boards/espressif32/lolin_d32_pro.html
PLATFORM: Espressif 32 (5.3.0) > WEMOS LOLIN D32 PRO
HARDWARE: ESP32 240MHz, 320KB RAM, 4MB Flash
DEBUG: Current (cmsis-dap) 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 
 - 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 future>=0.15.2
 Using cached future-0.18.3-py3-none-any.whl
Collecting kconfiglib==13.7.1
 Using cached kconfiglib-13.7.1-py2.py3-none-any.whl (145 kB)
Collecting idf-component-manager~=1.0
 Using cached idf_component_manager-1.2.1-py3-none-any.whl (116 kB)
Collecting cffi>=1.12
 Using cached cffi-1.15.1-cp39-cp39-win_amd64.whl (179 kB)
Collecting pyyaml>5.2
 Using cached PyYAML-6.0-cp39-cp39-win_amd64.whl (151 kB)
Collecting cachecontrol[filecache]>0.12.6
 Using cached CacheControl-0.12.11-py2.py3-none-any.whl (21 kB)
Collecting tqdm<5
 Using cached tqdm-4.64.1-py2.py3-none-any.whl (78 kB)
Collecting colorama
 Using cached colorama-0.4.6-py2.py3-none-any.whl (25 kB)
Collecting requests-toolbelt
 Using cached requests_toolbelt-0.10.1-py2.py3-none-any.whl (54 kB)
Collecting requests<3
 Using cached requests-2.28.2-py3-none-any.whl (62 kB)
Collecting schema
 Using cached schema-0.7.5-py2.py3-none-any.whl (17 kB)
Collecting contextlib2>0.6.0
 Using cached contextlib2-21.6.0-py2.py3-none-any.whl (13 kB)
Collecting requests-file
 Using cached requests_file-1.5.1-py2.py3-none-any.whl (3.7 kB)
Collecting packaging
 Using cached packaging-23.0-py3-none-any.whl (42 kB)
Collecting click
 Using cached click-8.1.3-py3-none-any.whl (96 kB)
Collecting six
 Using cached six-1.16.0-py2.py3-none-any.whl (11 kB)
Collecting msgpack>=0.5.2
 Using cached msgpack-1.0.4-cp39-cp39-win_amd64.whl (62 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 charset-normalizer<4,>=2
 Using cached charset_normalizer-3.0.1-cp39-cp39-win_amd64.whl (96 kB)
Collecting urllib3<1.27,>=1.21.1
 Using cached urllib3-1.26.14-py2.py3-none-any.whl (140 kB)
Collecting idna<4,>=2.5
 Using cached idna-3.4-py3-none-any.whl (61 kB)
Collecting certifi>=2017.4.17
 Using cached certifi-2022.12.7-py3-none-any.whl (155 kB)
Installing collected packages: msgpack, lockfile, charset-normalizer, urllib3, six, pyyaml, pycparser, packaging, kconfiglib, idna, future, contextlib2, colorama, certifi, tqdm, schema, requests, click, cffi, requests-toolbelt, requests-file, cryptography, cachecontrol, idf-component-manager
 Attempting uninstall: msgpack
 Found existing installation: msgpack 1.0.4
 Uninstalling msgpack-1.0.4:
 Successfully uninstalled msgpack-1.0.4
 Attempting uninstall: lockfile
 Found existing installation: lockfile 0.12.2
 Uninstalling lockfile-0.12.2:
 Successfully uninstalled lockfile-0.12.2
 Attempting uninstall: charset-normalizer
 Found existing installation: charset-normalizer 3.0.1
 Uninstalling charset-normalizer-3.0.1:
 Successfully uninstalled charset-normalizer-3.0.1
ERROR: Could not install packages due to an OSError: [WinError 5] Access is denied: 'C:\\Users\\deckc\\.platformio\\penv\\Lib\\site-packages\\~=arset_normalizer\\md.cp39-win_amd64.pyd'
Check the permissions.

*** Error 1
Reading CMake configuration...
-- Found Git: C:/Program Files/Git/cmd/git.exe (found version "2.39.0.windows.2") 
-- 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/deckc/.platformio/packages/toolchain-xtensa-esp32/bin/xtensa-esp32-elf-gcc.exe
-- Check for working C compiler: C:/Users/deckc/.platformio/packages/toolchain-xtensa-esp32/bin/xtensa-esp32-elf-gcc.exe
-- Check for working C compiler: C:/Users/deckc/.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/deckc/.platformio/packages/toolchain-xtensa-esp32/bin/xtensa-esp32-elf-g++.exe
-- Check for working CXX compiler: C:/Users/deckc/.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
-- Project is not inside a git repository, or git repository has no commits; will not use 'git describe' to determine PROJECT_VER.
-- Building ESP-IDF components for target esp32
-- Configuring incomplete, errors occurred!
See also "D:/Documents/PlatformIO/Projects/EspIdfTestProject/.pio/build/lolin_d32_pro/CMakeFiles/CMakeOutput.log".

fatal: not a git repository (or any of the parent directories): .git
CMake Error at C:/Users/deckc/.platformio/packages/framework-espidf/tools/cmake/build.cmake:452 (message):
 C:\Users\deckc\.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/deckc/.platformio/packages/framework-espidf/tools/cmake/project.cmake:384 (idf_build_process)
 CMakeLists.txt:3 (project)



========================= [FAILED] Took 10.56 seconds ========================="
Can somebody help me out please I have done several restarts etc.

I have the same problem trying to build an existing project. The error messages in the log are basically the same. I also reinstalled PlatformIO, deleted the .platformio directory and tried to build it with only the platformIO core without VS Code, but nothing helps.

CONFIGURATION: https://docs.platformio.org/page/boards/espressif32/esp32thing_plus.html
PLATFORM: Espressif 32 (5.2.0) > SparkFun ESP32 Thing Plus
HARDWARE: ESP32 240MHz, 320KB RAM, 16MB Flash
DEBUG: Current (cmsis-dap) 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-arduinoespressif32 @ 3.20005.220925 (2.0.5)
 - framework-espidf @ 3.40402.0 (4.4.2)
 - tool-cmake @ 3.16.4
 - tool-esptoolpy @ 1.40201.0 (4.2.1)
 - tool-idf @ 1.0.1
 - tool-mconf @ 1.4060000.20190628 (406.0.0)
 - tool-ninja @ 1.9.0
 - toolchain-esp32ulp @ 1.22851.191205 (2.28.51)
 - toolchain-xtensa-esp32 @ 8.4.0+2021r2-patch3
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.3-py3-none-any.whl
Collecting kconfiglib==13.7.1
  Using cached kconfiglib-13.7.1-py2.py3-none-any.whl (145 kB)
Collecting idf-component-manager~=1.0
  Using cached idf_component_manager-1.2.1-py3-none-any.whl (116 kB)
Collecting cffi>=1.12
  Using cached cffi-1.15.1-cp311-cp311-win_amd64.whl (179 kB)
Collecting packaging
  Using cached packaging-23.0-py3-none-any.whl (42 kB)
Collecting requests<3
  Using cached requests-2.28.2-py3-none-any.whl (62 kB)
Collecting requests-file
  Using cached requests_file-1.5.1-py2.py3-none-any.whl (3.7 kB)
Collecting requests-toolbelt
  Using cached requests_toolbelt-0.10.1-py2.py3-none-any.whl (54 kB)
Collecting schema
  Using cached schema-0.7.5-py2.py3-none-any.whl (17 kB)
Collecting six
  Using cached six-1.16.0-py2.py3-none-any.whl (11 kB)
Collecting tqdm<5
  Using cached tqdm-4.64.1-py2.py3-none-any.whl (78 kB)
Collecting colorama
  Using cached colorama-0.4.6-py2.py3-none-any.whl (25 kB)
Collecting pyyaml>5.2
  Using cached PyYAML-6.0-cp311-cp311-win_amd64.whl (143 kB)
Collecting cachecontrol[filecache]>0.12.6
  Using cached CacheControl-0.12.11-py2.py3-none-any.whl (21 kB)
Collecting contextlib2>0.6.0
  Using cached contextlib2-21.6.0-py2.py3-none-any.whl (13 kB)
Collecting click
  Using cached click-8.1.3-py3-none-any.whl (96 kB)
Collecting msgpack>=0.5.2
  Using cached msgpack-1.0.4-cp311-cp311-win_amd64.whl
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 charset-normalizer<4,>=2
  Using cached charset_normalizer-3.0.1-cp311-cp311-win_amd64.whl (96 kB)
Collecting idna<4,>=2.5
  Using cached idna-3.4-py3-none-any.whl (61 kB)
Collecting urllib3<1.27,>=1.21.1
  Using cached urllib3-1.26.14-py2.py3-none-any.whl (140 kB)
Collecting certifi>=2017.4.17
  Using cached certifi-2022.12.7-py3-none-any.whl (155 kB)
Installing collected packages: msgpack, lockfile, charset-normalizer, urllib3, six, pyyaml, pycparser, packaging, kconfiglib, idna, future, contextlib2, colorama, certifi, tqdm, schema, requests, click, cffi, requests-toolbelt, requests-file, cryptography, cachecontrol, idf-component-manager
  Attempting uninstall: msgpack
    Found existing installation: msgpack 1.0.4
    Uninstalling msgpack-1.0.4:
      Successfully uninstalled msgpack-1.0.4
  Attempting uninstall: lockfile
    Found existing installation: lockfile 0.12.2
    Uninstalling lockfile-0.12.2:
      Successfully uninstalled lockfile-0.12.2
  Attempting uninstall: charset-normalizer
    Found existing installation: charset-normalizer 3.0.1
    Uninstalling charset-normalizer-3.0.1:
      Successfully uninstalled charset-normalizer-3.0.1
ERROR: Could not install packages due to an OSError: [WinError 5] Zugriff verweigert: 'C:\\Users\\TenEquip\\.platformio\\penv\\Lib\\site-packages\\~.arset_normalizer\\md.cp311-win_amd64.pyd'
Check the permissions.

*** Error 1
Warning! Arduino framework as an ESP-IDF component doesn't handle the `variant` field! The default `esp32` variant will be used.
Reading CMake configuration...
-- Found Git: C:/Users/TenEquip/AppData/Local/Programs/Git/cmd/git.exe (found version "2.30.0.windows.2")
-- 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/TenEquip/.platformio/packages/toolchain-xtensa-esp32/bin/xtensa-esp32-elf-gcc.exe
-- Check for working C compiler: C:/Users/TenEquip/.platformio/packages/toolchain-xtensa-esp32/bin/xtensa-esp32-elf-gcc.exe
-- Check for working C compiler: C:/Users/TenEquip/.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/TenEquip/.platformio/packages/toolchain-xtensa-esp32/bin/xtensa-esp32-elf-g++.exe
-- Check for working CXX compiler: C:/Users/TenEquip/.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:/Users/TenEquip/Desktop/TenEquip_ESP32/.pio/build/esp32/CMakeFiles/CMakeOutput.log".

fatal: not a git repository (or any of the parent directories): .git
CMake Error at C:/Users/TenEquip/.platformio/packages/framework-espidf/tools/cmake/build.cmake:454 (message):
  C:\Users\TenEquip\.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/TenEquip/.platformio/packages/framework-espidf/tools/cmake/project.cmake:384 (idf_build_process)
  CMakeLists.txt:3 (project)

Any antivirus active?

I deactivated the windows real-time virus protection and i do not have any other antivirus installed. Still the same error.

I tried to build it again with platform = espressif32@5.1.0 in the platformio.ini file and that worked.

And explicitly switching back to 5.2.0 fails? ~~If yes, issue to https://github.com/platformio/platform-espressif32/issues.~~ Maybe this is

?

Thank you, I uninstalled Platformio and reinstalled with Kaspersky antivirus deactivated, I then created a project successfully with the antivirus still off. Once the first project was done I reactivated the antivirus and could create further projects without problems.

switching back to 5.2.0 results in the same error. I will try to investigate a bit further in the coming days. For now I can live with version 5.1.0 as well. Anyway, thank you for your help!

I maintain the platformio espressif32 fork for project Tasmota.
Back ported the pip install dependencies way from release 6.0.0 (IDF 5.0) to IDF 4.4.3. Since I do not use Windows idk if this solves.
You can try with

platform = https://github.com/Jason2866/platform-espressif32.git

With the Tasmota fork it works as well, thank you!
Also building with release 6.0.0 works.

Release 5.2.0 and 5.3.0 do not work.