I'm missing neopixel for python unicornhat library

unicornhat.py calls neopixel

master/python/UnicornHat/unicornhat.py

where can I find the neopixel python source files so I can build the module?

(I’m not on raspbian)

Reply to self, it’s included in the unicornhat library source.

I was just about to reply with exactly that answer! :-)

https://github.com/pimoroni/unicorn-hat/tree/master/python/rpi-ws281x

do i need https://github.com/pimoroni/unicorn-hat/tree/master/python/ws2812 as well?

why not just run the installer, it will pull everything you need from pip and roll a full working setup for you?

curl -sS get.pimoroni.com/unicornhat | bash

Thanks for your response.

I see what you’re suggesting, but that’s not what I’m trying to do. I’m not on raspbian, and I’m building by hand.
Do i need to build master/python/ws2812, or is master/python/rpi-ws281x enough?

Worth trying sudo pip install unicornhat or sudo python setup.py install in the unicorn-hat/python/UnicornHat/ directory?

yes, that builds me the python unicorn hat module, but building the rpi-ws281x (neopixel) module fails

building rpi-ws281x, yay!
running build
running build_py
Compiling ws281x library...
creating build
creating build/lib.linux-armv7l-2.7
copying neopixel.py -> build/lib.linux-armv7l-2.7
running build_ext
building '_rpi_ws281x' extension
creating build/temp.linux-armv7l-2.7
gcc -DNDEBUG -Os -fomit-frame-pointer -pipe -fPIC -Os -fomit-frame-pointer -Os -fomit-frame-pointer -fPIC -Ilib/ -I/usr/include/python2.7 -c rpi_ws281x_wrap.c -o build/temp.linux-armv7l-2.7/rpi_ws281x_wrap.o
gcc -shared -Wl,--as-needed -Wl,--as-needed -Os -fomit-frame-pointer -Os -fomit-frame-pointer build/temp.linux-armv7l-2.7/rpi_ws281x_wrap.o -Llib/ -L/usr/lib -lws2811 -lpython2.7 -o build/lib.linux-armv7l-2.7/_rpi_ws281x.so
/usr/lib/gcc/armv6-alpine-linux-muslgnueabihf/5.3.0/../../../../armv6-alpine-linux-muslgnueabihf/bin/ld: cannot find -lws2811
collect2: error: ld returned 1 exit status
error: command 'gcc' failed with exit status 1

Building by hand is fine if you’d rather use the version in the repo, and what @sandyjmacdonald is pointing you to… it’s the very purpose of the setup.py to roll the dependecies from pip.

If you want to also build the neopixel library from scratch, then I think you should clone the upstream repo and build it using that source, otherwise I see no point doing so as what you’ll end up with is the exact same thing as what is pushished on pip.

But to answer your question, no WS2812 is not used at this point, as noted in the front most README of the repo.

yes, that’s a good point, I should use the upstream neopixel source. Good spot.

(although I’ve just noticed that there is no git release tag on GitHub - jgarff/rpi_ws281x: Userspace Raspberry Pi PWM library for WS281X LEDs
which makes my packaging life harder, so perhaps I’ll stick with pimoroni’s fork. Now to get it to build … see above error)

I got confused by the name NeoPixel-WS2812

Incidentally, what OS are you running (and is it on a Pi?)… currently the ‘get’ installers are limited to Raspbian but we have hope to enlarge their scope to other Debian based distros in the future, so I’d like to try your environement when the time comes.

I’m packaging for Alpine Linux, which isn’t debian based (independant -awesome- distro)

Hi @scrumpyjack,
did you manage to compile all the libraries on Alpine Linux?
I’m trying to use UnicornHat drivers in an Alpine Linux container on a Rpi Zero WH but the compilation fails. The problem is with the ws281x library.
How did you compile it?

Thanks,

Diego