cancel
Showing results for 
Search instead for 
Did you mean: 

errors when I ran the chef.py example in Step 4 in the Build a Matter virtual device tutorial

kencottrell
Community Member

here in https://developers.home.google.com/codelabs/matter-device-virtual#1

 

I tried to run this command inside the docker image, from the gitlab examples/chef repo:

./chef.py -zbr -d rootnode_dimmablelight_bCwGYSDpoe -t linux

it ran for awhile but errored out with this trace:

 


______ __ __ _______ _______
/ || | | | | ____|| ____|
| ,----'| |__| | | |__ | |__
| | | __ | | __| | __|
| `----.| | | | | |____ | |
\______||__| |__| |_______||__|

Target is set to rootnode_dimmablelight_bCwGYSDpoe
Setting up environment...
/workspace/MatterIOT/connectedhomeip/examples/chef/../..//scripts/activate.sh: line 122: scripts/setup/gen_pigweed_cipd_json.py: No such file or directory

WELCOME TO...

< CHEF banner stuff..... . > 

ACTIVATOR! This sets your shell environment variables.

Activating environment (setting environment variables):

Setting environment variables for CIPD package manager...done
warning: pattern /workspace/MatterIOT/connectedhomeip/.environment/pigweed.json matched 0 files
Setting environment variables for Project actions........skipped
Setting environment variables for Python environment.....done
Setting environment variables for pw packages............skipped
Setting environment variables for Host tools.............done

Checking the environment:

Traceback (most recent call last):
File "/workspace/MatterIOT/connectedhomeip/.environment/pigweed-venv/lib/python3.9/site-packages/pw_cli/plugins.py", line 96, in from_name
module = importlib.import_module(module_name)
File "/usr/lib/python3.9/importlib/__init__.py", line 127, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File "<frozen importlib._bootstrap>", line 1030, in _gcd_import
File "<frozen importlib._bootstrap>", line 1007, in _find_and_load
File "<frozen importlib._bootstrap>", line 972, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 228, in _call_with_frames_removed
File "<frozen importlib._bootstrap>", line 1030, in _gcd_import
File "<frozen importlib._bootstrap>", line 1007, in _find_and_load
File "<frozen importlib._bootstrap>", line 986, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 680, in _load_unlocked
File "<frozen importlib._bootstrap_external>", line 855, in exec_module
File "<frozen importlib._bootstrap>", line 228, in _call_with_frames_removed
File "/workspace/MatterIOT/connectedhomeip/.environment/pigweed-venv/lib/python3.9/site-packages/pw_unit_test/__init__.py", line 16, in <module>
from pw_unit_test.rpc import (
File "/workspace/MatterIOT/connectedhomeip/.environment/pigweed-venv/lib/python3.9/site-packages/pw_unit_test/rpc.py", line 22, in <module>
from pw_rpc.client import Services
File "/workspace/MatterIOT/connectedhomeip/.environment/pigweed-venv/lib/python3.9/site-packages/pw_rpc/__init__.py", line 20, in <module>
from pw_rpc.client import Client
File "/workspace/MatterIOT/connectedhomeip/.environment/pigweed-venv/lib/python3.9/site-packages/pw_rpc/client.py", line 32, in <module>
from pw_rpc import descriptors, packets
File "/workspace/MatterIOT/connectedhomeip/.environment/pigweed-venv/lib/python3.9/site-packages/pw_rpc/packets.py", line 22, in <module>
from pw_rpc.internal import packet_pb2
File "/workspace/MatterIOT/connectedhomeip/.environment/pigweed-venv/lib/python3.9/site-packages/pw_rpc/internal/packet_pb2.py", line 33, in <module>
_descriptor.EnumValueDescriptor(
File "/workspace/MatterIOT/connectedhomeip/.environment/pigweed-venv/lib/python3.9/site-packages/google/protobuf/descriptor.py", line 796, in __new__
_message.Message._CheckCalledFromGeneratedFile()
TypeError: Descriptors cannot not be created directly.
If this call came from a _pb2.py file, your generated code is out of date and must be regenerated with protoc >= 3.19.0.
If you cannot immediately regenerate your protos, some other possible workarounds are:
1. Downgrade the protobuf package to 3.20.x or lower.
2. Set PROTOCOL_BUFFERS_PYTHON_IMPLEMENTATION=python (but this will use pure-Python parsing and will be much slower).

More information: https://developers.google.com/protocol-buffers/docs/news/2022-05-06#python-updates

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
File "/workspace/MatterIOT/connectedhomeip/.environment/pigweed-venv/bin/pw", line 8, in <module>
sys.exit(main())
File "/workspace/MatterIOT/connectedhomeip/.environment/pigweed-venv/lib/python3.9/site-packages/pw_cli/__main__.py", line 43, in main
pw_command_plugins.register()
File "/workspace/MatterIOT/connectedhomeip/.environment/pigweed-venv/lib/python3.9/site-packages/pw_cli/pw_command_plugins.py", line 65, in register
_register_builtin_plugins(plugin_registry)
File "/workspace/MatterIOT/connectedhomeip/.environment/pigweed-venv/lib/python3.9/site-packages/pw_cli/pw_command_plugins.py", line 42, in _register_builtin_plugins
registry.register_by_name('test', 'pw_unit_test.test_runner', 'main')
File "/workspace/MatterIOT/connectedhomeip/.environment/pigweed-venv/lib/python3.9/site-packages/pw_cli/plugins.py", line 303, in register_by_name
Plugin.from_name(name, module_name, member_name, source)
File "/workspace/MatterIOT/connectedhomeip/.environment/pigweed-venv/lib/python3.9/site-packages/pw_cli/plugins.py", line 104, in from_name
raise Error(f'Failed to import module "{module_name}"') from err
pw_cli.plugins.Error: Failed to import module "pw_unit_test.test_runner" (TypeError: Descriptors cannot not be created directly.
If this call came from a _pb2.py file, your generated code is out of date and must be regenerated with protoc >= 3.19.0.
If you cannot immediately regenerate your protos, some other possible workarounds are:
1. Downgrade the protobuf package to 3.20.x or lower.
2. Set PROTOCOL_BUFFERS_PYTHON_IMPLEMENTATION=python (but this will use pure-Python parsing and will be much slower).

More information: https://developers.google.com/protocol-buffers/docs/news/2022-05-06#python-updates)
Error during activate--see messages above.
Running ZAP script to generate artifacts
Searching for zcl file from /workspace/MatterIOT/connectedhomeip/examples/chef/devices/rootnode_dimmablelight_bCwGYSDpoe.zap
🔧 Using temporary state directory: /tmp/zap7g29b5vi/zap.Bpsz9a
🤖 ZAP generation started:
🔍 input files: /workspace/MatterIOT/connectedhomeip/examples/chef/devices/rootnode_dimmablelight_bCwGYSDpoe.zap
🔍 output pattern: /workspace/MatterIOT/connectedhomeip/examples/chef/out/rootnode_dimmablelight_bCwGYSDpoe/zap-generated/
🔍 using templates: /workspace/MatterIOT/connectedhomeip/src/app/zap-templates/matter-idl-server.json
🔍 using zcl data: /workspace/MatterIOT/connectedhomeip/src/app/zap-templates/zcl/zcl.json
🔍 zap version: ver. 2023.11.28, featureLevel 99, commit: 346129357ae10897c17be991b6220989e3f3d7bf from 2023-11-28T14:03:50.000Z, mode: binary, exe: zap-cli
🕐 Setup time: 3s 91ms
👉 using input file: /workspace/MatterIOT/connectedhomeip/examples/chef/devices/rootnode_dimmablelight_bCwGYSDpoe.zap
👉 using output destination: /workspace/MatterIOT/connectedhomeip/examples/chef/out/rootnode_dimmablelight_bCwGYSDpoe/zap-generated/
🕐 File loading time: 92ms
🤖 Generating files:
✍ /workspace/MatterIOT/connectedhomeip/examples/chef/out/rootnode_dimmablelight_bCwGYSDpoe/zap-generated/Clusters.matter
🕐 Generation time: 296ms
Files generated in: /workspace/MatterIOT/connectedhomeip/examples/chef/out/rootnode_dimmablelight_bCwGYSDpoe/zap-generated/
RPC PW enabled
RPC PW on linux not supported
Software Version String: ""
Product ID 0x8000 / Vendor ID 0xFFF1
Building...
x86_64
ERROR at //third_party/connectedhomeip/third_party/pigweed/repo/third_party/nanopb/BUILD.gn:68:21: Empty directory path.
rebase_path(pw_protobuf_compiler_PROTOC_BINARY, "//", root_build_dir)
^---------------------------------
You can't use empty strings as directories.
See //third_party/connectedhomeip/third_party/pigweed/repo/pw_protobuf_compiler/proto.gni:286:21: which caused the file to be included.
"$dir_pw_third_party/nanopb",
^---------------------------
Traceback (most recent call last):
File "/workspace/MatterIOT/connectedhomeip/examples/chef/./chef.py", line 1010, in <module>
sys.exit(main())
File "/workspace/MatterIOT/connectedhomeip/examples/chef/./chef.py", line 870, in main
shell.run_cmd("gn gen out")
File "/workspace/MatterIOT/connectedhomeip/examples/chef/stateful_shell.py", line 139, in run_cmd
raise RuntimeError(
RuntimeError: Error. Nonzero return code.
Returncode: 1
Cmd: gn gen out
matter@ken-HP-ProDesk-600-G1-SFF:/workspace/MatterIOT/connectedhomeip/examples/chef$

1 Recommended Answer

armen_dpe
Solutions Expert
Solutions Expert

If you've encountered issues with your ConnectedHomeIp setup, follow these steps to ensure a clean environment and resolve potential package version conflicts.
Consider resetting your ConnectedHomeIp setup(rm -rf ~/connectedhomeip) and run below commands:

1. On a Linux laptop, download the ConnectedHomeIp repo:

git clone https://github.com/project-chip/connectedhomeip.git

2. Open up the downloaded repository:

cd connectedhomeip

3. Check out the most recent commit touching the project:

git checkout 4f65f6c

4. Update all the sub-moduldes within the repository:

git submodule update --init --recursive

5. Run the bootstrap script, setting up the repo and establishing a python virtual environment:

source ./scripts/bootstrap.sh

6. Open up the chef folder containing virtual device examples:

cd examples/chef/

7. Ran the chef.py for the first time, which configures a config.yaml that can be further updated:

chef.py -u

8. Built the virtual device using the dimmable light example:

./chef.py -zbr -d rootnode_dimmablelight_bCwGYSDpoe -t linux

View Recommended Answer in original post

1 REPLY 1

armen_dpe
Solutions Expert
Solutions Expert

If you've encountered issues with your ConnectedHomeIp setup, follow these steps to ensure a clean environment and resolve potential package version conflicts.
Consider resetting your ConnectedHomeIp setup(rm -rf ~/connectedhomeip) and run below commands:

1. On a Linux laptop, download the ConnectedHomeIp repo:

git clone https://github.com/project-chip/connectedhomeip.git

2. Open up the downloaded repository:

cd connectedhomeip

3. Check out the most recent commit touching the project:

git checkout 4f65f6c

4. Update all the sub-moduldes within the repository:

git submodule update --init --recursive

5. Run the bootstrap script, setting up the repo and establishing a python virtual environment:

source ./scripts/bootstrap.sh

6. Open up the chef folder containing virtual device examples:

cd examples/chef/

7. Ran the chef.py for the first time, which configures a config.yaml that can be further updated:

chef.py -u

8. Built the virtual device using the dimmable light example:

./chef.py -zbr -d rootnode_dimmablelight_bCwGYSDpoe -t linux