乐鑫技术交流
直播中

mintsy

8年用户 1448经验值
擅长:MEMS/传感技术
私信 关注
[问答]

esp-matter使用idf.py编译light sample报错怎么解决?

在搭建好esp-matter后,编译light sample的时候报错

rck@ubuntu:~/ESP/esp-matter/examples/light$ idf.py build
/home/rck/ESP/esp-idf/tools/check_python_dependencies.py:12: DeprecationWarning: pkg_resources is deprecated as an API. See https://setuptools.pypa.io/en/latest/pkg_resources.html
  import pkg_resources
Executing action: all (aliases: build)
Running ninja in directory /home/rck/ESP/esp-matter/examples/light/build
Executing "ninja all"...
[1/1] cd /home/rck/ESP/esp-matter/examples/light/bu...tter/examples/light/build/bootloader/bootloader.binBootloader binary size 0x4ee0 bytes. 0x7120 bytes (59%) free.
[20/225] Performing build step for 'chip_gn'FAILED: esp-idf/chip/chip_gn-prefix/src/chip_gn-stamp/chip_gn-build esp-idf/chip/lib/libCHIP.a
cd /home/rck/ESP/esp-matter/examples/light/build/esp-idf/chip && ninja esp32
[16/740] ACTION //third_party/connectedhomeip/src/c...party/connectedhomeip/config/esp32/toolchain:esp32)FAILED: gen/third_party/connectedhomeip/src/controller/data_model/app/PluginApplicationCallbacks.h gen/third_party/connectedhomeip/src/controller/data_model/app/callback-stub.cpp
python ../../../../../connectedhomeip/connectedhomeip/config/esp32/third_party/connectedhomeip/third_party/pigweed/repo/pw_build/py/pw_build/python_runner.py --gn-root ../../../../../connectedhomeip/connectedhomeip/config/esp32/ --current-path ../../../../../connectedhomeip/connectedhomeip/config/esp32/third_party/connectedhomeip/src/controller/data_model --default-toolchain=//third_party/connectedhomeip/config/esp32/toolchain:esp32 --current-toolchain=//third_party/connectedhomeip/config/esp32/toolchain:esp32 --capture-output --python-dep-list-files gen/third_party/connectedhomeip/src/controller/data_model/data_model_codegen_codegen_metadata_path_list.txt -- ../../../../../connectedhomeip/connectedhomeip/config/esp32/third_party/connectedhomeip/scripts/codegen.py --generator cpp-app --output-dir gen/third_party/connectedhomeip/src/controller/data_model --expected-outputs gen/third_party/connectedhomeip/src/controller/data_model/data_model_codegen.expected.outputs ../../../../../connectedhomeip/connectedhomeip/config/esp32/third_party/connectedhomeip/src/controller/data_model/controller-clusters.matter
Traceback (most recent call last):
  File "../../../../../connectedhomeip/connectedhomeip/config/esp32/third_party/connectedhomeip/scripts/codegen.py", line 28, in
    from matter_idl.matter_idl_parser import CreateParser
ModuleNotFoundError: No module named 'matter_idl'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "../../../../../connectedhomeip/connectedhomeip/config/esp32/third_party/connectedhomeip/scripts/codegen.py", line 32, in
    from matter_idl.matter_idl_parser import CreateParser
  File "/home/rck/ESP/esp-matter/connectedhomeip/connectedhomeip/config/esp32/third_party/connectedhomeip/scripts/py_matter_idl/matter_idl/matter_idl_parser.py", line 9, in
    from lark import Lark
ModuleNotFoundError: No module named 'lark'
[18/740] ACTION //third_party/connectedhomeip/src/l...party/connectedhomeip/config/esp32/toolchain:esp32)ninja: build stopped: subcommand failed.
[22/225] Building C object esp-idf/fatfs/CMakeFiles/__idf_fatfs.dir/src/ffunicode.c.objninja: build stopped: subcommand failed.
ninja failed with exit code 1, output of the command is in the /home/rck/ESP/esp-matter/examples/light/build/log/idf_py_stderr_output_48287 and /home/rck/ESP/esp-matter/examples/light/build/log/idf_py_stdout_output_48287
                                 

回帖(2)

王璐

2024-6-11 15:00:48
 ModuleNotFoundError: No module named 'lark'
ModuleNotFoundError: No module named 'matter_idl'

根据提示,是这些 python 包没有正确安装,安装后再尝试编译。
举报

caokyo

2024-6-11 16:57:51
根据您提供的错误信息,这个问题主要是由于`pkg_resources`模块已经被弃用。为了解决这个问题,请按照以下步骤操作:

1. 首先,确保您已经安装了正确版本的Python。ESP-IDF推荐使用Python 3.7。如果您的Python版本不是3.7,请考虑升级或创建一个虚拟环境来安装Python 3.7。

2. 更新`setuptools`和`wheel`包。这两个包是Python包管理的一部分,更新它们可能会解决一些问题。在终端中运行以下命令:

```
pip install --upgrade setuptools wheel
```

3. 如果问题仍然存在,您可以尝试删除`~/.espressif`目录下的`tools`文件夹。这个文件夹包含了ESP-IDF的一些辅助工具,删除它们后,当您下次运行`idf.py`命令时,它们将被重新下载。在终端中运行以下命令:

```
rm -rf ~/.espressif/tools
```

4. 重新运行`idf.py build`命令,看看问题是否得到解决。

```
cd ~/ESP/esp-matter/examples/light
idf.py build
```

举报

更多回帖

发帖
×
20
完善资料,
赚取积分