Error creating projects: pkg_resources issue?

I am a brand new platformio IDE v3.3.3 user on fedora 39 linux using vscode 1.86.1. I installed platformio from within vscode and am trying to create a new esp-idf project. The errors I am getting are pasted below. What am I doing wrong? Before I installed platformio, I was able to create projects and build with the espressif vscode extension. Do I maybe has some kind of comflict from multiple esp-idf installs? Is it OK to have both the espressif and platformio extensions installed?

Thank you!

Could not initialize project PIO Core Call Error: "The following
files/directories have been created in
/home/me/PlatformioProjects/logger
include - Put project header
files here
lib - Put project specific (private) libraries here
src -
Put project source files here
platformio.ini - Project Configuration
File
Resolving esp32-s3-devkitc-1 dependencies...
Already
up-to-date.
Updating metadata for the vscode
IDE...


UserSideException: Processing esp32-s3-devkitc-1
(platform: espressif32; board: esp32-s3-devkitc-1; framework:
espidf)
--------------------------------------------------------------------------------
Verbose
mode can be enabled via `-v, --verbose` option
CONFIGURATION:
https://docs.platformio.org/page/boards/espressif32/esp32-s3-devkitc-1.html
PLATFORM:
Espressif 32 (6.5.0) > Espressif ESP32-S3-DevKitC-1-N8 (8 MB QD, No
PSRAM)
HARDWARE: ESP32S3 240MHz, 320KB RAM, 8MB Flash
DEBUG: Current
(esp-builtin) On-board (esp-builtin) 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.50102.240122 (5.1.2) 
 -
tool-cmake @ 3.16.4 
 - tool-esptoolpy @ 1.40501.0 (4.5.1) 
 -
tool-ninja @ 1.7.1 
 - tool-riscv32-esp-elf-gdb @ 12.1.0+20221002 

- tool-xtensa-esp-elf-gdb @ 12.1.0+20221002 
 - toolchain-esp32ulp @
1.23500.220830 (2.35.0) 
 - toolchain-riscv32-esp @ 12.2.0+20230208

 - toolchain-xtensa-esp32s3 @ 12.2.0+20230208
ModuleNotFoundError:
No module named 'pkg_resources':
 File
\"/home/me/.platformio/penv/lib64/python3.12/site-packages/platformio/builder/main.py\",
line 173:
 env.SConscript(\"$BUILD_SCRIPT\")
 File
\"/home/me/.platformio/packages/tool-scons/scons-local-4.6.0/SCons/Script/SConscript.py\",
line 609:
 return _SConscript(self.fs, *files, **subst_kw)
 File
\"/home/me/.platformio/packages/tool-scons/scons-local-4.6.0/SCons/Script/SConscript.py\",
line 279:
 exec(compile(scriptdata, scriptname, 'exec'),
call_stack[-1].globals)
 File
\"/home/me/.platformio/platforms/espressif32/builder/main.py\",
line 346:
 target_elf = env.BuildProgram()
 File
\"/home/me/.platformio/packages/tool-scons/scons-local-4.6.0/SCons/Util/envs.py\",
line 251:
 return self.method(*nargs, **kwargs)
 File
\"/home/me/.platformio/penv/lib64/python3.12/site-packages/platformio/builder/tools/piobuild.py\",
line 61:
 env.ProcessProgramDeps()
 File
\"/home/me/.platformio/packages/tool-scons/scons-local-4.6.0/SCons/Util/envs.py\",
line 251:
 return self.method(*nargs, **kwargs)
 File
\"/home/me/.platformio/penv/lib64/python3.12/site-packages/platformio/builder/tools/piobuild.py\",
line 121:
 env.BuildFrameworks(env.get(\"PIOFRAMEWORK\"))
 File
\"/home/me/.platformio/packages/tool-scons/scons-local-4.6.0/SCons/Util/envs.py\",
line 251:
 return self.method(*nargs, **kwargs)
 File
\"/home/me/.platformio/penv/lib64/python3.12/site-packages/platformio/builder/tools/piobuild.py\",
line 347:
 SConscript(env.GetFrameworkScript(name),
exports=\"env\")
 File
\"/home/me/.platformio/packages/tool-scons/scons-local-4.6.0/SCons/Script/SConscript.py\",
line 673:
 return method(*args, **kw)
 File
\"/home/me/.platformio/packages/tool-scons/scons-local-4.6.0/SCons/Script/SConscript.py\",
line 609:
 return _SConscript(self.fs, *files, **subst_kw)
 File
\"/home/me/.platformio/packages/tool-scons/scons-local-4.6.0/SCons/Script/SConscript.py\",
line 279:
 exec(compile(scriptdata, scriptname, 'exec'),
call_stack[-1].globals)
 File
\"/home/me/.platformio/platforms/espressif32/builder/frameworks/espidf.py\",
line 29:
 import pkg_resources
========================== [FAILED]
Took 0.32 seconds =========================="

Was already fixed in

as discussed in this issue. Please try and set platform = https://github.com/platformio/platform-espressif32.git for now

1 Like

Thank you for your help!

That works, but I’m trying to build the platformio examples and when I create a project, the error prevents some of the example project files from being put in the correct directories. Once it has been created, I can edit the platform variable and it’s downloaded but the project is still missing some example files because of the failed creation. What is the way to work around this, please? Normally, when there are updates to code on git, I will just do a git update to get the latest fixes, but platformio is installed as a vscode extension rather than using git directly.

A simple way is to make this bleeding edge version the default while a new version is not yet released.

  1. Remove C:\Users\<user>\.platformio\platforms\espressif32*
  2. Open a PIO Core CLI
  3. Execute pio pkg install -g -p "https://github.com/platformio/platform-espressif32.git"

Any new project should automatically use the corrected version.

2 Likes

Thank you for the share information!
Tellthebell

Excellent! Thank you very much! IMHO, This procedure should be in the FAQ and/or stickied for people who are having issues and need/want to try the latest version.

I’m on linux so it was in ~/.platformio/platforms/espressif32* but that was obvious.