pimoroni / sgp30-python

Python library for the SGP30 air quality sensor
https://shop.pimoroni.com/products/sgp30-air-quality-sensor-breakout
MIT License
38 stars 18 forks source link

install.sh missing smbus2 #2

Closed calocedrus closed 4 years ago

calocedrus commented 4 years ago

Installing from the install.sh script, running the test.py example, gives: File "examples/test.py", line 5, in <module> sgp30 = SGP30() File "build/bdist.linux-armv7l/egg/sgp30/__init__.py", line 51, in __init__ ImportError: No module named smbus2 Either in python2 or 3. Shouldn't the install.sh script include installing smbus2? smbus2 can be installed via pip: sudo pip3 install smbus2 Then all is well.

Gadgetoid commented 4 years ago

It looks like you're running the library locally somehow (directly out of build/bdist.linux-armv7l), rather than installing it? Possibly building with one Python version and running with another? I'm not sure.

Under normal circumstances (ie: sudo pip install sgp30) the smbus2 dependency would be satisfied by install_requires:

https://github.com/pimoroni/sgp30-python/blob/466d0ecd154c9fed3546cbb50c48ecd7cf0d2ab1/library/setup.cfg#L29-L30

Gadgetoid commented 4 years ago

Oh must note that sudo pip install sgp30 doesn't install our SGP30 library, which isn't even released to pypi yet. So you would have to run sudo python3 setup.py install, which should pull in smbus2

Gadgetoid commented 4 years ago

Okay sudo pip install pimoroni-sgp30 should now install our library. Let me know if that still explodes!