platform-espressif32: Project Initialization fails during Dependency Check (ESP32 Dev Module)

Configuration

Operating system: macOS 13.2.1 (22D68)

PlatformIO Version (platformio --version): PlatformIO Core, version 6.1.6

Description of problem

When creating a project for Espressif ESP32 Dev Module, the project initialization fails during dependency check with the below exception

Steps to Reproduce

  1. Fresh installation of VS Code
  2. Fresh installation of PlatformIO
  3. Create Project for ESP32 Dev Module (ESP-IDF)

Actual Results

Project Init fails

Expected Results

Project should be successfully created

If problems with PlatformIO Build System:

The content of OUTPUT:

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.9.0 
 - toolchain-esp32ulp @ 1.23500.220830 (2.35.0) 
 - toolchain-xtensa-esp32 @ 11.2.0+2022r1
Creating a virtual environment for IDF Python dependencies
Installing ESP-IDF's Python dependencies
Collecting cryptography
  Using cached cryptography-39.0.1-cp36-abi3-macosx_10_12_universal2.whl (5.4 MB)
Collecting future
  Using cached future-0.18.3.tar.gz (840 kB)
  Preparing metadata (setup.py): started
  Preparing metadata (setup.py): finished with status 'done'
Collecting pyparsing
  Using cached pyparsing-3.0.9-py3-none-any.whl (98 kB)
Collecting kconfiglib
  Using cached kconfiglib-14.1.0-py2.py3-none-any.whl (145 kB)
Collecting idf-component-manager
  Using cached idf_component_manager-1.2.2-py3-none-any.whl (116 kB)
Collecting cffi>=1.12
  Using cached cffi-1.15.1-cp311-cp311-macosx_11_0_arm64.whl (174 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-macosx_11_0_arm64.whl (167 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-macosx_10_9_universal2.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-macosx_11_0_arm64.whl (121 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, tqdm, six, pyyaml, pyparsing, pycparser, packaging, kconfiglib, idna, future, contextlib2, colorama, click, certifi, schema, requests, cffi, requests-toolbelt, requests-file, cryptography, cachecontrol, idf-component-manager
  DEPRECATION: future is being installed using the legacy 'setup.py install' method, because it does not have a 'pyproject.toml' and the 'wheel' package is not installed. pip 23.1 will enforce this behaviour change. A possible replacement is to enable the '--use-pep517' option. Discussion can be found at https://github.com/pypa/pip/issues/8559
  Running setup.py install for future: started
  Running setup.py install for future: finished with status 'done'
Successfully installed cachecontrol-0.12.11 certifi-2022.12.7 cffi-1.15.1 charset-normalizer-3.0.1 click-8.1.3 colorama-0.4.6 contextlib2-21.6.0 cryptography-39.0.1 future-0.18.3 idf-component-manager-1.2.2 idna-3.4 kconfiglib-14.1.0 lockfile-0.12.2 msgpack-1.0.4 packaging-23.0 pycparser-2.21 pyparsing-3.0.9 pyyaml-6.0 requests-2.28.2 requests-file-1.5.1 requests-toolbelt-0.10.1 schema-0.7.5 six-1.16.0 tqdm-4.64.1 urllib3-1.26.14

[notice] A new release of pip available: 22.3.1 -> 23.0.1
[notice] To update, run: python -m pip install --upgrade pip
Reading CMake configuration...
-- 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 "/Users/dmuellner/Development/Projects/Embedded/ESP32/wrapOS/.pio/build/esp32dev/CMakeFiles/CMakeOutput.log".

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

    File "/Users/dmuellner/.platformio/penv/.espidf-5.0.0/lib/python3.11/site-packages/requests/compat.py", line 11, in <module>
      import chardet

  ModuleNotFoundError: No module named 'chardet'

  

  During handling of the above exception, another exception occurred:

  

  Traceback (most recent call last):

    File "<frozen runpy>", line 198, in _run_module_as_main
    File "<frozen runpy>", line 88, in _run_code
    File "/Users/dmuellner/.platformio/penv/.espidf-5.0.0/lib/python3.11/site-packages/idf_component_manager/prepare_components/__main__.py", line 4, in <module>
      from .prepare import main
    File "/Users/dmuellner/.platformio/penv/.espidf-5.0.0/lib/python3.11/site-packages/idf_component_manager/prepare_components/prepare.py", line 18, in <module>
      from ..core import ComponentManager
    File "/Users/dmuellner/.platformio/penv/.espidf-5.0.0/lib/python3.11/site-packages/idf_component_manager/core.py", line 17, in <module>
      import requests
    File "/Users/dmuellner/.platformio/penv/.espidf-5.0.0/lib/python3.11/site-packages/requests/__init__.py", line 45, in <module>
      from .exceptions import RequestsDependencyWarning
    File "/Users/dmuellner/.platformio/penv/.espidf-5.0.0/lib/python3.11/site-packages/requests/exceptions.py", line 9, in <module>
      from .compat import JSONDecodeError as CompatJSONDecodeError
    File "/Users/dmuellner/.platformio/penv/.espidf-5.0.0/lib/python3.11/site-packages/requests/compat.py", line 13, in <module>
      import charset_normalizer as chardet
    File "/Users/dmuellner/.platformio/penv/.espidf-5.0.0/lib/python3.11/site-packages/charset_normalizer/__init__.py", line 24, in <module>
      from .api import from_bytes, from_fp, from_path
    File "/Users/dmuellner/.platformio/penv/.espidf-5.0.0/lib/python3.11/site-packages/charset_normalizer/api.py", line 5, in <module>
      from .cd import (
    File "/Users/dmuellner/.platformio/penv/.espidf-5.0.0/lib/python3.11/site-packages/charset_normalizer/cd.py", line 9, in <module>
      from .md import is_suspiciously_successive_range

  ImportError:
  dlopen(/Users/dmuellner/.platformio/penv/.espidf-5.0.0/lib/python3.11/site-packages/charset_normalizer/md.cpython-311-darwin.so,
  0x0002): tried:
  '/Users/dmuellner/.platformio/penv/.espidf-5.0.0/lib/python3.11/site-packages/charset_normalizer/md.cpython-311-darwin.so'
  (mach-o file, but is an incompatible architecture (have 'arm64', need
  'x86_64')),
  '/System/Volumes/Preboot/Cryptexes/OS/Users/dmuellner/.platformio/penv/.espidf-5.0.0/lib/python3.11/site-packages/charset_normalizer/md.cpython-311-darwin.so'
  (no such file),
  '/Users/dmuellner/.platformio/penv/.espidf-5.0.0/lib/python3.11/site-packages/charset_normalizer/md.cpython-311-darwin.so'
  (mach-o file, but is an incompatible architecture (have 'arm64', need
  'x86_64'))

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



========================== [FAILED] Took 6.57 seconds ========
==================

Additional info

Running a fresh installation of macOS Python version 3.11 (pip 23.0.1) certifi has been installed to provide the required SSL/TLS certificates

About this issue

  • Original URL
  • State: open
  • Created a year ago
  • Comments: 36 (8 by maintainers)

Most upvoted comments

just following up that the fix described here: https://community.platformio.org/t/error-running-platformio-espidf-on-apple-m1-mac/32403/3

where the chardet lib needs to be copied from

.platformio/penv/.espidf-5.0.0/lib/python3.10/site-packages/pip/_vendor/chardet

to:

.platformio/penv/.espidf-5.0.0/lib/python3.10/site-packages

worked for me.