'west' is not recognized with VScode

Hi,

I have an application that we are migrating from NCS v1.7.0 to v2.2.0.  With v1.7.0, I was able to build, flash and monitor using VS Code (on Windows 10). The SDK has been installed using the nRF Connect Toolchain Manager.

Our normal build process is from the command line (opened through the toolchain manager), and we can build and flash using west just fine.

However, during the migration process, we encountered an issue that we need to debug. When attempting to set up the build configuration in VScode (launched using the button in the toolchain manager), we get the following error:

Executing task: nRF Connect: Generate config [email protected] for c:\dev\ml-firmware-nRF\nRF_NCS\ml-assetTracker\nrf9160

Building nrf9160
west build --build-dir c:\dev\ml-firmware-nRF\nRF_NCS\ml-assetTracker\nrf9160\build c:\dev\ml-firmware-nRF\nRF_NCS\ml-assetTracker\nrf9160 --pristine --board [email protected] -- -DNCS_TOOLCHAIN_VERSION:STRING="NONE" -DCONFIG_DEBUG_OPTIMIZATIONS=y -DCONFIG_DEBUG_THREAD_INFO=y -DBOARD_ROOT:STRING="c:/dev/ml-firmware-nRF/nRF_NCS;c:/dev/ml-firmware-nRF/nRF_NCS/ml-assetTracker/nrf9160"

'west' is not recognized as an internal or external command,
operable program or batch file.

We CAN still build using the command line.

We have tried:

- adding the path to west.exe in the 2.2.0 SDK to the local environment variable (this produces a python error that says module 'west' not installed'

- uninstalling the entire SDK / VScode / NCS extensions, with no effect.

- reverting to our v1.7.0 project, and that no longer can build either due to the same error

Any ideas?

Parents
  • Hi,

    You could consider building your project on another Windows computer which has correctly set up environment.

    Regarding west installation, it should be found in 

    toolchains\v2.2.0\opt\bin\lib\site-packages


    For installing west, you can use the following command
     
    pip3 install -U west


    You can check if west is present in your system and its location by running the command

    pip3 show -f west


    Best regards,
    Dejan

  • Hi, I'd prefer to figure out why my build environment is broken and fix it!

    West is found in the toolchain path: toolchains\v2.2.0\opt\bin\lib\site-packages

    When checking if west is present using the above command from the VScode powershell, it showed west was not installed.  (If I open a command prompt from the toolchain manager and run this command, it DOES show west is present).

    So I tried installing west from powershell in VScode.  And now I have a new error:

    -- west build: generating a build system
    FATAL ERROR: CMake is not installed or cannot be found; cannot build.

    So for some reason VScode is having trouble finding my build tools?  I am opening VScode from the toolchain manager.

Reply
  • Hi, I'd prefer to figure out why my build environment is broken and fix it!

    West is found in the toolchain path: toolchains\v2.2.0\opt\bin\lib\site-packages

    When checking if west is present using the above command from the VScode powershell, it showed west was not installed.  (If I open a command prompt from the toolchain manager and run this command, it DOES show west is present).

    So I tried installing west from powershell in VScode.  And now I have a new error:

    -- west build: generating a build system
    FATAL ERROR: CMake is not installed or cannot be found; cannot build.

    So for some reason VScode is having trouble finding my build tools?  I am opening VScode from the toolchain manager.

Children
  • Hi,

    You can start by reading these discussions - first and second. I hope you will find them useful.

    CMake should be included in the toolchain if you installed nRF Connect SDK via Toolchain Manager. From the VS Code Command Pallette (CTRL+SHIFT+P) please run nRF Connect: Generate Support Information and provide the information you get using "Insert -> Code".

    Best regards,
    Dejan

  • Thanks - I checked those threads and they did not reveal anything helpful.

    I also tried installing the requirements from the SDK directory:

    pip3 install -r zephyr/scripts/requirements.txt
    pip3 install -r nrf/scripts/requirements.txt
    pip3 install -r bootloader/mcuboot/scripts/requirements.txt

    Ultimately, our local Nordic FAE Wes Cherry helped identify the issue.  I had "CMake" and "CMake Tools" extensions installed. (not sure when or how those were installed).  By disabling those extensions, restarting VScode and launching from the Toolchain Manager, I am able to build again.

    Thank you!

Related