Breakout Garden Issue

Hi,
I have a Pi 4 4gb and very little knowledge of python coding (in the process of learning). Have purchased a Breakout Garden and several breakouts. Having followed the code for install for the SGP30 Air quality sensor, when I run the example in Thonny python I get the following message:
ModuleNotFoundError: No module named ‘sgp30’
Any help would be greatly appreciated, I have included a screenshot of the code.
Thanks

i2c enabled?
Does it show up if you run
sudo i2cdetect -y 1
from terminal window?

Also try
sudo pip3 install pimoroni-sgp30
and retry the example.

Hi,
Thanks for the reply, i2c is enabled. Ran ‘sudo pip3 install pimoroni-sgp30’ in termial and it got me further than before. Now I get this? (Any further help would be great)

Where did you get the file your running? I ask because the test file in the examples makes no reference to SMBUS? I’m thinking you don’t need it for the Pimoroni version?

sgp30-python/test.py at master · pimoroni/sgp30-python · GitHub

You could try
sudo pip install smbus
sudo pip3 install smbus
or this maybe?
sudo apt-get update
sudo apt-get install -y python3-smbus

Hi,
Thanks again for the response.
I could not understand the reference to SMBUS myself. Ran the code under your message and same result and tried the update installs in terminal window - still same error message.
Not sure if there is something else I should be doing to get the module installed?
Ran i2cdetect -y 1 and it returned this:

The 0x58 is the SGP30. Where did you come by the code your running?
Can you post the full file please?

It’s the example file for the SPG30 from the pimironi site:

Ah, OK, I missed that the error is actually from the init.py called up by the example. Not directly from the test file. Sorry about that. I thought you were running a modified file or something. I still don’t know what’s going wrong though?
When you ran the pip install smbus etc, did it say already installed?

One option is to post your issue here.

Hi,
Yes, says it is installed in the terminal. I will post in the link you provided.
Thanks for all the help, if you think of anything else I might be missing/doing wrong please let me know.

I can’t think of anything at the moment. Just curious what other breakouts you have plugged in? I saw a couple other addresses in your i2cdetect. I have done quit a bit of tinkering with Breakout garden stuff. Multiple i2c breakouts aren’t an issue as long as no two have the same address. My Python skills are maybe average, I’m far from being any kind of expert. I do think this is a Python issue though.

Looking at that error message, it’s looking to import smbus2 rather than smbus, so you might find that

pip3 install smbus2

gets you further (I honestly can’t remember which I’ve installed, but I’m going from the error message!)

I’ve used breakouts that use SMBUS like the BME280, they call it up in the actual python file though. Stuff like this.

try:
    from smbus2 import SMBus
except ImportError:
    from smbus import SMBus

And the installer references it too, sudo pip install pimoroni-bme280 smbus
Kind of lost as to what’s going on here though. And I don’t have that breakout to play with.

Have you tried running it from python2 from terminal?
sudo python /home/pi/pimoroni/sgp30-python/test.py < I think that’s right?

Yeah, looks like a lot of the other breakout libraries have that fallback, but not the SGP30.

You might get away with just copying that fallback into the library (if I had one I’d try it out / send a PR)

Thanks for all the help. Had to take a break for today, will try the suggestions and feed back on here - I need to crack this and get my sensors working!
Thanks again

Brilliant, thanks for all your help, running ‘pip3 install smbus2’ worked and I have my first sensor working!
Just 3 more sensors and the 1.3 inch LCD to get up and running now.
So glad that I posted on the forum - great to find people happy to lend some advice to an enthusiastic beginner.

Nice to hear that that worked.
I have that display, and have it working on my Breakout Garden. Make sure SPI is enabled. And just FYI, the breakout garden (hat) installer will only look for i2c devices, it can’t detect SPI breakouts. I don’t think your using it but I’ll mention it anyway. I always do the manual installs for each breakout. It’s what works for me anyway.
Also JFYI depending on what breakouts / sensors you have plugged in, you may be able to run some of the Enviro or Enviro + examples. You’d have to edit for that bigger screen though. I also have the smaller 0.96 screen that the Enviro uses and ran that code on my breakout garden setup with a BME280 etc.