platform-espressif32 icon indicating copy to clipboard operation
platform-espressif32 copied to clipboard

Bug: ESP-IDF build fails on [email protected] with Python AttributeError in idf_component_manager

Open Marvin2077 opened this issue 3 months ago • 7 comments

Bug Description

When using version 6.12.0 of the platform-espressif32, the build process for an ESP-IDF framework project fails during the CMake configuration phase. It throws a Python AttributeError: 'NoneType' object has no attribute 'validation_alias' inside the idf_component_manager.

This issue does not occur with version 6.7.0 of the platform, which compiles successfully.

How to Reproduce

  1. Create a new project with the following platformio.ini file, which specifies [email protected].

    [env:idf]
    platform = [email protected]
    board = esp32-pico-devkitm-2
    framework = espidf
    
  2. Create a minimal src/main.cpp file. The content doesn't matter as the error happens before compilation.

    #include "freertos/FreeRTOS.h"
    #include "freertos/task.h"
    
    extern "C" void app_main(void)
    {
        while(1) {
            vTaskDelay(pdMS_TO_TICKS(1000));
        }
    }
    
  3. Run the build command for the idf environment.

  4. The build fails.

Actual Behavior

The build process fails with the following error log. Processing idf (platform: [email protected]; framework: espidf; board: esp32-pico-devkitm-2) Verbose mode can be enabled via -v, --verbose option CONFIGURATION: https://docs.platformio.org/page/boards/espressif32/esp32-pico-devkitm-2.html PLATFORM: Espressif 32 (6.12.0) > Espressif ESP32-PICO-DevKitM-2 HARDWARE: ESP32 240MHz, 320KB RAM, 8MB 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.50500.0 (5.5.0)

tool-cmake @ 3.30.2

tool-esp-rom-elfs @ 0.0.1+20241011

tool-esptoolpy @ 2.40900.250804 (4.9.0)

tool-idf @ 1.0.1

tool-mconf @ 1.4060000.20190628 (406.0.0)

tool-ninja @ 1.9.0

tool-riscv32-esp-elf-gdb @ 11.2.0+20220823

tool-xtensa-esp-elf-gdb @ 11.2.0+20230208

toolchain-esp32ulp @ 1.23800.240113 (2.38.0)

toolchain-xtensa-esp-elf @ 14.2.0+20241119 Reading CMake configuration... -- git rev-parse returned 'fatal: not a git repository (or any of the parent directories): .git' -- Minimal build - OFF -- Could not use 'git describe' to determine PROJECT_VER. -- Building ESP-IDF components for target esp32 -- Configuring incomplete, errors occurred!

fatal: not a git repository (or any of the parent directories): .git CMake Error at C:/Users/13172/.platformio/packages/framework-espidf/tools/cmake/build.cmake:629 (message): Traceback (most recent call last):

File "", line 198, in _run_module_as_main File "", line 88, in run_code File "C:\Users\13172.platformio\penv.espidf-5.5.0\Lib\site-packages\idf_component_manager\prepare_components_main.py", line 6, in main() File "C:\Users\13172.platformio\penv.espidf-5.5.0\Lib\site-packages\idf_component_manager\prepare_components\prepare.py", line 88, in main
setup_logging() File "C:\Users\13172.platformio\penv.espidf-5.5.0\Lib\site-packages\idf_component_tools\logging.py", line 106, in setup_logging if ComponentManagerSettings().DEBUG_MODE: ^^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Users\13172.platformio\penv.espidf-5.5.0\Lib\site-packages\pydantic_settings\main.py", line 193, in init super().init( File "C:\Users\13172.platformio\penv.espidf-5.5.0\Lib\site-packages\pydantic\main.py", line 250, in init validated_self = self.pydantic_validator.validate_python(data, self_instance=self) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Users\13172.platformio\penv.espidf-5.5.0\Lib\site-packages\idf_component_tools\environment.py", line 296, in fallback_to_default
if field.validation_alias: ^^^^^^^^^^^^^^^^^^^^^^ AttributeError: 'NoneType' object has no attribute 'validation_alias'

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

Expected Behavior

The project should successfully pass the CMake configuration phase and proceed to compile the source code, just as it does with [email protected].

Additional Context / Workaround

Workaround: The issue is resolved by pinning the platform version to a stable release, such as 6.11.0. The following platformio.ini configuration works perfectly.

[env:idf]
platform = [email protected]
board = esp32-pico-devkitm-2
framework = espidf
This strongly suggests the bug was introduced somewhere between version 6.11.0 and 6.12.0.

Environment
Operating System: Windows 10/11

PlatformIO Core Version: 6.1.18

Marvin2077 avatar Oct 08 '25 15:10 Marvin2077

Similar issue i am trying to find the cause. I have a feeling a library was updated somewhere.

Pimmetje avatar Oct 08 '25 15:10 Pimmetje

https://github.com/espressif/esp-idf/issues/17714 https://github.com/espressif/idf-component-manager/issues/97

Downgrading to pip install pydantic==2.11.10 should fix it (testing now)

Pimmetje avatar Oct 08 '25 16:10 Pimmetje

I found this to be an issue with Python 3.14 being in the environment. Platformio does not check the python version properly.

Describe the Bug

