ESP32 IDF CMake Execution Failed

Hi There

I am new to the PlatformIO ESP32 IDF framework, but I have it installed and loaded up an example espidf-blink program. However when I try to build it or even when vscode starts up on the example project, the following cmake error occurs:

CMake Error at C:/Users/%user%/.platformio/packages/framework-espidf/tools/cmake/kconfig.cmake:225 (message):Failed to run
Error Access is denied
– Configuring incomplete, errors occurred!
See also “C:/Users/%user%/Documents/PlatformIO/Projects/201101-212618-espidf-blink/build/CMakeFiles/CMakeOutput.log”.

The output log is huge and not sure what I am looking for in tbh. So from the error message, it is saying that the thing the cmake is trying to access, it has no permission to access it. So logically I setup cmake to have administrator rights but I think that its the python script that’s failing and cmake is just capturing the outcome of the execution.

So I am looking for help, as I am not entirely sure what the problem is with cmake and the script thats being executed.


Try and remove this folder and retry. Should re-download ESP-IDF in case your package download was broken.

Ok. I did that and it reinstalled, however…

  • It started complaining that cmake version C:\Users%user%.pesressif\tools\cmake\3.14.4\bin was out of date, so installed a newer version and copied the .\bin\ files to C:\Users%user%.pesressif\tools\cmake\3.18.4\bin. I also renamed the folder to the latest version I installed (3.18.4) and changed the user (not system) path environment variable to match the newly changed folder.

  • cmake then started complaining about python dependencies, so I installed the newest version of python (v3.9) and proceeded to set up the user (not system) path environment variable to match the location that python was installed (in my case it is: %AppData%\Local\Programs\Python\Python39). I also made sure that my Powershell and Command Prompt recognised the command “python” as python39 (Had to also restart vscode as well).

  • navigated to C:\Users%user%.platformio\packages\framework-espidf folder and ran the following .bat files in order: Install.bat; export.bat. This then created a new venv folder for python39 in C:\Users%user%.espressif\python_env\idf4.1_py3.9_env and installed the site-packages needed that cmake was complaining about. the export.bat file also confirmed that my requirements.txt was satisfied

I can now build the idf-blink program… finally.

Hopefully this will be useful to someone else, and I am still wondering why it didn’t work straight out the box, maybe someone can enlighten me some day.