scottlawsonbc / audio-reactive-led-strip

:musical_note: :rainbow: Real-time LED strip music visualization using Python and the ESP8266 or Raspberry Pi
MIT License
2.67k stars 642 forks source link

ImportError: No module named neopixel #286

Closed lucasvonherder closed 3 years ago

lucasvonherder commented 3 years ago

Hi, I have been trying to get this running for a few evenings now already without any success. I must say though that I am still quite early in my python adventures and am still getting a bit confused with what command installs where and so on.

I want to let this run on my Raspberry PI and use Rasperry OS light so only with the console. I am using Python 2.7 since I had issues getting 3.5 to run properly.

After a lot back and forth and trying I am again stuck at this error. (ImportError: No module named neopixel) I am not able to install the whole Neopixel library from Adafruit since its only working with python 3.7 as far as I understood.

I got the neopixelbus with git but neither know if I save it to the right folder nor if its actually containing the neopixel module.

It would be great if someone could help me with this. Kind regards, Lucas

drakeapps commented 3 years ago

FYI this fixed it for me. I'm not sure of the full implications of this change, so I'm not comfortable opening a PR

https://github.com/drakeapps/audio-reactive-led-strip/commit/726507f3d322afe4449b8a338cfffa8caeddee21

lucasvonherder commented 3 years ago

Hi drakeapp, thanks for your help. After a while I got back to this. I tried what worked for you but now get: RuntimeError: ws2811_init failed with code -5 (mmap() failed)

joeybab3 commented 3 years ago

@drakeapps Thanks for figuring that out! If anyone else is able to perform some QA testing I will definitely add that.

lucasvonherder commented 3 years ago

@drakeapps In the end I got it running with your fix. Thanks a lot. For some reason the readme instructions did not quite work for me and I had a massive mess with the packages but now its all running smoothly.

joeybab3 commented 3 years ago

@lucasvonherder any recommendations for how to improve it?

lucasvonherder commented 3 years ago

@joeybab3 It was a bit chaos so I cant quite reproduce the steps that I needed to do additionally. I will though try to set it up again on a raspberry zero. As soon I got to that I will create a pull request :)

SimonHeiss1731 commented 3 years ago

@lucasvonherder do you remember how you fixed that?

" RuntimeError: ws2811_init failed with code -5 (mmap() failed) "

I have the same issue right now.

lucasvonherder commented 3 years ago

@SimonHeiss1731 I think I reinstalled the rpi_ws281x package a different way. But I am not 100% sure.

SimonHeiss1731 commented 3 years ago

Thanks @lucasvonherder for your input, it's working now. So the error message " RuntimeError: ws2811_init failed with code -5 (mmap() failed) " actually comes from access denial while trying to access a peripheral device. If you launch your script from shell, try

And see the difference. You need to have root access for peripheral devices like the WS2812b, so you better launch it from shell with sudo, instead of what I did, using Thonny, where I couldn't manage to run scripts as root.

And for the actual problem "ImportError: No module named neopixel": I had a lot of different packages named rpi_ws281x from different sources and stored in different locations on the RPI, so I got rid of all of them. Then I followed this instruction []https://learn.adafruit.com/neopixels-on-raspberry-pi/python-usage .

Launched visualization.py from shell as sudo and it worked.