nRF Connect Toolchain fails

I followed your step by step guide available on your site for installing the SDK and Toolchain. My system are Fedora 36 with VS Code IDE, but the system detects the errors that I report attached in this screenshot:

and in the VS Code IDE output window appear those errors:

********** VS Code Output window content ***************

[Error - 10:38:10] Connection to server is erroring. Shutting down server.
Python path configuration:
  PYTHONHOME = '/home/denis/ncs/toolchains/v2.0.0/usr/local'
  PYTHONPATH = '/home/denis/ncs/toolchains/v2.0.0/usr/local/lib/python3.8/site-packages'
  program name = '/usr/bin/python3'
  isolated = 0
  environment = 1
  user site = 1
  import site = 1
  sys._base_executable = '/usr/bin/python3'
  sys.base_prefix = '/home/denis/ncs/toolchains/v2.0.0/usr/local'
  sys.base_exec_prefix = '/home/denis/ncs/toolchains/v2.0.0/usr/local'
  sys.platlibdir = 'lib'
  sys.executable = '/usr/bin/python3'
  sys.prefix = '/home/denis/ncs/toolchains/v2.0.0/usr/local'
  sys.exec_prefix = '/home/denis/ncs/toolchains/v2.0.0/usr/local'
  sys.path = [
    '/home/denis/ncs/toolchains/v2.0.0/usr/local/lib/python3.8/site-packages',
    '/home/denis/ncs/toolchains/v2.0.0/usr/local/lib/python39.zip',
    '/home/denis/ncs/toolchains/v2.0.0/usr/local/lib/python3.9',
    '/home/denis/ncs/toolchains/v2.0.0/usr/local/lib/python3.9/lib-dynload',
  ]
Fatal Python error: init_fs_encoding: failed to get the Python codec of the filesystem encoding
Python runtime state: core initialized
ModuleNotFoundError: No module named 'encodings'

Current thread 0x00007ff7c5e0a740 (most recent call first):
<no Python frame>

*************************** End content ***************************

Kindly, how can I solve those issues?

