I'm missing neopixel for python unicornhat library


#1

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)


#2

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


#3

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

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


#4

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


#5

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

#6

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?


#7

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


#8

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

#9

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.


#10

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 https://github.com/jgarff/rpi_ws281x
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


#11

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.


#12

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