ModuleNotFoundError: No module named 'RPi'

Hello,
I don’t know how python works.

I install library like that:

git clone https://github.com/sixfab/Sixfab_RPi_CellularIoT_Library.git
cd Sixfab_RPi_CellularIoT_Library
sudo python3 setup.py install

and

sudo pip3 install sixfab-cellulariot

I created a python file for relay:

from cellulariot import cellulariot
import time

node = cellulariot.CellularIoTApp()
node.setupGPIO()

node.disable()
time.sleep(1)
node.enable()

time.sleep(0.5)
node.turnOnRelay()
time.sleep(2)

But when I tried:
python3 relay.py

I have this error:

Traceback (most recent call last):
  File "relay.py", line 1, in <module>
    from cellulariot import cellulariot
  File "/usr/local/lib/python3.7/dist-packages/sixfab_cellulariot-1.2.0-py3.7.egg/cellulariot/cellulariot.py", line 11, in <module>
ModuleNotFoundError: No module named 'RPi'

Where is my error?
Thanks

First part solve, thanks to my friend Carmelo.

pip3 install RPi.GPIO
pip3 install smbus

Now:

Sixfab Raspberry Pi Cellular IoT Application Shield Class initialized!
Traceback (most recent call last):
  File "relay.py", line 7, in <module>
    node.turnOnRelay()
  File "/usr/local/lib/python3.7/dist-packages/sixfab_cellulariot-1.2.0-py3.7.egg/cellulariot/cellulariot.py", line 756, in turnOnRelay
RuntimeError: Please set pin numbering mode using GPIO.setmode(GPIO.BOARD) or GPIO.setmode(GPIO.BCM)
/usr/local/lib/python3.7/dist-packages/sixfab_cellulariot-1.2.0-py3.7.egg/cellulariot/cellulariot.py:125: RuntimeWarning: No channels have been set up yet - nothing to clean up!  Try cleaning up at the end of your program instead!

Hi @fred,
This library is only available for Cellular IoT HAT and Cellular IoT Application Shields.

Sorry, mistake, I have raspberry-pi-cellular-iot-application-shield .

When I try sample sensor_test.py

Sixfab Raspberry Pi Cellular IoT Application Shield Class initialized!
BG96 module disabled!
BG96 module enabled!
Traceback (most recent call last):
  File "sensor_test.py", line 18, in <module>
    print("Acceleration: "+str(node.readAccel()))
  File "/usr/local/lib/python3.7/dist-packages/sixfab_cellulariot-1.2.0-py3.7.egg/cellulariot/cellulariot.py", line 724, in readAccel
  File "/usr/local/lib/python3.7/dist-packages/sixfab_cellulariot-1.2.0-py3.7.egg/cellulariot/MMA8452Q.py", line 33, in __init__
FileNotFoundError: [Errno 2] No such file or directory

Okay. Please check if I2C is enabled.
Enable serial_hw and I2C interfaces by following instructions below:

  1. Run sudo raspi-config
  2. Select 5 Interfacing Options
  3. Enable P5 I2C
  4. For P6 Serial
    • Disable Login shell to be accessible over serial
    • Enable Serial port hardware
  5. Finish
  6. Reboot

Yeeeeeeah! It’s works!

In docs, there is P6 serial settings advice, but not P5 I2C.

Thanks a lot! :star_struck: :hugs:

I have other questions. I will open other thread.
Thanks again

1 Like

Just to add some info. I tried all the above. What worked for me was to comment this line from /boot/config.txt

#dtoverlay=pi3-miniuart-bt