Compilation for any project using the ESP-IDF framework (specifically observed on the ESP32-C6) fails consistently on macOS Apple Silicon, even after clean installations. The failure is caused by the PlatformIO toolchain installation scripts running against an incompatible Python version.

Environment

  • Operating System: macOS Apple Silicon (M1/M4, running latest OS/Homebrew).
  • Toolchain: PlatformIO Core (used via ESPHome 2025.10.5).
  • Target Board: esp32-c6-devkitc-1.
  • System Python: Confirmed global default is Python 3.9.6. (Python 3.14 is NOT exposed in the global $PATH).

Failure Details

The build process fails during the internal setup of the ESP-IDF toolchain dependencies. This error occurs because a Python 3.14 interpreter is being implicitly used by PlatformIO for dependency installation, despite being incompatible with the necessary tools.

Error Trace:

The Root Cause (Internal Failure)

Since the system's global Python is confirmed to be 3.9.6, the Python 3.14 environment that causes the break must be provided internally by the PlatformIO installation process itself or by the Homebrew ESPHome formula that sets up the PlatformIO execution environment.

This confirms that the incompatibility is not external PATH contamination, but an internal toolchain failure to correctly isolate or use a stable Python version for dependency installation.

Request

Please investigate why the ESP-IDF dependency installation within this PlatformIO package fails when run by Python 3.14, and implement a check to ensure a compatible Python version (like 3.13) is explicitly used for the toolchain setup on macOS Apple Silicon.


n0tf0und avatar Nov 16 '25 12:11 n0tf0und

Fork pioarduino does check Python version and stops when Python v3.14 is used in venv of Platformio. IDF tools and toolchains does not support Python v3.14 (yet)

Btw. esphome has fixed this issue already in latest development version. It forces install of Python v3.13.

Jason2866 avatar Nov 16 '25 13:11 Jason2866

It does stop with an error, but the environment includes a compatible version of Python and it is not used… Only by uninstalling 3.14 from the environment will the compile complete.

On Nov 16, 2025, at 8:59 AM, Jason2866 @.***> wrote:

Jason2866 left a comment (platformio/platform-espressif32#1663) https://github.com/platformio/platform-espressif32/issues/1663#issuecomment-3538782793 Fork pioarduino does check Python version and stops when Python v3.14 is used in venv of Platformio. IDF tools and toolchains does not support Python v3.14 (yet)

— Reply to this email directly, view it on GitHub https://github.com/platformio/platform-espressif32/issues/1663#issuecomment-3538782793, or unsubscribe https://github.com/notifications/unsubscribe-auth/AEENM7CLSLPY5GKPXFS7RV335B7LZAVCNFSM6AAAAACIUOJAFSVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZTKMZYG44DENZZGM. You are receiving this because you commented.

n0tf0und avatar Nov 16 '25 14:11 n0tf0und

It does stop with an error, but the environment includes a compatible version of Python and it is not used… Only by uninstalling 3.14 from the environment will the compile complete.

This is an esphome issue

Jason2866 avatar Nov 16 '25 14:11 Jason2866

Agreed. ESPHOME 2025.10.5 release notes: Repository: esphome/esphome https://github.com/esphome/esphome · Tag: 2025.10.5 https://github.com/esphome/esphome/tree/2025.10.5 · Commit: 47a7f72 https://github.com/esphome/esphome/commit/47a7f729dd0dcd4db413f883ec2461273c7aa7c7 · Released by: swoboda1337 https://github.com/swoboda1337 [const] Add CONF_ROWS esphome#11249 https://github.com/esphome/esphome/pull/11249 by @stuartparmenter https://github.com/stuartparmenter [core] Don't allow python 3.14 esphome#11527 https://github.com/esphome/esphome/pull/11527 by @swoboda1337 https://github.com/swoboda1337 [usb_uart] Fixes for transfer queue allocation esphome#11548 https://github.com/esphome/esphome/pull/11548 by @clydebarrow https://github.com/clydebarrow [lvgl] Fix rotation with unusual width esphome#11680 https://github.com/esphome/esphome/pull/11680 by @clydebarrow https://github.com/clydebarrow Why did build 2025.10.5 allow 3.14 to be used in Platformio? I am using Homebrew to manage versions. And the ESPhome ui dashboard to compile on a Mac All latest versions. A comparable Python 3.13 was listed in the env.

On Nov 16, 2025, at 9:46 AM, Jason2866 @.***> wrote:

Jason2866 left a comment (platformio/platform-espressif32#1663) https://github.com/platformio/platform-espressif32/issues/1663#issuecomment-3538825322 It does stop with an error, but the environment includes a compatible version of Python and it is not used… Only by uninstalling 3.14 from the environment will the compile complete. … x-msg://2/# This is an esphome issue

— Reply to this email directly, view it on GitHub https://github.com/platformio/platform-espressif32/issues/1663#issuecomment-3538825322, or unsubscribe https://github.com/notifications/unsubscribe-auth/AEENM7C35VGKARP3DI7SOQT35CE43AVCNFSM6AAAAACIUOJAFSVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZTKMZYHAZDKMZSGI. You are receiving this because you commented.

n0tf0und avatar Nov 16 '25 18:11 n0tf0und

This issue has been automatically marked as stale because it has not had recent activity. Please provide more details or it will be closed if no further activity occurs. Thank you for your contributions.

stale[bot] avatar Dec 18 '25 01:12 stale[bot]