9

I run the setup from this website to get my arduino to use AdaFruit LEDs. And also run:

sudo pip3 install adafruit-circuitpython-neopixel

I then made this python code:

import board
import neopixel
pixels = neopixel.NeoPixel(board.D18, 12, brightness=0.2)
pixels[0] = (255, 0, 0)

And then executed it with python filename.py And got the error:

ImportError: No module named 'board'

I then thought I maybe need to use python3 (Because it every where says too)

So I typed:

python3 light-test.py

This time got some more output, but in the end again an ImportError:

 File "light-test.py", line 2, in <module>
 import neopixel
 File "/usr/local/lib/python3.5/dist-packages/neopixel.py", line 34, in           
 <module>
 from neopixel_write import neopixel_write
 File "/home/pi/.local/lib/python3.5/site-packages/neopixel_write.py", line 
 15, in <module>
 from adafruit_blinka.microcontroller.raspi_23 import neopixel as _neopixel
 File "/home/pi/.local/lib/python3.5/site- 
 packages/adafruit_blinka/microcontroller/raspi_23/neopixel.py", line 3, in 
 <module>
 import _rpi_ws281x as ws
 ImportError: No module named '_rpi_ws281x'

So I don't know know what I am doing wrong.

pppery
  • 3,731
  • 22
  • 33
  • 46
Timothy Lukas H.
  • 684
  • 2
  • 9
  • 19
  • @jdv Thanks. But I am NOT using an arduino. I actually use an raspberry pi. – Timothy Lukas H. Nov 07 '18 at 20:15
  • 1
    You may get even more better results over at https://raspberrypi.stackexchange.com/ (BTW, what you have discovered here is a common problem with how helpers like PIP don't really understand multi-user systems. I'm sure this has been discussed there.) –  Nov 07 '18 at 20:29

3 Answers3

7

You're right to use Python3 instead of Python2.

One solution suggested here is to build the rpi_ws281x code from source.

Before that, however, you could try running as a super user/ administrator as suggested here.

jarcobi889
  • 815
  • 5
  • 16
6

If you're missing the 'board' module, that gets installed with the following pip3 command:

sudo pip3 install adafruit-blinka

ConcernedHobbit
  • 764
  • 1
  • 8
  • 17
1

I found that there was a board module already installed on my system (the wrong one). I deleted the board module and reinstalled adafruit-blinka to fix this.