Sgp30 test.py not running

I’d be grateful for any help with this. I have just got a new rpi4 4gb, a garden breakout and a sgp30 air quality sensor with the plan of making an indoor air quality meter. I have installed a new burn of rasabian and done all the updates. I have seen for a previous thread that garden doesn’t seem to recognise the sgp30 for some reason so I have done a manual install from the github link - git clone https://github.com/Pimoroni/sgp30-Python. On the i2cdetect -y 1 command I can see the 58 address of the sgp30 so I am assuming that it is installed properly. However, when I try to run the test.py program via thonny I get the same error continuously:

File “/home/pi/sgp30-python/examples/test.py”, Lionel 5 in
Sgp30 = SGP30()
File “/user/local/lib/python3.7/dist-packages/spg30-0.0.1-py3.7.egg/sgp30/init.py” line51, in_init_
from smbus2 import SMBus, i2c_msg
ModuleNotFoundError: No module names ‘smbus2’

Cheers
James

Try running sudo pip3 install sgp30 and then see if test.py works.
pip installs the Python 2 libraries while
pip3 installs the python 3 versions.
Thats my understanding anyway.

I have tried both pip and pip3 to install and still the test.py does not run without the error. I’m not sure if there is something that `i need to do about the smbus2 module? I have done a search about installing the smbus2 module but with no luck.

when I do pip3 install i get
Requirement already satisfied: sgp30 in /usr/local/lib/pyhton3.7/dist-packages/sgp30-0.0.1-py3.egg (0.0.1)
Requirement already satisfied: setuptools>=30.4.0 in /usr/local/lib/pyhton3.7/dist-packages (from sgp30) (42.0.2)

Ok try this sudo apt-get install -y python3-smbus
I’m guessing this is Buster Lite?

Thanks for your help with this. I am really grateful.
Unfortunately i did the install for SMBus as above and the response was:

Python3-SMBus is already the newest version (4.1-1).

I also tried changing it to smbus2 but that doesn’t exist! Worth a try.
I have also just tried to run the test.py directly with :
python3 test.py

The same error messages appear as previously.

Anymore suggestions are gratefully received.

Try
sudo apt-get install -y python-smbus
I think that will install the python 2 version.

OK so no joy with that either.
same message to say that it was already installed.
I did think that uninstalling them and then reinstalling might help but alas no. Still getting:

%Run test.py
Traceback (most recent call last):
File “/home/pi/Pimoroni/sgp30/examples/test.py”, line 5, in
sgp30 = SGP30()
File “/usr/local/lib/python3.7/dist-packages/sgp30-0.0.1-py3.7.egg/sgp30/init.py”, line 51, in init
from smbus2 import SMBus, i2c_msg
ModuleNotFoundError: No module named ‘smbus2’

I have also turned off and on the i2c interface to see if that helps. No joy.
I was sure this was going to be a quick(ish) project. You can just never tell!

I’m at a loss as to what’s gone wrong? I don’t own an Sgp30, just so you know.

Thanks for trying. I think my next plan is to do a fresh install and maybe try it out on a zero or 3b to see if that makes a difference. I’ll keep you updated. Cheers

If your currently running Buster Lite, try the Buster with desktop. The one between lite and Full. Full I believe just has a bunch of extra programs installed, mainly aimed at kids, something like that. You can always just go into Raspberry Pi configuration and set it to boot to command line instead of the Desktop GUI. It will save resources and be almost if not the same as running lite. There may be a couple of things running in the background you wouldn’t get in lite but it works for me. I like setting things up from a GUI.

sudo pip install smbus2

that should sort it

Hi, I am running the full version of buster and even with the sudo pip install smbus2, I still get the same error. Interestingly, I decided to try the Adafruit sgp30 and it has run first time with no problems. Is a sgo30 module failure likely? If so I might try to return it for a replacement.
Happy Christmas
Cheers