Unicorn pHAT, Pi Zero W & rpi_ws281x Library

I’ve seen this problem crop up from time to time around the net, but was wondering if there is a definitive way to fix it.

Basically when trying to run commands for the Unicorn pHAT I get errors along the lines of

File “”, line 1, in
File “/usr/local/lib/python2.7/dist-packages/unicornhat.py”, line 35, in
File “/usr/local/lib/python2.7/dist-packages/rpi_ws281x/rpi_ws281x.py”, line 130, in begin
raise RuntimeError(‘ws2811_init failed with code {0} ({1})’.format(resp, str_resp))
RuntimeError: ws2811_init failed with code -9 (Failed to create mailbox device)


That another error with the library that /dev/mem is forbidden to access.

I am running as a user that is a member of the gpio group—which seemed to fix the issue in the past, but does not help me.

It seems that the solutions are, run python as root OR find some way of fixing the library to work. When I first installed the Unicorn pHAT maybe 2 years ago it was completely fine. So I am guessing updates to the neopixel library have broken it.

Thanks for any advice.