VS Code Extension - west flash fails from missing python dependencies

When trying to flash the hello world program onto an Adafruit nRF52840 Feather through a j link it fails with "FATAL ERROR: one or more Python dependencies were missing; see the getting started guide for details on how to fix". I installed the dependencies using the requirements.txt file in the ncs/v2.3.0/zephyr/script folder, but the problem persists.

OS: Ubuntu 22.04.2

VS Code: 1.78.2

nRF Connect SDK/toolchain: 2.3.0

  • Thank you. I went through the manual procedure, to no avail.

    Sadly, the error message is not very explicit.

    Where should I look at?

  • Hi,

    Did you resolve this? If not, can you check your PATH (echo $PATH)? It should use key tools (like python) from the toolchain manager, and a typical cause of issues if that is not the case (so something has modified the path).

  • Yes, after a couple of iterations.

    First, I performed a manual installation as suggested, but it didn't solve the issue.

    Then I launched the automatic installation again, this time with SDK 2 4.1.

    Everything works fine as expected now. 

  • Had the same problem, but this worked for me in Ubuntu 22.04:

    1. Open the toolchain manager, click on the dropdown arrow, and select "Generate environment script." Save the script to a location of your choice.

    2. Open a terminal and source the environment script that you just generated (i.e source env.sh)

    3. Find where the nordic toolchain is installed and navigate to it in the terminal (example path: ~/ncs/toolchains/2be090971e)

    4. Run "./usr/local/bin/pip install pylink"

    5. Open environment.json inside the toolchain directory, under the "LD_LIBRARY_PATH" key, add the following value to the list:
    "opt/nanopb/generator-bin/"

    After you add that value, your environment JSON file should look like this:

    {
      "env_vars": [
        {
          "type": "relative_paths",
          "key": "PATH",
          "values": [
            "bin",
            "usr/bin",
            "usr/local/bin",
            "opt/bin",
            "opt/nanopb/generator-bin",
            "opt/zephyr-sdk/aarch64-zephyr-elf/bin",
            "opt/zephyr-sdk/x86_64-zephyr-elf/bin",
            "opt/zephyr-sdk/arm-zephyr-eabi/bin",
            "opt/zephyr-sdk/riscv64-zephyr-elf/bin"
          ],
          "existing_value_treatment": "prepend_to"
        },
        {
          "type": "relative_paths",
          "key": "LD_LIBRARY_PATH",
          "values": [
            "lib",
            "lib/x86_64-linux-gnu",
            "usr/local/lib",
            "opt/nanopb/generator-bin/"
          ],
          "existing_value_treatment": "prepend_to"
        },
        {
          "type": "relative_paths",
          "key": "GIT_EXEC_PATH",
          "values": [
            "usr/local/libexec/git-core"
          ],
          "existing_value_treatment": "overwrite"
        },
        {
          "type": "relative_paths",
          "key": "GIT_TEMPLATE_DIR",
          "values": [
            "usr/local/share/git-core/templates"
          ],
          "existing_value_treatment": "overwrite"
        },
        {
          "type": "relative_paths",
          "key": "PYTHONHOME",
          "values": [
            "usr/local"
          ],
          "existing_value_treatment": "overwrite"
        },
        {
          "type": "relative_paths",
          "key": "PYTHONPATH",
          "values": [
            "usr/local/lib/python3.9",
            "usr/local/lib/python3.9/site-packages"
          ],
          "existing_value_treatment": "overwrite"
        },
        {
          "type": "string",
          "key": "ZEPHYR_TOOLCHAIN_VARIANT",
          "value": "zephyr"
        },
        {
          "type": "relative_paths",
          "key": "ZEPHYR_SDK_INSTALL_DIR",
          "values": [
            "opt/zephyr-sdk"
          ],
          "existing_value_treatment": "overwrite"
        }
      ]
    }

    Reboot VS code and see if it is able to flash now. If not, make sure that you have JLink installed and that your device is plugged in.

    I hope this helps!

Related