Re: Runner pyocd cannot find 'intelhex' while running ninja flash - is there a Python environment vaiable I am missing ?

Maureen Helm

Hi Bob,

The ‘intelhex’ error looks like you’re missing a python package, but even if you get that resolved you unfortunately cannot use pyocd in the Windows 10 Linux subsystem. WSL has limited support for USB. I recommend using the native Windows command prompt or a Linux VM.




From: users@... <users@...> On Behalf Of Bob Wilmes via Lists.Zephyrproject.Org
Sent: Thursday, May 30, 2019 1:15 PM
To: users@...
Cc: users@...
Subject: [Zephyr-users] Runner pyocd cannot find 'intelhex' while running ninja flash - is there a Python environment vaiable I am missing ?


I am a beginner using Windows 10 Linux subsystem running Ubuntu 18.04 LTS from the Windows app store as a development environment
I was able to get cmake working correctly after defining the environment variable ZEPHYR_BASE (below is a trace)
The problem I'm having is that the runner 'pyocd' cannot find the module 'intelhex' while running ninja flash
Is there a python environment variable that needs to be set to pickup 'intelhex' ?

Thanks for any help! Regards, Bob Wilmes

bobwilmes@WILMES:~/zephyrproject/zephyr/samples/hello_world/build$ cmake -GNinja -DBOARD=bbc_microbit ..
Zephyr version: 1.14.99
-- Selected BOARD bbc_microbit
-- Found west: /home/bobwilmes/.local/bin/west (found suitable version "0.5.7", minimum required is "0.5.6")
-- Loading /home/bobwilmes/zephyrproject/zephyr/boards/arm/bbc_microbit/bbc_microbit.dts as base
-- Overlaying /home/bobwilmes/zephyrproject/zephyr/dts/common/common.dts
Parsing Kconfig tree in /home/bobwilmes/zephyrproject/zephyr/Kconfig
Loading /home/bobwilmes/zephyrproject/zephyr/samples/hello_world/build/zephyr/.config as base
Configuration written to '/home/bobwilmes/zephyrproject/zephyr/samples/hello_world/build/zephyr/.config'
-- Cache files will be written to: /home/bobwilmes/.cache/zephyr
-- The C compiler identification is GNU 8.3.0
-- The CXX compiler identification is GNU 8.3.0
-- The ASM compiler identification is GNU
-- Found assembler: /opt/zephyr-sdk/arm-zephyr-eabi/bin/arm-zephyr-eabi-gcc
Including module: tinycbor in path: /home/bobwilmes/zephyrproject/modules/lib/tinycbor
Including module: qmsi in path: /home/bobwilmes/zephyrproject/modules/hal/qmsi
Including module: esp-idf in path: /home/bobwilmes/zephyrproject/modules/hal/esp-idf/zephyr
Including module: fatfs in path: /home/bobwilmes/zephyrproject/modules/fs/fatfs
Including module: mcumgr in path: /home/bobwilmes/zephyrproject/modules/lib/mcumgr
Including module: nffs in path: /home/bobwilmes/zephyrproject/modules/fs/nffs
Including module: segger in path: /home/bobwilmes/zephyrproject/modules/debug/segger
-- Configuring done
-- Generating done
-- Build files have been written to: /home/bobwilmes/zephyrproject/zephyr/samples/hello_world/build
bobwilmes@WILMES:~/zephyrproject/zephyr/samples/hello_world/build$ ninja flash
[1/106] Preparing syscall dependency handling

[98/104] Linking C executable zephyr/zephyr_prebuilt.elf
Memory region         Used Size  Region Size  %age Used
           FLASH:       10540 B       256 KB      4.02%
            SRAM:        2380 B        16 KB     14.53%
        IDT_LIST:          56 B         2 KB      2.73%
[103/104] Flashing bbc_microbit
Using runner: pyocd
Flashing Target Device
Traceback (most recent call last):
  File "/usr/local/bin/pyocd", line 7, in <module>
    from pyocd.__main__ import main
  File "/usr/local/lib/python3.6/dist-packages/pyocd/", line 21, in <module>
    from . import gdbserver
  File "/usr/local/lib/python3.6/dist-packages/pyocd/gdbserver/", line 17, in <module>
    from .gdbserver import GDBServer
  File "/usr/local/lib/python3.6/dist-packages/pyocd/gdbserver/", line 19, in <module>
    from ..flash.loader import (FlashLoader, FlashEraser)
  File "/usr/local/lib/python3.6/dist-packages/pyocd/flash/", line 21, in <module>
    from intelhex import IntelHex
ModuleNotFoundError: No module named 'intelhex'
ERROR: command exited with status 1: pyocd flash -e sector -t nrf51 /home/bobwilmes/zephyrproject/zephyr/samples/hello_world/build/zephyr/zephyr.hex
run as "west -v flash --skip-rebuild" for a stack trace
FAILED: zephyr/cmake/flash/CMakeFiles/flash
cd /home/bobwilmes/zephyrproject/zephyr/samples/hello_world/build && /home/bobwilmes/.local/lib/python2.7/site-packages/cmake/data/bin/cmake -E env /home/bobwilmes/.local/bin/west flash --skip-rebuild
ninja: build stopped: subcommand failed.

Join to automatically receive all group messages.