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.

Parents
  • 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.

Reply
  • 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.

Children
Related