Could not initialize project Espressif IoT development Framework

I get an error every time I want to initialize a project with Espressif esp32 dev Module. If I use arduino as framework it works.

But I want to use the Espressif IoT development Framework. When I do it, I always get the following error (on Linux 20.04 with vscode):

Could not initialize project.

PIO Core Call Error: “The current working directory /home/myUser/Documents/PlatformIO/Projects/testEsp32 will be used for the project.

The next files/directories have been created in /home/myUser/Documents/PlatformIO/Projects/testEsp32
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 esp32dev dependencies…
Already up-to-date.
Updating metadata for the vscode IDE…


Error: Processing esp32dev (platform: espressif32; board: esp32dev; framework: espidf)
--------------------------------------------------------------------------------
Verbose mode can be enabled via -v, --verbose option
CONFIGURATION: https://docs.platformio.org/page/boards/espressif32/esp32dev.html
PLATFORM: Espressif 32 (6.0.1) > Espressif ESP32 Dev Module
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.50000.0 (5.0.0) 
 - tool-cmake @ 3.16.4 
 - tool-esptoolpy @ 1.40400.0 (4.4.0) 
 - tool-ninja @ 1.7.1 
 - toolchain-esp32ulp @ 1.23500.220830 (2.35.0) 
 - toolchain-xtensa-esp32 @ 11.2.0+2022r1
/home/myUser/.platformio/penv/.espidf-5.0.0/bin/python: No module named pip
CalledProcessError: Command ‘[’/home/myUser/.platformio/penv/.espidf-5.0.0/bin/python’, ‘-m’, ‘pip’, ‘list’, ‘–format=json’, ‘–disable-pip-version-check’]’ returned non-zero exit status 1.:
 File "/home/myUser/.platformio/penv/lib/python3.8/site-packages/platformio/builder/main.py", line 187:
 env.SConscript("$BUILD_SCRIPT")
 File "/home/myUser/.platformio/packages/tool-scons/scons-local-4.4.0/SCons/Script/SConscript.py", line 597:
 return _SConscript(self.fs, *files, **subst_kw)
 File "/home/myUser/.platformio/packages/tool-scons/scons-local-4.4.0/SCons/Script/SConscript.py", line 285:
 exec(compile(scriptdata, scriptname, ‘exec’), call_stack[-1].globals)
 File "/home/myUser/.platformio/platforms/espressif32/builder/main.py", line 312:
 target_elf = env.BuildProgram()
 File "/home/myUser/.platformio/packages/tool-scons/scons-local-4.4.0/SCons/Util.py", line 737:
 return self.method(*nargs, **kwargs)
 File "/home/myUser/.platformio/penv/lib/python3.8/site-packages/platformio/builder/tools/piobuild.py", line 60:
 env.ProcessProgramDeps()
 File "/home/myUser/.platformio/packages/tool-scons/scons-local-4.4.0/SCons/Util.py", line 737:
 return self.method(*nargs, **kwargs)
 File "/home/myUser/.platformio/penv/lib/python3.8/site-packages/platformio/builder/tools/piobuild.py", line 120:
 env.BuildFrameworks(env.get("PIOFRAMEWORK"))
 File "/home/myUser/.platformio/packages/tool-scons/scons-local-4.4.0/SCons/Util.py", line 737:
 return self.method(*nargs, **kwargs)
 File "/home/myUser/.platformio/penv/lib/python3.8/site-packages/platformio/builder/tools/piobuild.py", line 331:
 SConscript(env.GetFrameworkScript(name), exports="env")
 File "/home/myUser/.platformio/packages/tool-scons/scons-local-4.4.0/SCons/Script/SConscript.py", line 660:
 return method(*args, **kw)
 File "/home/myUser/.platformio/packages/tool-scons/scons-local-4.4.0/SCons/Script/SConscript.py", line 597:
 return _SConscript(self.fs, *files, **subst_kw)
 File "/home/myUser/.platformio/packages/tool-scons/scons-local-4.4.0/SCons/Script/SConscript.py", line 285:
 exec(compile(scriptdata, scriptname, ‘exec’), call_stack[-1].globals)
 File "/home/myUser/.platformio/platforms/espressif32/builder/frameworks/espidf.py", line 1187:
 install_python_deps()
 File "/home/myUser/.platformio/platforms/espressif32/builder/frameworks/espidf.py", line 1096:
 installed_packages = _get_installed_pip_packages(python_exe_path)
 File "/home/myUser/.platformio/platforms/espressif32/builder/frameworks/espidf.py", line 1062:
 pip_output = subprocess.check_output(
 File "/usr/lib/python3.8/subprocess.py", line 415:
 return run(*popenargs, stdout=PIPE, timeout=timeout, check=True,
 File "/usr/lib/python3.8/subprocess.py", line 516:
 raise CalledProcessError(retcode, process.args,
========================== [FAILED] Took 0.33 seconds ==========================”

Do you have the ESP-IDF VSCode extension installed alongside PlatformIO? This could cause problems.

Yes I had it and then I removed it but I didn’t work. Should I remove it from .vscode/extensions?

Deactivate the ESP-IDF extension if still active, then remove your /home/myUser/.platformio/penv/.espidf-5.0.0 folder. It should hopefully trigger the correct creation of the virtual enviornment in the next build run.

I locally tested compiling the <user folder>\.platformio\platforms\espressif32\examples\espidf-hello-world example on the latest platform version and it worked fine.

1 Like

Thank you very much for the quick response!

I deleted the ESP-IDF VSCode from .vscode/extensions (and remove it from .vscode/extension.json) and did what you told me (rm -r /home/myUser/.platformio/penv/.espidf-5.0.0) and it worked correctly.

Maybe deactivating the extension also worked, but I had already deleted it.