Cannot run ZAP tool

Hi - I am trying to modify the Matter template sample with my own clusters as documented in: https://developer.nordicsemi.com/nRF_Connect_SDK/doc/2.3.0/nrf/protocols/matter/getting_started/adding_clusters.html#ug-matter-creating-accessory 

I was previously able to do so when using v.2.1.0 of the SDK. 

Now, with a clean install of v.2.3.0 of the SDK I am getting the following errors when trying to install ZAP. I am on Mac OS 13.1 (22C65). I welcome any guidance or suggestions.

Thanks! Dan.

Fullscreen
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
me@MacBook-Pro matter % python scripts/setup/nrfconnect/get_zap.py -l location_path -o
zsh: exec format error: python
me@MacBook-Pro matter % which python
/opt/nordic/ncs/toolchains/v2.3.0/opt/nanopb/generator-bin/python
me@MacBook-Pro matter % which python3
/opt/homebrew/bin/python3
me@MacBook-Pro matter % python3 scripts/setup/nrfconnect/get_zap.py -l location_path -o
Traceback (most recent call last):
File "/opt/nordic/ncs/v2.3.0/modules/lib/matter/scripts/setup/nrfconnect/get_zap.py", line 28, in <module>
import wget
ModuleNotFoundError: No module named 'wget'
me@MacBook-Pro matter % pip3 install wget
Collecting wget
Using cached wget-3.2.zip (10 kB)
Preparing metadata (setup.py) ... done
Building wheels for collected packages: wget
Building wheel for wget (setup.py) ... done
Created wheel for wget: filename=wget-3.2-py3-none-any.whl size=9657 sha256=05955f85a61d307f1926a82c06079ab90316f4d8c22b1e10d9fb857a7aadcd95
Stored in directory: /Users/me/Library/Caches/pip/wheels/40/b3/0f/a40dbd1c6861731779f62cc4babcb234387e11d697df70ee97
Successfully built wget
Installing collected packages: wget
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

Parents
  • Hi, 

    Please try to replace https://github.com/nrfconnect/sdk-connectedhomeip/blob/v2.3.0/scripts/setup/nrfconnect/get_zap.py#L121 with 

    Fullscreen
    1
    zap_executable = 'zap.app/Contents/MacOS/zap'
    XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

    Guess that should fix the problem.

    Regards,
    Amanda H.

  • Hi Amanda - thanks for getting back to me so quickly on this - much appreciated.

    Your suggestion did work and allowed the script to complete properly. However, I am still unable to run the zap script. I am on an Apple M1 Max.

    Fullscreen
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    me@MacBook-Pro matter % python3 scripts/setup/nrfconnect/get_zap.py -l location_path -o
    No ZAP tool version was found installed on this device.
    Trying to download ZAP tool package matching your system and recommended version.
    Downloading https://github.com/project-chip/zap/releases/download/v2022.12.20-nightly/zap-mac.zip into /opt/nordic/ncs/v2.3.0/modules/lib/matter/location_path/zap-mac.zip
    100% [..................................................] 249937313 / 249937313
    Deleting zip file: /opt/nordic/ncs/v2.3.0/modules/lib/matter/location_path/zap-mac.zip
    ZAP tool package was downloaded and extracted in the given location.
    #########################################################################################################################
    # Please add the following location to the system PATH: /opt/nordic/ncs/v2.3.0/modules/lib/matter/location_path/zap-mac #
    #########################################################################################################################
    me@MacBook-Pro matter % nano ~/.bash_profile
    me@MacBook-Pro matter % source ~/.bash_profile
    me@MacBook-Pro matter % zap ~/dev/nordic/template.v.2.1.0/src/template.zap
    zsh: command not found: zap
    me@MacBook-Pro matter % /opt/nordic/ncs/v2.3.0/modules/lib/matter/location_path/zap-mac/zap
    zsh: no such file or directory: /opt/nordic/ncs/v2.3.0/modules/lib/matter/location_path/zap-mac/zap
    me@MacBook-Pro matter % /opt/nordic/ncs/v2.3.0/modules/lib/matter/location_path/zap-mac/zap.app/Contents/MacOS/zap
    XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX


    Separately, it seems like either the scripts or the documentation should be corrected to deal with some of the issues that came up  (e.g. despite going through the automated toolchain setup, python path was not correct, wget wasn't installed etc).

    Welcome your further guidance on how I can edit the template.zap file on an M1 Mac with the v.2.3.0 of the SDK.

    Thanks! Dan.

  • I had another private ticket related to the same issue, and I discovered that I had to extract the zip manually instead of using the Python script for some reason:

    "I was finally able to reproduce the same error here, and it appears to be related to how the zip file is being extracted by the Python script.

    Please change the directory to /opt/nordic/ncs/v2.3.0/modules/lib/matter/location_path in the terminal and delete the existing files and folders before running this command.

    "wget github.com/.../zap-mac.zip && unzip -d zap-mac zap-mac.zip && ../../../../nrf/samples/matter/sensor/src/template."

    After the zip is downloaded and extracted, make sure that both /opt/nordic/ncs/v2.3.0/modules/lib/matter/location_path/zap-mac/zap.app/Contents/MacOS/ and /opt/nordic/ncs/v2.3.0/modules/lib/matter/location_path/zap-mac/ are added to PATH.

    I have reported this as a bug internally. It seems like only macOS is affected by this. 

  • Hi Vidar,

    thanks for your answer. I followed your instructions and it looks zap tool works!
    Unfortunately when opening zap tool with
    ```
    zap src/template.zap
    ```
    in my project folder I cannot add any matter endpoint. Is there any extension which I should add to see Matter clusters? 

  • Good to hear that it worked. Are you opening the terminal via the toolchain manager? This will ensure that the necessary env. variables are exported/set.  

  • Okay, my project was outside `/opt/nordic/ncs/v2.3.0`.
    I generated environment script with toolchain manager, executed the script and finally I see available matter clusters!
    Thank you for your time. 

  • Bless you   - this worked! To the Nordic team: hopefully the scripts or the documentation can be updated - it would save a lot of time/frustration. Thanks! Dan.

Reply Children
No Data