adafruit / Adafruit_CircuitPython_NeoPixel

CircuitPython drivers for neopixels.
MIT License
308 stars 99 forks source link

ImportError: No module named board #43

Closed karishmabava closed 5 years ago

karishmabava commented 5 years ago

Hi,

i am running it on Rpi yet it is giving me this error. Running the command as root.

Please help1

Karishma

ladyada commented 5 years ago

hiya please follow this guide https://learn.adafruit.com/neopixels-on-raspberry-pi

eddiewebb commented 4 years ago

@karishmabava after folloing the guide linked it failed for me, i found a force reinstall of blinka worked.

sudo python3 -m pip install --force-reinstall adafruit-blinka

R3tr0BoiDX commented 4 years ago

Thanks

seyo-IV commented 4 years ago

Having the same issue, force reinstall didn't help. Still missing the module.

caternuson commented 4 years ago

When you ran the Blinka install check, it ran without errors? https://learn.adafruit.com/circuitpython-on-raspberrypi-linux/installing-circuitpython-on-raspberry-pi#blinka-test-3-15

devin-perry commented 4 years ago

@caternuson I ran python3 blinkatest.py and got:

File "blinkatest.py", line 1, in <module> import board ModuleNotFoundError: No module named 'board'

gazhay commented 4 years ago

I followed the tutorial - it worked - rebooted and now get no module errors for "board". Literally only rebooted the pi.

Tried removing all and reinstalling, still didn't work.

mhaith commented 4 years ago

Same issue, ”No module named board,” even after force reinstall of blinks and run sudo update and sudo upgrade. Strangely, the python programs for the lsm9ds1 module I am using run perfectly when I bring them up in the idle editor and run them with the “run module,” but when I run them with the command line (which I need to start them from cron), I get this error message.

mhaith commented 4 years ago

Problem solved. Silly me. I was stipulating Python in the CLI rather than Python3. Needed to sleep on it.

avvy65 commented 3 years ago

I have been getting this error and did a force reinstall of adafruit blinka, ran the blinkatest.py script without error, but when I ran other adafruit python scripts I still got the same error. I used sudo python3 to run the scripts. As I don't know what else to do I've just given up with trying to use python scripts on a raspberry pi.

ben-kenney commented 3 years ago

I ran into this issue as well. After running:

sudo python3 -m pip install --force-reinstall adafruit-blinka

then then import board worked for me.

The --force-reinstall instruction is in the Python Installation of NeoPixel Library but might need to also be added to the Installing CircuitPython Libraries on Raspberry Pi as well.

danielfaust commented 3 years ago

If you installed it into a non-sudo virtual environment or as a user package, and then start the script by issuing sudo (in order to get access to the hardware), then the modules won't be available to Python. The solution would be to add the user to the group which has access to the hardware (ie i2c) and run the script without sudo.

nishantbb commented 3 years ago

Adding to this. .

I get the error when I try to run my script via cron at reboot. I've tried adding a 2 min sleep to the script before importing board. However, I get no errors if I run the script through an IDE or launch it through terminal.

I tried the force-reinstall but it did not change anything. No errors persist when running python script through terminal, but importing board fails at startup.

I do not need to run my script using sudo, and I don't think I did the force reinstall with sudo. Would installing using sudo help.

danielfaust commented 3 years ago

@nishantbb crontab uses /bin/sh as the default shell, so maybe there is some initialization done in .bashrc or another location which is not getting executed. Maybe adding SHELL=/bin/bash to the top of the crontab file would help. That is, if it is the user's cron, else I think it runs as root, in which case this would not work, as long as you're not executing the script as the user which installed the libraries. In that case "crontab running as a specific user" could be helpful.