NRF-SDK 1.8.0 - can't get west build working (Python issue

I am simply trying to build the hello world (and blinky, results are the same) with NRF-SDK 1.8.0 - it's based on Zephyr 2.7, which is the LTS release.

Target board is 5340. I've installed the toolchains, but during the installation you get some notes already about incompatible modules. Tried building, no luck.

I've tried to resolve those by downgrading some modules. However, no luck.

Does anyone have a working setup for 1.8.0 and the pip list output from that?

Here's the error:

(.venv)  16:25 jannek@jannek-P720:~/nrf-sdk$ west build -p auto -b nrf5340dk_nrf5340_cpuapp zephyr/samples/hello_world/
-- west build: generating a build system
Including boilerplate (Zephyr base (cached)): /home/jannek/nrf-sdk/zephyr/cmake/app/boilerplate.cmake
-- Application: /home/jannek/nrf-sdk/zephyr/samples/hello_world
-- Using NCS Toolchain 2.6.20240605.1004412633878 for building. (/home/jannek/ncs/toolchains/e9dba88316/cmake)
-- Zephyr version: 2.7.0 (/home/jannek/nrf-sdk/zephyr), build: v2.7.0-ncs1
-- Found west (found suitable version "1.2.0", minimum required is "0.7.1")
-- Board: nrf5340dk_nrf5340_cpuapp
-- Cache files will be written to: /home/jannek/.cache/zephyr
-- Using toolchain: zephyr 0.13.1 (/home/jannek/zephyr-sdk-0.13.1)
-- Found dtc: /home/jannek/ncs/toolchains/e9dba88316/usr/local/bin/dtc (found suitable version "1.5.0", minimum required is "1.4.6")
-- Found BOARD.dts: /home/jannek/nrf-sdk/zephyr/boards/arm/nrf5340dk_nrf5340/nrf5340dk_nrf5340_cpuapp.dts
-- Generated zephyr.dts: /home/jannek/nrf-sdk/build/zephyr/zephyr.dts
-- Generated devicetree_unfixed.h: /home/jannek/nrf-sdk/build/zephyr/include/generated/devicetree_unfixed.h
-- Generated device_extern.h: /home/jannek/nrf-sdk/build/zephyr/include/generated/device_extern.h
-- Including generated dts.cmake file: /home/jannek/nrf-sdk/build/zephyr/dts.cmake
Parsing /home/jannek/nrf-sdk/zephyr/Kconfig
Traceback (most recent call last):
  File "/home/jannek/nrf-sdk/zephyr/scripts/kconfig/kconfig.py", line 278, in <module>
    main()
  File "/home/jannek/nrf-sdk/zephyr/scripts/kconfig/kconfig.py", line 30, in main
    kconf = Kconfig(args.kconfig_file, warn_to_stderr=False,
  File "/home/jannek/nrf-sdk/zephyr/scripts/kconfig/kconfiglib.py", line 947, in __init__
    self._init(filename, warn, warn_to_stderr, encoding)
  File "/home/jannek/nrf-sdk/zephyr/scripts/kconfig/kconfiglib.py", line 1032, in _init
    importlib.import_module(
  File "/home/jannek/ncs/toolchains/e9dba88316/usr/local/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 986, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 680, in _load_unlocked
  File "<frozen importlib._bootstrap_external>", line 850, in exec_module
  File "<frozen importlib._bootstrap>", line 228, in _call_with_frames_removed
  File "/home/jannek/nrf-sdk/zephyr/scripts/kconfig/kconfigfunctions.py", line 27, in <module>
    edt = pickle.load(f)
AttributeError: Can't get attribute 'Range' on <module 'devicetree.edtlib' from '/home/jannek/nrf-sdk/zephyr/scripts/dts/python-devicetree/src/devicetree/edtlib.py'>
CMake Error at /home/jannek/nrf-sdk/zephyr/cmake/kconfig.cmake:270 (message):
  command failed with return code: 1
Call Stack (most recent call first):
  /home/jannek/nrf-sdk/zephyr/cmake/app/boilerplate.cmake:546 (include)
  /home/jannek/nrf-sdk/zephyr/share/zephyr-package/cmake/ZephyrConfig.cmake:24 (include)
  /home/jannek/nrf-sdk/zephyr/share/zephyr-package/cmake/ZephyrConfig.cmake:40 (include_boilerplate)
  CMakeLists.txt:5 (find_package)


-- Configuring incomplete, errors occurred!
FATAL ERROR: command exited with status 1: /u


So, AttributeError: Can't get attribute 'Range' on <module 'devicetree.edtlib'

Something in the Python setup must be wrong. Here's the pip list I have in use now.

pip list
Package                        Version
------------------------------ -----------
alabaster                      0.7.16
anytree                        2.12.1
appdirs                        1.4.4
arrow                          1.2.3
astroid                        3.2.4
babel                          2.16.0
breathe                        4.33.1
canopen                        2.3.0
capstone                       4.0.2
cbor                           1.0.0
cbor2                          5.6.4
certifi                        2024.7.4
cffi                           1.17.0
charset-normalizer             3.3.2
click                          8.1.3
cmsis-pack-manager             0.5.3
colorama                       0.4.6
colorlog                       6.8.2
coverage                       7.6.1
cryptography                   43.0.0
Deprecated                     1.2.14
dill                           0.3.8
docopt                         0.6.2
docutils                       0.16
exceptiongroup                 1.2.2
future                         1.0.0
gcovr                          7.2
gitlint                        0.19.1
gitlint-core                   0.19.1
idna                           3.7
imagesize                      1.4.1
imgtool                        2.1.0
importlib_metadata             8.4.0
importlib_resources            6.4.4
iniconfig                      2.0.0
intelhex                       2.3.0
intervaltree                   3.1.0
isort                          5.13.2
Jinja2                         3.1.4
junit2html                     31.0.2
junitparser                    1.6.3
lark                           1.2.2
libusb-package                 1.0.26.2
lpc-checksum                   3.0.0
lxml                           5.3.0
MarkupSafe                     2.1.5
mccabe                         0.7.0
mock                           5.1.0
msgpack                        1.0.8
mypy                           1.11.1
mypy-extensions                1.0.0
natsort                        8.4.0
packaging                      24.1
pillow                         10.4.0
pip                            24.0
platformdirs                   4.2.2
pluggy                         1.5.0
ply                            3.11
prettytable                    3.11.0
progress                       1.6
protobuf                       5.27.3
psutil                         6.0.0
pycparser                      2.22
pyelftools                     0.31
PyGithub                       2.3.0
Pygments                       2.18.0
PyJWT                          2.9.0
pykwalify                      1.8.0
pylink-square                  1.2.1
pylint                         3.2.6
PyNaCl                         1.5.0
pyocd                          0.36.0
pyserial                       3.5
pytest                         8.3.2
python-can                     4.4.2
python-dateutil                2.9.0.post0
python-magic                   0.4.27
pyusb                          1.2.1
PyYAML                         6.0.2
requests                       2.32.3
ruamel.yaml                    0.18.6
ruamel.yaml.clib               0.2.8
setuptools                     70.0.0
sh                             1.14.3
six                            1.16.0
snowballstemmer                2.2.0
sortedcontainers               2.4.0
Sphinx                         3.3.0
sphinx-ncs-theme               0.6.5
sphinx-notfound-page           0.8.3
sphinx-rtd-theme               0.5.2
sphinx-tabs                    3.4.5
sphinxcontrib-applehelp        2.0.0
sphinxcontrib-devhelp          2.0.0
sphinxcontrib-htmlhelp         2.1.0
sphinxcontrib-jquery           4.1
sphinxcontrib-jsmath           1.0.1
sphinxcontrib-qthelp           2.0.0
sphinxcontrib-serializinghtml  2.0.0
sphinxcontrib-svg2pdfconverter 1.2.2
tabulate                       0.9.0
tomli                          2.0.1
tomlkit                        0.13.2
typing_extensions              4.12.2
urllib3                        2.2.2
wcwidth                        0.2.13
west                           0.12.0
wheel                          0.43.0
wrapt                          1.16.0
zipp                           3.20.0

All help would be greatly appreciated.

I think the root cause is that some dependency has not been pinned down and we get something that is much newer now and this causes the issue. I have been able to install it and I had a working setup earlier. I just did pip install --upgrade again for the requirements.txt due to some other issues (which were really not related to this, but NRF tooling otherwise) and that broke the installation.

Parents
  • Hi,

    Are you using the nRF Connect SDK v1.8.0 to build the samples?

    I would recommend you to use a more recent version, say, the v2.5.x onwards. Do you still get the issue?

    Also, do you have the nRF Connect for Desktop, VSCode extension and nRF Command Line Tools installed?

    Regards,

    Priyanka

  • Hei,

    I need to use the version 1.8 at least for starters, because that is the only version that has the pelion-dm client included in it.

    I do have the VSCode extension and nRF command line tools installed, as well as the SEGGER JLINK tooling as well.

    With using an Ubuntu 20.04 based machine I was able to get it working at least over the command line, but it seems very fragile. It broke down already once (apparently after installing the VSCode extensions and/or Python extensions to VSCode). I managed to repair it though.

    I cannot get the Ubuntu 22.04 based system working, though. Not even after I did pip freeze on the working Ubuntu20.04 system and installed the same dependencies in place (at least the ones that could be installed, seemed there were quite a few which could not be installed on Ubuntu 22.04).

    Best Regards,

    Janne

  • Hi Janne,

    Apologies for the delay in response. I guess since you are using the v1.8.0, you need to ensure that all your dependencies etc. match those required for the Zephyr 2.7. So maybe when you ran pip install --upgrade, some modules might have been upgraded to incompatible versions. So maybe you can revert them by referring the  /zephyr/scripts/requirements.txt

    You can also try pip install -r /path/to/nrf-sdk/zephyr/scripts/requirements.txt

    Please try this and let me know how it goes.

    -Priyanka

Reply
  • Hi Janne,

    Apologies for the delay in response. I guess since you are using the v1.8.0, you need to ensure that all your dependencies etc. match those required for the Zephyr 2.7. So maybe when you ran pip install --upgrade, some modules might have been upgraded to incompatible versions. So maybe you can revert them by referring the  /zephyr/scripts/requirements.txt

    You can also try pip install -r /path/to/nrf-sdk/zephyr/scripts/requirements.txt

    Please try this and let me know how it goes.

    -Priyanka

Children
Related