best way for running a driver program as standalone

109 views
Skip to first unread message

Saverio Guzzo

unread,
Feb 17, 2022, 12:36:17 PM2/17/22
to weewx-user
Hello community, this is my first post here! :)

I am interested in running the vantage's driver program as standalone, in order to integrate it in my application. Could you please give me some suggestions on how to achieve that?

I am struggling already at installing the requirements.... I tried to install them using both venv and conda env, but I get the error "distutils.errors.DistutilsOptionError: can't combine user with prefix, exec_prefix/home, or install_(plat)base".

Should I also export the env variable PYTHONPATH=bin python -m weewx.drivers.vantage? When trying to do this, I get the errors "-bash: export: not valid in this context: -m" and "-bash: export: `weewx.drivers.vantage': not a valid identifier".

Could you kindly give me some directions? I would really aprpeciate it :)

Thanks,
Saverio

Tom Keffer

unread,
Feb 19, 2022, 7:51:16 AM2/19/22
to weewx-user
We need a little more information. For example, you said you tried to install the requirements, but did not give the commands you tried. Did you use pip? Or apt-get? Or, something else?

I am guessing that you probably got the distutils.errors.DistutilsOptionError error because you tried installing the prerequisites in the same directory as weewx. If you try this, venv will see the setup.cfg file and try and install the prerequisites in /home/weewx.

This works for me with venv. 

tkeffer@nuc:~$ cd ~
tkeffer@nuc:~$ python3 -m venv py-weewx
tkeffer@nuc:~$ source py-weewx/bin/activate
(py-weewx) tkeffer@nuc:~$ python3 -m pip install configobj
(py-weewx) tkeffer@nuc:~$ python3 -m pip install Cheetah3
(py-weewx) tkeffer@nuc:~$ python3 -m pip install Pillow
(py-weewx) tkeffer@nuc:~$ python3 -m pip install pyserial
(py-weewx) tkeffer@nuc:~$ python3 -m pip install pyusb
(py-weewx) tkeffer@nuc:~$ wget http://weewx.com/downloads/weewx-4.6.2.tar.gz
(py-weewx) tkeffer@nuc:~$ tar xvf weewx-4.6.2.tar.gz
(py-weewx) tkeffer@nuc:~$ cd weewx-4.6.2
(py-weewx) tkeffer@nuc:~/weewx-4.6.2$ PYTHONPATH=bin python3 -m weewx.drivers.vantage
{'dateTime': 1645274802, 'usUnits': 1, 'barometer': 30.141, 'inTemp': 68.9, 'inHumidity': 41.0, 'outTemp': 42.1, 'windSpeed': 1.0, 'windSpeed10': 3.0, 'windDir': 202.0, 'outHumidity': 80.0, 'rainRate': 0.0, 'UV': 0.0, 'radiation': 0.0, 'stormRain': 0.0, 'dayRain': 0.0, 'monthRain': 0.2, 'yearRain': 17.85, 'dayET': 0.004, 'monthET': 1.03, 'yearET': 1.52, 'leafWet4': 0.0, 'insideAlarm': 0, 'rainAlarm': 0, 'outsideAlarm1': 0, 'outsideAlarm2': 0, 'extraAlarm1': 0, 'extraAlarm2': 0, 'extraAlarm3': 0, 'extraAlarm4': 0, 'extraAlarm5': 0, 'extraAlarm6': 0, 'extraAlarm7': 0, 'extraAlarm8': 0, 'soilLeafAlarm1': 0, 'soilLeafAlarm2': 0, 'soilLeafAlarm3': 0, 'soilLeafAlarm4': 0, 'txBatteryStatus': 0, 'consBatteryVoltage': 3.83, 'forecastIcon': 6, 'forecastRule': 63, 'sunrise': 1645282920, 'sunset': 1645321140, 'rain': None}
{'dateTime': 1645274803, 'usUnits': 1, 'barometer': 30.141, 'inTemp': 68.9, 'inHumidity': 41.0, 'outTemp': 42.1, 'windSpeed': 1.0, 'windSpeed10': 3.0, 'windDir': 202.0, 'outHumidity': 80.0, 'rainRate': 0.0, 'UV': 0.0, 'radiation': 0.0, 'stormRain': 0.0, 'dayRain': 0.0, 'monthRain': 0.2, 'yearRain': 17.85, 'dayET': 0.004, 'monthET': 1.03, 'yearET': 1.52, 'leafWet4': 0.0, 'insideAlarm': 0, 'rainAlarm': 0, 'outsideAlarm1': 0, 'outsideAlarm2': 0, 'extraAlarm1': 0, 'extraAlarm2': 0, 'extraAlarm3': 0, 'extraAlarm4': 0, 'extraAlarm5': 0, 'extraAlarm6': 0, 'extraAlarm7': 0, 'extraAlarm8': 0, 'soilLeafAlarm1': 0, 'soilLeafAlarm2': 0, 'soilLeafAlarm3': 0, 'soilLeafAlarm4': 0, 'txBatteryStatus': 0, 'consBatteryVoltage': 3.83, 'forecastIcon': 6, 'forecastRule': 63, 'sunrise': 1645282920, 'sunset': 1645321140, 'rain': 0.0}



--
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 weewx-user+...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/weewx-user/0bb1abeb-0ff2-4a65-b345-042e51d57482n%40googlegroups.com.

Saverio Guzzo

unread,
Feb 21, 2022, 9:21:35 AM2/21/22
to weewx-user
Brilliant! This works :) thank you so much Tom

Saverio Guzzo

unread,
Feb 21, 2022, 9:23:12 AM2/21/22
to weewx-user
P.S. I was trying with "python3 setup.py install" and pip but it was not a success in both cases.
Reply all
Reply to author
Forward
0 new messages