Unable to use local debugger - cython-hidapi issue


I’m attempting to use the debugger but it’s failing with:-

undefinedERROR:root:cython-hidapi is required on a Mac OS X Machine

Visual Studio Code 1.33.1
PIO Home 2.00 / Core 3.6.6

Checking size .pioenvs/frdm_kl25z/firmware.elf
Memory Usage -> http://bit.ly/pio-memory-usage
DATA:    [==        ]  20.0% (used 3277 bytes from 16384 bytes)
PROGRAM: [====      ]  35.5% (used 46584 bytes from 131072 bytes)
========================= [SUCCESS] Took 3.31 seconds =========================
Reading symbols from /Users/sl/Documents/PlatformIO/Projects/LoopyTest/.pioenvs/frdm_kl25z/firmware.elf...
undefinedERROR:root:cython-hidapi is required on a Mac OS X Machine

NameError: global name 'hid' is not defined
uncaught exception: global name 'hid' is not defined

pip list confirms hidapi is installed (and I’ve tried removing / re-installing it).

Any suggestions would be appreciated!

Steves-MBP:LoopyTest sl$ pip list
DEPRECATION: Python 2.7 will reach the end of its life on January 1st, 2020. Please upgrade your Python as Python 2.7 won't be maintained after that date. A future version of pip will drop support for Python 2.7.
 Package        Version      
-------------- -------------
blink1         0.2.3        
cffi           1.7.0        
Click          7.0          
colorama       0.3.3        
Cython         0.29.2       
futures        3.0.5        
hidapi         0.7.99.post21
mechanize      0.2.5        
mutagen        1.30         
olefile        0.44         
pip            19.0.3       
pycparser      2.14         
pyspotify      2.0.5        
requests       2.10.0       
schedule       0.3.2        
selenium       3.0.2        
setuptools     41.0.0       
webcolors      1.8.1

Could you try the next?

  1. Open your system terminal and type pip install pyocd
  2. Now, use your custom debugging server in pair with PlatformIO. See at the bottom of this page Custom — PlatformIO latest documentation

If you have more boards, you can specify a custom debug target with

platform = ...
board = ...
framework = mbed
debug_tool = custom
debug_server =


Many thanks for responding. I had already got to this point after working out the root problem with hidapi (I had multiple python / pip installations - one via homebrew, one without). I cleaned them all up and now just have the one.

The new problem is this:-

PlatformIO: Initializing remote target...

undefined0000209:WARNING:gdb_server:pyocd-gdbserver is deprecated; please use the new combined pyocd tool.

Waiting for a debug probe to be connected...

.pioinit:10: Error in sourced command file:

:3333: Operation timed out.

Does it work if you run pyocd -t kl25z directly from CLI?