Thanks in advance.

  • You're still getting the same Python errors as in the original post?

    In that case you should look into this error message:

    ModuleNotFoundError: No module named 'encodings'

    This seems to be related to your own Python environment and not the nRF Connect SDK.

    Have you installed the Python dependencies as described here?

    -Einar

  • Yes, I installed the dependencies, this is the report about 'pip3 list':

    Package Version
    ------------------------------ ------------
    alabaster 0.7.12
    anytree 2.8.0
    appdirs 1.4.4
    apsw 3.36.0.post1
    argcomplete 2.0.0
    arrow 1.2.1
    astroid 2.11.5
    attrs 21.4.0
    azure-core 1.24.1
    azure-storage-blob 12.12.0
    Babel 2.9.1
    Beaker 1.10.0
    beautifulsoup4 4.11.0
    blivet 3.4.4
    blivet-gui 2.3.0
    breathe 4.32.0
    Brlapi 0.8.3
    Brotli 1.0.9
    canopen 2.0.0
    capstone 4.0.2
    cbor 1.0.0
    cbor2 5.4.3
    cchardet 2.1.7
    certifi 2022.5.18.1
    cffi 1.15.0
    chardet 4.0.0
    charset-normalizer 2.0.11
    chrome-gnome-shell 0.0.0
    click 8.0.3
    cmake 3.22.4
    cmsis-pack-manager 0.4.0
    colorama 0.4.4
    commonmark 0.9.1
    coverage 6.4.1
    cryptography 36.0.0
    css-parser 1.0.7
    cssselect 0.9.2
    cupshelpers 1.0
    cycler 0.11.0
    dasbus 1.6
    dbus-python 1.2.18
    decorator 5.1.1
    defusedxml 0.7.1
    Deprecated 1.2.13
    dill 0.3.5.1
    distro 1.6.0
    dnspython 2.2.0
    docopt 0.6.2
    docutils 0.17.1
    ecdsa 0.17.0
    fedora-third-party 0.10
    feedparser 6.0.8
    fonttools 4.29.1
    fros 1.1
    fs 2.4.11
    future 0.18.2
    gcovr 5.1
    gitlint 0.17.0
    gitlint-core 0.17.0
    gpg 1.15.1
    gssapi 1.7.2
    html2text 2020.1.16
    html5-parser 0.4.10
    html5lib 1.1
    humanize 3.13.1
    idna 3.3
    ifaddr 0.1.7
    imagesize 1.3.0
    imgtool 1.9.0
    iniconfig 1.1.1
    intelhex 2.3.0
    intervaltree 3.1.0
    isodate 0.6.1
    isort 5.10.1
    jeepney 0.7.1
    Jinja2 3.1.2
    junit2html 30.1.3
    junitparser 1.6.3
    kiwisolver 1.4.1
    koji 1.29.0
    langtable 0.0.58
    lazy-object-proxy 1.7.1
    libcomps 0.1.18
    libusb-package 1.0.26.0
    lpc-checksum 2.2.0
    lxml 4.7.1
    m2r2 0.3.2
    Mako 1.1.4
    Markdown 3.3.4
    MarkupSafe 2.0.0
    matplotlib 3.5.2
    mccabe 0.7.0
    mechanize 0.4.7
    milksnake 0.1.5
    mistune 0.8.4
    mock 4.0.3
    msgpack 1.0.3
    msrest 0.6.21
    munkres 1.1.2
    mypy 0.960
    mypy-extensions 0.4.3
    natsort 8.1.0
    netifaces 0.11.0
    nftables 0.1
    numpy 1.22.0
    oauthlib 3.2.0
    odfpy 1.4.1
    olefile 0.46
    packaging 21.3
    Paste 3.5.0
    pexpect 4.8.0
    pid 2.2.3
    Pillow 9.1.0
    pip 21.3.1
    platformdirs 2.5.2
    pluggy 1.0.0
    ply 3.11
    prettytable 3.3.0
    productmd 1.33
    progress 1.6
    progressbar2 3.53.2
    protobuf 4.21.1
    psutil 5.8.0
    ptyprocess 0.6.0
    pwquality 1.4.4
    py 1.11.0
    pycairo 1.21.0
    pychm 0.8.6
    pycollada 0.7.2
    pycparser 2.20
    pycrypto 2.6.1
    pycups 2.0.1
    pycurl 7.45.1
    pyelftools 0.28
    pyenchant 3.2.2
    pygit2 1.7.1
    PyGithub 1.55
    Pygments 2.11.2
    PyGObject 3.42.1
    PyJWT 2.4.0
    pykickstart 3.36
    pykwalify 1.8.0
    pylink-square 0.13.0
    pylint 2.14.0
    PyNaCl 1.5.0
    pyocd 0.34.0
    pyOpenSSL 21.0.0
    pyparsing 2.4.7
    pyparted 3.12.0
    PyQt5 5.15.6
    PyQt5-sip 12.9.0
    PyQtWebEngine 5.15.4
    pyserial 3.5
    PySide2 5.15.2.1
    PySocks 1.7.1
    pytest 7.1.2
    python-augeas 1.1.0
    python-can 4.0.0
    python-dateutil 2.8.1
    python-gettext 4.0
    python-magic 0.4.26
    python-manatools 0.0.4
    python-meh 0.50
    python-utils 2.5.6
    pytz 2022.1
    pyudev 0.22.0
    pyusb 1.2.1
    pyxdg 0.27
    PyYAML 5.4.1
    recommonmark 0.6.0
    regex 2022.4.24
    requests 2.27.1
    requests-file 1.5.1
    requests-ftp 0.3.1
    requests-gssapi 1.2.3
    requests-oauthlib 1.3.1
    rpm 4.17.0
    rpmautospec 0.2.6
    ruamel.yaml 0.17.21
    ruamel.yaml.clib 0.2.6
    scipy 1.8.0
    scour 0.38.1
    selinux 3.3
    sepolicy 3.3
    setools 4.4.0
    setuptools 59.6.0
    sgmllib3k 1.0.0
    sh 1.14.2
    shiboken2 5.15.2.1
    simpleaudio 1.0.4
    simpleline 1.9.0
    six 1.16.0
    snowballstemmer 2.2.0
    sortedcontainers 2.4.0
    sos 4.3
    soupsieve 2.3.1
    Sphinx 4.5.0
    sphinx-copybutton 0.5.0
    sphinx-markdown-tables 0.0.15
    sphinx-ncs-theme 1.0.5
    sphinx-notfound-page 0.8
    sphinx-rtd-theme 1.0.0
    sphinx-tabs 3.3.1
    sphinxcontrib-applehelp 1.0.2
    sphinxcontrib-devhelp 1.0.2
    sphinxcontrib-htmlhelp 2.0.0
    sphinxcontrib-jsmath 1.0.1
    sphinxcontrib-mscgen 0.6
    sphinxcontrib-plantuml 0.23
    sphinxcontrib-qthelp 1.0.3
    sphinxcontrib-serializinghtml 1.1.5
    sphinxcontrib-svg2pdfconverter 1.2.0
    systemd-python 234
    tabulate 0.8.9
    Tempita 0.5.2
    tomli 2.0.1
    tomlkit 0.11.0
    typing_extensions 4.2.0
    urllib3 1.26.8
    wcwidth 0.2.5
    webencodings 0.5.1
    west 0.13.1
    wrapt 1.14.1
    zcbor 0.4.0
    zeroconf 0.38.4

  • As I said in my previous reply, your error seems to be caused by your Python environment, and is probably caused by something you set up before you started installing NCS.

    See for example this thread for a similar issue: https://stackoverflow.com/questions/38132755/importerror-no-module-named-encodings

    If you were working in a virtual environment earlier, this seems likely to be the root of your issue.

    -Einar

  • I'm getting the exact same errors on a fresh install under Ubuntu 22.04

  • This is my first post here. I hope a 1 month old question is not too old to answer to. Since Anthony Corriveau seemed to have a similar problem i figured this might still be relevant for some people.

    I had the same problem on Ubuntu 22.04. I downloaded version 2.0.0 of the sdk and toolchain using NRF Connect for Desktop (Toolchain Manager). It seems the toolchain comes with a full install of python3.8.

    The nRF extensions for VS Code use the environment variables defined in <toolchain_dir>/environment.json. This includes the variables PYTHONHOME and PYTHONPATH which allow the use of the toolchain-specific python instead of the one installed on my system per default. At least that is how I understand it (i am by no means a python expert).

    However the Kconfig extension used the python executable on my path (/usr/bin/python3) which is python version 3.10 along with the python home and modules for 3.8. This seems to be the cause of the error. The same problem is indicated by your error message:

    PYTHONHOME = '/home/denis/ncs/toolchains/v2.0.0/usr/local' (installation of toolchain python 3.8)

    ...

    program name = '/usr/bin/python3' (system python - probably a different version)

    Solution: In the nRF Kconfig extension settings change the "Kconfig: Python" value. This needed to point to the python executable which came with my toolchain (for me: /home/<user>/ncs/toolchains/v2.0.0/usr/local/bin/python3). After changing this and restarting VS Code everything worked for me.

    I hope this solution works for you as well.

    Note: I also tried installing the SDK and toolchain manually. In this case the "normal" python is used which fixes the problem as well. However on my system i needed to completely remove the nRF extensions and their data and reinstall them as they were still using the old PYTHONHOME and PYTHONPATH variables.

Related