[Solved] No module named grove.i2c

Hi All,

I’m using an RPi 4 with raspbian installed. I have attempted to reinstall grovepi twice now; the quick method way and walk through manual way and both were successful. All details below.

OS:
PRETTY_NAME=“Raspbian GNU/Linux 10 (buster)”
NAME=“Raspbian GNU/Linux”
VERSION=“10 (buster)”

The Error I receive:
pi@raspberrypi:~/pico/Seeed_Python_SGP30/examples $ python sgp30_simpleread.py
Traceback (most recent call last):
File “sgp30_simpleread.py”, line 3, in
from grove.i2c import Bus
ImportError: No module named grove.i2c

The code:
import seeed_sgp30
import grovepi
from grove.i2c import Bus

sgp30 = seeed_sgp30.grove_sgp30(Bus())
while True:
data = sgp30.read_measurements()
co2_eq_ppm, tvoc_ppb = data.data
print("\r tVOC = {} ppb CO2eq = {} ".format(
tvoc_ppb, co2_eq_ppm))

Troubleshoot All log.txt:
Check space left

Filesystem Size Used Avail Use% Mounted on
/dev/root 30G 2.6G 26G 10% /
devtmpfs 1.8G 0 1.8G 0% /dev
tmpfs 2.0G 0 2.0G 0% /dev/shm
tmpfs 2.0G 8.4M 1.9G 1% /run
tmpfs 5.0M 4.0K 5.0M 1% /run/lock
tmpfs 2.0G 0 2.0G 0% /sys/fs/cgroup
/dev/mmcblk0p1 253M 53M 200M 21% /boot
tmpfs 391M 0 391M 0% /run/user/1000

Check for dependencies

python 2.7.16-1 install ok installed
python-pip 18.1-5+rpt1 install ok installed
git 1:2.20.1-2+deb10u1 install ok installed
libi2c-dev 4.1-1 install ok installed
python-serial 3.4-4 install ok installed
python-rpi.gpio 0.7.0~buster-1 install ok installed
i2c-tools 4.1-1 install ok installed
python-smbus 4.1-1 install ok installed
dpkg-query: no packages found matching arduino
dpkg-query: no packages found matching minicom
scratch 1.4.0.6~dfsg1-6 install ok installed

wiringPi Not Found (ERR)
I2C still in blacklist (ERR)
SPI still in blacklist (ERR)

Check for addition in /modules

I2C-dev already there
i2c-bcm2708 already there
spi-dev already there

Hardware revision

./software_status.sh: line 78: gpio: command not found

Check the /dev folder

i2c-1
ttyAMA0

USB device status

Bus 002 Device 001: ID 1d6b:0003 Linux Foundation 3.0 root hub
Bus 001 Device 002: ID 2109:3431 VIA Labs, Inc. Hub
Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub

/: Bus 02.Port 1: Dev 1, Class=root_hub, Driver=xhci_hcd/4p, 5000M
/: Bus 01.Port 1: Dev 1, Class=root_hub, Driver=xhci_hcd/1p, 480M
|__ Port 1: Dev 2, If 0, Class=Hub, Driver=hub/4p, 480M
Raspbian for Robots Version

cat: /home/pi/di_update/Raspbian_For_Robots/Version: No such file or directory

Hostname

raspberrypi

Checking for Atmega chip

avrdude: Version 5.10, compiled on Jun 18 2012 at 12:38:29
Copyright © 2000-2005 Brian Dean, http://www.bdmicro.com/
Copyright © 2007-2009 Joerg Wunsch

     System wide configuration file is "/etc/avrdude.conf"
     User configuration file is "/home/pi/.avrduderc"
     User configuration file does not exist or is not a regular file, skipping

     Using Port                    : unknown
     Using Programmer              : gpio
     AVR Part                      : ATMEGA328P
     Chip Erase delay              : 9000 us
     PAGEL                         : PD7
     BS2                           : PC2
     RESET disposition             : dedicated
     RETRY pulse                   : SCK
     serial program mode           : yes
     parallel program mode         : yes
     Timeout                       : 200
     StabDelay                     : 100
     CmdexeDelay                   : 25
     SyncLoops                     : 32
     ByteDelay                     : 0
     PollIndex                     : 3
     PollValue                     : 0x53
     Memory Detail                 :

                              Block Poll               Page                       Polled
       Memory Type Mode Delay Size  Indx Paged  Size   Size #Pages MinW  MaxW   ReadBack
       ----------- ---- ----- ----- ---- ------ ------ ---- ------ ----- ----- ---------
       eeprom        65     5     4    0 no       1024    4      0  3600  3600 0xff 0xff
       flash         65     6   128    0 yes     32768  128    256  4500  4500 0xff 0xff
       lfuse          0     0     0    0 no          1    0      0  4500  4500 0x00 0x00
       hfuse          0     0     0    0 no          1    0      0  4500  4500 0x00 0x00
       efuse          0     0     0    0 no          1    0      0  4500  4500 0x00 0x00
       lock           0     0     0    0 no          1    0      0  4500  4500 0x00 0x00
       calibration    0     0     0    0 no          1    0      0     0     0 0x00 0x00
       signature      0     0     0    0 no          3    0      0     0     0 0x00 0x00

     Programmer Type : GPIO
     Description     : Use sysfs interface to bitbang GPIO lines

avrdude: AVR device initialized and ready to accept instructions

Reading | ################################################## | 100% 0.00s

avrdude: Device signature = 0x1e950f
avrdude: safemode: lfuse reads as FF
avrdude: safemode: hfuse reads as DA
avrdude: safemode: efuse reads as 5

avrdude: safemode: lfuse reads as FF
avrdude: safemode: hfuse reads as DA
avrdude: safemode: efuse reads as 5
avrdude: safemode: Fuses OK

avrdude done. Thank you.

Checking I2C bus for devices

Checking I2C bus 0

Error: Could not open file /dev/i2c-0' or /dev/i2c/0’: No such file or directory

Checking I2C bus 1

 0  1  2  3  4  5  6  7  8  9  a  b  c  d  e  f

00: – 04 – -- – -- – -- – -- – -- –
10: – -- – -- – -- – -- – -- – -- – -- – --
20: – -- – -- – -- – -- – -- – -- – -- – --
30: – -- – -- – -- – -- – -- – -- – -- – --
40: – -- – -- 44 45 – -- – -- – -- – -- – --
50: – -- – -- – -- – -- 58 – -- – -- – -- –
60: – -- – -- – -- – -- – -- – -- – -- – --
70: – -- – -- – -- – --

Checking for firmware version

GrovePi has firmware version: 1.3.0

Hi @sdilella5

I believe the code you are attempting to run is meant for the Grove Base, and not the GrovePi+

I resolved it by changing the directory folder name from “grovepi.py” to simply “grovepi”…not sure what difference that made or if i somehow messed that up during install…thanks for the contribution though!

Ah yes that would do it. You cannot re-use the name of a python library for either a folder or another file. it totally confuses Python…
Thanks for letting us know it’s solved

Stay safe,
Cleo