Build error (ModuleNotFoundError: No module named 'elftools')

Normally when I’m troubleshooting Zephyr build errors (especially on the command line) I look at the most recent error. In this case that would be ModuleNotFoundError: No module named 'elftools'

If it’s not able to find elftools, that probably means that it doesn’t see the build tools generally. I had a Python virtual environment already active, so I went back through and made sure i ran the following two commands from our Zephyr setup guide:

  • west zephyr-export
  • pip install -r ~/golioth-zephyr-workspace/zephyr/scripts/requirements.txt

I had created my Zephyr build in a different location, so for me, I went to the top level folder called latest and modified for the zephyr folder there:

pip install -r zephyr/scripts/requirements.txt

All we’re trying to do is to get pip to install additional dependencies to work in conjunction with the west meta tool.

Once I ran the command and saw all the dependencies installing, it made me think that I probably just skipped this step in the past. The build worked great after that.

1 Like