Ok I figured out that those libraries need to be installed in the python3 of sudo, because weewx is starting as sudo... Not sure if this is the default behaviour or not
On Monday, July 11, 2022 at 7:21:49 PM UTC+2 Guido Cioni wrote: > I'm trying to add the BME280 sensor with the > https://gitlab.com/wjcarpenter/bme280wx plugin. I installed all required > dependencies and verified that the data are correctly read using a python > script containing > > import smbus2 > > which I invoke as python test.py. > I have only 1 version of python installed in this system, that is this > python linked to python3 > > pi@weather:~ $ python > Python 3.9.2 (default, Feb 28 2021, 17:03:44) > [GCC 10.2.1 20210110] on linux > > It has smbus2 installed > > pi@weather:~ $ pip list > Package Version > ------------- --------- > .... > smbus2 0.4.2 > .... > > this is apparently the same Python version used by weewx > > Jul 11 19:11:27 weather weewx[2704] INFO __main__: Using Python 3.9.2 > (default, Feb 28 2021, 17:03:44) #012[GCC 10.2.1 20210110] > > However this fails to import smbus2 > > Jul 11 19:11:27 weather weewx[2707] DEBUG weewx.engine: Loading service > user.bme280wx.Bme280wx > Jul 11 19:11:27 weather weewx[2707] CRITICAL __main__: Caught > unrecoverable exception: > Jul 11 19:11:27 weather weewx[2707] CRITICAL __main__: **** No module > named 'smbus2' > Jul 11 19:11:27 weather weewx[2707] CRITICAL __main__: **** Traceback > (most recent call last): > Jul 11 19:11:27 weather weewx[2707] CRITICAL __main__: **** File > "/usr/share/weewx/weewxd", line 147, in main > Jul 11 19:11:27 weather weewx[2707] CRITICAL __main__: **** > engine = weewx.engine.StdEngine(config_dict) > Jul 11 19:11:27 weather weewx[2707] CRITICAL __main__: **** File > "/usr/share/weewx/weewx/engine.py", line 93, in __init__ > Jul 11 19:11:27 weather weewx[2707] CRITICAL __main__: **** > self.loadServices(config_dict) > Jul 11 19:11:27 weather weewx[2707] CRITICAL __main__: **** File > "/usr/share/weewx/weewx/engine.py", line 161, in loadServices > Jul 11 19:11:27 weather weewx[2707] CRITICAL __main__: **** obj = > weeutil.weeutil.get_object(svc)(self, config_dict) > Jul 11 19:11:27 weather weewx[2707] CRITICAL __main__: **** File > "/usr/share/weewx/weeutil/weeutil.py", line 1150, in get_object > Jul 11 19:11:27 weather weewx[2707] CRITICAL __main__: **** mod = > __import__(module) > Jul 11 19:11:27 weather weewx[2707] CRITICAL __main__: **** File > "/usr/share/weewx/user/bme280wx.py", line 5, in <module> > Jul 11 19:11:27 weather weewx[2707] CRITICAL __main__: **** > import smbus2 > Jul 11 19:11:27 weather weewx[2707] CRITICAL __main__: **** > ModuleNotFoundError: No module named 'smbus2' > Jul 11 19:11:27 weather weewx[2707] CRITICAL __main__: **** Exiting. > > I'm really puzzled...which version of Python is weewx using? > -- You received this message because you are subscribed to the Google Groups "weewx-user" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To view this discussion on the web visit https://groups.google.com/d/msgid/weewx-user/91fd9eef-9ed5-4bf8-aad2-f6184ca4da5en%40googlegroups.com.
