pimoroni / fanshim-python

Python library for the Fan SHIM for Raspberry Pi
https://shop.pimoroni.com/products/fan-shim
MIT License
295 stars 85 forks source link

"Not running on a Pi" when running on a Pi #77

Closed ghost closed 4 years ago

ghost commented 4 years ago

Note: the instructions on https://learn.pimoroni.com/tutorial/sandyj/getting-started-with-fan-shim seem to lead to fanshim being installed for python2, but I might have to raise a different issue for that

voltagex@raspberrypi:~/fanshim-python/examples $ python
Python 2.7.16 (default, Oct 10 2019, 22:02:15)
[GCC 8.3.0] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> from fanshim import FanShim
>>> fanshim = FanShim()
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "build/bdist.linux-armv7l/egg/fanshim/__init__.py", line 34, in __init__
RuntimeError: Not running on a RPi!

I'm on a 4GB Pi4 with the shim installed, a green light from the LED blinding me and using a pretty stock Raspbian Buster Full install.

olm52 commented 4 years ago

I have a similar error running on archlinuxarm:

[audiolinux@raspberry ~]$ fanshim Traceback (most recent call last): File "/usr/bin/fanshim", line 87, in fanshim = FanShim() File "/usr/lib/python3.8/site-packages/fanshim/init.py", line 34, in init GPIO.setup(self._pin_fancontrol, GPIO.OUT) RuntimeError: Not running on a RPi!

Gadgetoid commented 4 years ago

This is an error produced by the RPi.GPIO library, you should attempt to update it to see if it fixes the problem:

python -m pip install rpi.gpio --upgrade

This may possibly also be related and suggests permissions issues: https://sourceforge.net/p/raspberry-gpio-python/tickets/171/

olm52 commented 4 years ago

Ok, python-pip was not installed. Strange... 0.3 was working before.

olm52 commented 4 years ago

Today the problem is back... python-pip updated

File "/usr/bin/fanshim", line 87, in fanshim = FanShim() File "/usr/lib/python3.8/site-packages/fanshim/init.py", line 35, in init GPIO.setup(self._pin_button, GPIO.IN, pull_up_down=GPIO.PUD_UP) RuntimeError: Not running on a RPi!

Gadgetoid commented 4 years ago

If you're using Python 3 you would need:

python3 -m pip install rpi.gpio --upgrade

But, broadly, this is an issue with RPi.GPIO and not something that can be fixed here if the updated version doesn't work.