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

Parents
  • Hi,

    What else to you see in the log? You should be able to see what exactly is missing. That said, there is support for Ubuntu 22.04 in the toolchain manager, and I would recommend using that as that way you get everything set up out of the box (see installing automatically for details).

  • 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/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!

Reply
  • 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/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!

Children
No Data
Related