Skip to content

New python requirement breaks west sdk after git pull + west update #85057

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
samblenny opened this issue Feb 3, 2025 · 3 comments
Closed

New python requirement breaks west sdk after git pull + west update #85057

samblenny opened this issue Feb 3, 2025 · 3 comments
Assignees
Labels
area: West West utility bug The issue is a bug, or the PR is fixing a bug priority: medium Medium impact/importance bug Stale

Comments

@samblenny
Copy link

Describe the bug

Result of running west sdk after updating zephyr source code to commit b7d13ea (and possibly anything at or after b739fbd) is a stack trace caused by this exception:

ModuleNotFoundError: No module named 'tqdm'

Target platform: N/A (bug triggers when attempting to run west sdk)

Diagnosis & resolution: commit b739fbd introduces a dependency on the tqdm python package which causes west sdk to crash until you manually install tqdm.

To Reproduce

  1. Start with a workspace having zephyr repo checked out to a recent commit, but something prior to b739fbd. Also, the workspace venv should not have the tqdm package installed yet.
  2. cd zephyr
  3. git pull
  4. west update
  5. west sdk

(Result is the exception shown in the console log below)

Expected behavior

The Keeping Zephyr Updated section of the "Beyond the Getting Started Guide" documentation page suggests the following commands to update the Zephyr project source code:

cd zephyrproject/zephyr   # or whatever you gave west init
git pull
west update

I expect west sdk should work normally after running the recommended update commands.

Impact

west sdk is unusable until I manually resolve the missing dependency by running

west packages pip --install

I realize that is not difficult to do. My concern is, in the general case, how do beginners know when they are supposed to install some new python package, and how do they find the right command to use? Maybe the update procedure could include west packages pip --install after west update? It would be great if west update could just handle it automatically.

Logs and console output

(.venv) $ west sdk
Traceback (most recent call last):
  File "/home/sam/code/zephyr-workspace/.venv/lib/python3.11/site-packages/west/commands.py", line 559, in __call__
    mod = _commands_module_from_file(self.py_file)
          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/sam/code/zephyr-workspace/.venv/lib/python3.11/site-packages/west/commands.py", line 714, in _commands_module_from_file
    spec.loader.exec_module(mod)
  File "<frozen importlib._bootstrap_external>", line 940, in exec_module
  File "<frozen importlib._bootstrap>", line 241, in _call_with_frames_removed
  File "/home/sam/code/zephyr-workspace/zephyr/scripts/west_commands/sdk.py", line 18, in <module>
    import tqdm
ModuleNotFoundError: No module named 'tqdm'

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "/home/sam/code/zephyr-workspace/.venv/lib/python3.11/site-packages/west/app/main.py", line 561, in run_command
    self.run_extension(args.command, argv)
  File "/home/sam/code/zephyr-workspace/.venv/lib/python3.11/site-packages/west/app/main.py", line 685, in run_extension
    self.cmd = self.extensions[name].factory()
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/sam/code/zephyr-workspace/.venv/lib/python3.11/site-packages/west/commands.py", line 561, in __call__
    raise ExtensionCommandError(
west.commands.ExtensionCommandError

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/sam/code/zephyr-workspace/.venv/bin/west", line 8, in <module>
    sys.exit(main())
             ^^^^^^
  File "/home/sam/code/zephyr-workspace/.venv/lib/python3.11/site-packages/west/app/main.py", line 1176, in main
    app.run(argv or sys.argv[1:])
  File "/home/sam/code/zephyr-workspace/.venv/lib/python3.11/site-packages/west/app/main.py", line 255, in run
    self.run_command(argv, early_args)
  File "/home/sam/code/zephyr-workspace/.venv/lib/python3.11/site-packages/west/app/main.py", line 605, in run_command
    self.handle_extension_command_error(ece)
  File "/home/sam/code/zephyr-workspace/.venv/lib/python3.11/site-packages/west/app/main.py", line 431, in handle_extension_command_error
    self.cmd.err(msg, fatal=True)
    ^^^^^^^^^^^^
AttributeError: 'NoneType' object has no attribute 'err'

Environment (please complete the following information):

  • OS: Debian 12
  • Toolchain: N/A (the problem is that I can't run west sdk)
  • Commit SHA or Version used: b7d13ea

Additional context

Before this happened, I was using the Minimal Zephyr SDK with the following toolchains installed:

(.venv) $ west sdk
0.17.0:
  path: /home/sam/zephyr-sdk-0.17.0
  hosttools: installed
  installed-toolchains:
    - xtensa-espressif_esp32s3_zephyr-elf
    - arm-zephyr-eabi
  available-toolchains:
    ...
@samblenny samblenny added the bug The issue is a bug, or the PR is fixing a bug label Feb 3, 2025
Copy link

github-actions bot commented Feb 3, 2025

Hi @samblenny! We appreciate you submitting your first issue for our open-source project. 🌟

Even though I'm a bot, I can assure you that the whole community is genuinely grateful for your time and effort. 🤖💙

@nordicjm nordicjm added the area: West West utility label Feb 3, 2025
@pdgendt
Copy link
Collaborator

pdgendt commented Feb 4, 2025

The process you describe had the same issue that you'd need to call pip install -r zephyr/scripts/requirement.txt after updating using west, this isn't new.

But I agree this is poorly documented, I'll add an entry in the "Keeping Zephyr updated".

Modifying west update to call west packages pip --install isn't possible. The first is builtin west command, the latter is an extension. They live in different repositories, and AFAIK post-run hooks aren't available for west builtin commands.

Copy link

github-actions bot commented Apr 6, 2025

This issue has been marked as stale because it has been open (more than) 60 days with no activity. Remove the stale label or add a comment saying that you would like to have the label removed otherwise this issue will automatically be closed in 14 days. Note, that you can always re-open a closed issue at any time.

@github-actions github-actions bot added the Stale label Apr 6, 2025
@github-actions github-actions bot closed this as not planned Won't fix, can't repro, duplicate, stale Apr 20, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area: West West utility bug The issue is a bug, or the PR is fixing a bug priority: medium Medium impact/importance bug Stale
Projects
None yet
Development

No branches or pull requests

4 participants