Zephyr CMake unable to find Python interpreter during build - VSCode extension setup

Hi there,

I'm on Ubuntu 22.04.2, 6.5.0-41-generic kernel.

I've been trying to setup the nRF connect toolchains & SDK through VSCode. Things seem to install fine, but when I go to build a sample project for a board with nRF9160, I get the following error:

Executing task: west build -b circuitdojo_feather_nrf9160_ns

-- west build: generating a build system
Loading Zephyr default modules (Zephyr base (cached)).
-- Application: /home/user/documents/nrf/feather/nfed/samples/blinky
-- CMake version: 3.22.0
-- Using NCS Toolchain 2.4.0 for building. (/home/user/documents/nrf/ncs/toolchains/1f9b40e71a/cmake)
CMake Error at /home/user/.zephyrtools/cmake/cmake-3.22.0-linux-x86_64/share/cmake-3.22/Modules/FindPackageHandleStandardArgs.cmake:230 (message):
  Could NOT find Python3 (missing: Interpreter) (Required is exact version
  "3.9")

      Reason given by package:
          Interpreter: Cannot run the interpreter "/home/user/documents/nrf/ncs/toolchains/1f9b40e71a/usr/local/bin/python3"

Call Stack (most recent call first):
  /home/user/.zephyrtools/cmake/cmake-3.22.0-linux-x86_64/share/cmake-3.22/Modules/FindPackageHandleStandardArgs.cmake:594 (_FPHSA_FAILURE_MESSAGE)
  /home/user/.zephyrtools/cmake/cmake-3.22.0-linux-x86_64/share/cmake-3.22/Modules/FindPython/Support.cmake:3166 (find_package_handle_standard_args)
  /home/user/.zephyrtools/cmake/cmake-3.22.0-linux-x86_64/share/cmake-3.22/Modules/FindPython3.cmake:485 (include)
  /home/user/documents/nrf/feather/zephyr/cmake/modules/python.cmake:46 (find_package)
  /home/user/documents/nrf/feather/zephyr/cmake/modules/zephyr_default.cmake:115 (include)
  /home/user/documents/nrf/feather/zephyr/share/zephyr-package/cmake/ZephyrConfig.cmake:66 (include)
  /home/user/documents/nrf/feather/zephyr/share/zephyr-package/cmake/ZephyrConfig.cmake:97 (include_boilerplate)
  CMakeLists.txt:7 (find_package)

The entire path is set up within a Python venv, which is also set to as the interpreter within VSCode correctly. It seems like the Build shell isn't finding this path correctly and defaulting to a seemingly broken install within itself. I say seemingly broken as for some reason Python 3.8 is being set instead of 3.9, and the linker shows the `.so` file is not found, when it is in fact visible...

        linux-vdso.so.1 (0x00007fff26bfe000)
        libpython3.8.so.1.0 => not found
        libc.so.6 => /lib/x86_64-linux-gnu/libc.so.6 (0x0000743e49800000)
        /lib64/ld-linux-x86-64.so.2 (0x0000743e49ac5000)

(nrffeather) {13:25}~/documents/nrf/ncs/toolchains/1f9b40e71a/usr/local/lib ➭ ls
itcl4.2.2        libpython3.8.so.1.0  libtcl8.6.so     libtk8.6.so     pkgconfig  sqlite3.36.0  tcl8.6        tclooConfig.sh  tdbcmysql1.1.3  tdbcpostgres1.1.3  tk8.6        zcbor
libpython3.8.so  libpython3.so        libtclstub8.6.a  libtkstub8.6.a  python3.8  tcl8          tclConfig.sh  tdbc1.1.3       tdbcodbc1.1.3   thread2.8.7        tkConfig.sh

Related