install requests by weewx 5

193 views
Skip to first unread message

Hartmut Schweidler

unread,
Jan 11, 2023, 3:59:11 AM1/11/23
to weewx-development
Guten Morgen,
nach der Installation von weewx5 mit pip3 ...

benötige ich noch eine Installation von  requests  und urllib3
erscheint
hes1@ba001:~$ pip3 install requests --user
Requirement already satisfied: requests in /usr/local/lib/python3.9/dist-packages (2.26.0)
Requirement already satisfied: urllib3<1.27,>=1.21.1 in ./.local/lib/python3.9/site-packages (from requests) (1.26.13)
Requirement already satisfied: certifi>=2017.4.17 in /usr/local/lib/python3.9/dist-packages (from requests) (2021.10.8)
Requirement already satisfied: charset-normalizer~=2.0.0 in ./.local/lib/python3.9/site-packages (from requests) (2.0.12)
Requirement already satisfied: idna<4,>=2.5 in /usr/local/lib/python3.9/dist-packages (from requests) (3.3)
hes1@ba001:~$ weewxd
Traceback (most recent call last):
  File "/home/hes1/.local/bin/weewxd", line 8, in <module>
    sys.exit(main())
  File "/home/hes1/.local/pipx/venvs/weewx/lib/python3.9/site-packages/weewxd.py", line 149, in main
    engine = weewx.engine.StdEngine(config_dict)
  File "/home/hes1/.local/pipx/venvs/weewx/lib/python3.9/site-packages/weewx/engine.py", line 81, in __init__
    self.setupStation(config_dict)
  File "/home/hes1/.local/pipx/venvs/weewx/lib/python3.9/site-packages/weewx/engine.py", line 108, in setupStation
    __import__(driver)
  File "/home/hes1/.local/pipx/venvs/weewx/lib/python3.9/site-packages/user/wll.py", line 29, in <module>
    import requests
ModuleNotFoundError: No module named 'requests'

Tom Keffer

unread,
Jan 11, 2023, 7:49:42 AM1/11/23
to Hartmut Schweidler, weewx-development
This brings up a good point.

The virtual environment used by pipx (~/.local/pipx/venvs/weewx) is not aware of the pip user area ~/.local/lib/python3.9/site-packages. Instead, you have to install dependencies directly into the VE used by pipx:

pipx inject weewx requests

Definitely a limitation to using pipx. I'll have to think about whether we want to recommend this approach.

Thanks again, Hartmut.

-tk


--
You received this message because you are subscribed to the Google Groups "weewx-development" group.
To unsubscribe from this group and stop receiving emails from it, send an email to weewx-developm...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/weewx-development/a6f1e5d9-6337-47f8-8bf7-1e7613a3f9ccn%40googlegroups.com.

Hartmut Schweidler

unread,
Jan 11, 2023, 8:36:20 AM1/11/23
to weewx-development
Meine Lösung ein ff. Links

ln -s /usr/local/lib/python3.9/dist-packages/requests                                  /home/hes1/.local/pipx/venvs/weewx/lib/python3.9/site-packages
ln -s /usr/local/lib/python3.9/dist-packages/requests-2.26.0.dist-info     /home/hes1/.local/pipx/venvs/weewx/lib/python3.9/site-packages
ln -s /usr/local/lib/python3.9/dist-packages/urllib3 /home/hes1/.local/pipx/venvs/weewx/lib/python3.9/site-packages
ln -s /usr/local/lib/python3.9/dist-packages/urllib3-1.26.7.dist-info /home/hes1/.local/pipx/venvs/weewx/lib/python3.9/site-packages
ln -s /usr/local/lib/python3.9/dist-packages/charset_normalizer /home/hes1/.local/pipx/venvs/weewx/lib/python3.9/site-packages
ln -s /usr/local/lib/python3.9/dist-packages/charset_normalizer-2.0.8.dist-info /home/hes1/.local/pipx/venvs/weewx/lib/python3.9/site-packages
ln -s /usr/local/lib/python3.9/dist-packages/certifi /home/hes1/.local/pipx/venvs/weewx/lib/python3.9/site-packages
ln -s /usr/local/lib/python3.9/dist-packages/certifi-2021.10.8.dist-info /home/hes1/.local/pipx/venvs/weewx/lib/python3.9/site-packages
ln -s /usr/local/lib/python3.9/dist-packages/idna /home/hes1/.local/pipx/venvs/weewx/lib/python3.9/site-packages
ln -s /usr/local/lib/python3.9/dist-packages/idna-3.3.dist-info /home/hes1/.local/pipx/venvs/weewx/lib/python3.9/site-packages
ln -s /usr/local/lib/python3.9/dist-packages/Cryptodome /home/hes1/.local/pipx/venvs/weewx/lib/python3.9/site-packages

danach läuft: hes1@ba001:/root$ weewxd

nur sudo ./.local/bin/weectl daemon install --type=systemd brachte diev. Fehler.

nach etwas Anpassung

Jan 11 11:18:19 ba001 systemd[1]: Starting LSB: weewx weather system...
Jan 11 11:18:20 ba001 weewx[10979] INFO weewxd: Initializing weewx version 5.0.0a10
Jan 11 11:18:20 ba001 weewx[10979] INFO weewxd: Using Python 3.9.2 (default, Feb 28 2021, 17:03:44) #012[GCC 10.2.1 20210110]
Jan 11 11:18:20 ba001 weewx[10979] INFO weewxd: Located at /home/hes1/.local/pipx/venvs/weewx/bin/python
Jan 11 11:18:20 ba001 weewx[10979] INFO weewxd: Platform Linux-5.15.80-sunxi-armv7l-with-glibc2.31
Jan 11 11:18:20 ba001 weewx[10979] INFO weewxd: Locale is 'LC_CTYPE=de_DE.UTF-8;LC_NUMERIC=de_DE.UTF-8;LC_TIME=de_DE.UTF-8;LC_COLLATE=de_DE.UTF-8;LC_MONETA
RY=de_DE.UTF-8;LC_MESSAGES=en_US.UTF-8;LC_PAPER=de_DE.UTF-8;LC_NAME=de_DE.UTF-8;LC_ADDRESS=de_DE.UTF-8;LC_TELEPHONE=de_DE.UTF-8;LC_MEASUREMENT=de_DE.UTF-8;
LC_IDENTIFICATION=de_DE.UTF-8'
Jan 11 11:18:20 ba001 weewx[10979] INFO weewxd: Using configuration file /home/hes1/weewx-data/weewx.conf
Jan 11 11:18:20 ba001 weewx[10979] INFO weewxd: Debug is 1
Jan 11 11:18:20 ba001 weewx[10979] INFO weewxd: PID file is /var/run/weewx.pid
Jan 11 11:18:20 ba001 weewx[10982] DEBUG weewxd: Initializing engine
Jan 11 11:18:20 ba001 weewx[10982] INFO weewx.engine: Loading station type WLL (user.wll)
Jan 11 11:18:20 ba001 weewx[10969]: Starting weewx weather system: weewx.
Jan 11 11:18:20 ba001 systemd[1]: Started LSB: weewx weather system.
Jan 11 11:18:21 ba001 weewx[10982] ERROR user.wll: The WeatherLink Live hostname or ip address is required.
Jan 11 11:18:21 ba001 weewx[10982] DEBUG weewx.engine: Loading service weewx.engine.StdTimeSynch
Jan 11 11:18:21 ba001 weewx[10982] DEBUG weewx.engine: Finished loading service weewx.engine.StdTimeSynch
Jan 11 11:18:21 ba001 weewx[10982] DEBUG weewx.engine: Loading service user.airDavis.AirDavis
Jan 11 11:18:21 ba001 weewx[10982] INFO user.airDavis: service version is 3.0.2
Jan 11 11:18:21 ba001 weewx[10982] DEBUG weewx.manager: Daily summary version is 4.0
Jan 11 11:18:21 ba001 weewx[10982] DEBUG user.airDavis: collect_data: fetching from url: http://192.168.38.12:80/v1/current_conditions, timeout: 10
Jan 11 11:18:21 ba001 weewx[10982] DEBUG weewx.engine: Finished loading service user.airDavis.AirDavis
Jan 11 11:18:21 ba001 weewx[10982] DEBUG weewx.engine: Loading service user.airDavisOut.AirDavis
Jan 11 11:18:21 ba001 weewx[10982] INFO user.airDavisOut: service version is 3.0.1
Jan 11 11:18:21 ba001 weewx[10982] DEBUG urllib3.connectionpool: Starting new HTTP connection (1): 192.168.38.12:80
Jan 11 11:18:21 ba001 weewx[10982] DEBUG weewx.manager: Daily summary version is 4.0
Jan 11 11:18:21 ba001 weewx[10982] DEBUG user.airDavisOut: collect_data: fetching from url: http://192.168.38.17:80/v1/current_conditions, timeout: 10
Jan 11 11:18:21 ba001 weewx[10982] DEBUG weewx.engine: Finished loading service user.airDavisOut.AirDavis
Jan 11 11:18:21 ba001 weewx[10982] DEBUG weewx.engine: Loading service user.davishealthapi.DavisHealthAPI
Jan 11 11:18:21 ba001 weewx[10982] DEBUG urllib3.connectionpool: Starting new HTTP connection (1): 192.168.38.17:80
Jan 11 11:18:21 ba001 weewx[10982] INFO user.davishealthapi: service version is 4.0.2
Jan 11 11:18:21 ba001 weewx[10982] INFO user.davishealthapi: archive interval is 1220

läuft bis zum Abbruch per STRG+C
Jetzt mit
hes1@ba001:/root$ sudo /etc/init.d/weewx restart

Jan 11 11:24:49 ba001 systemd[1]: Starting LSB: weewx weather system...
Jan 11 11:24:51 ba001 weewx[11365] INFO weewxd: Initializing weewx version 5.0.0a10
Jan 11 11:24:51 ba001 weewx[11365] INFO weewxd: Using Python 3.9.2 (default, Feb 28 2021, 17:03:44) #012[GCC 10.2.1 20210110]
Jan 11 11:24:51 ba001 weewx[11365] INFO weewxd: Located at /home/hes1/.local/pipx/venvs/weewx/bin/python
Jan 11 11:24:51 ba001 weewx[11365] INFO weewxd: Platform Linux-5.15.80-sunxi-armv7l-with-glibc2.31
Jan 11 11:24:51 ba001 weewx[11365] INFO weewxd: Locale is 'LC_CTYPE=de_DE.UTF-8;LC_NUMERIC=de_DE.UTF-8;LC_TIME=de_DE.UTF-8;LC_COLLATE=de_DE.UTF-8;LC_MONETA
RY=de_DE.UTF-8;LC_MESSAGES=en_US.UTF-8;LC_PAPER=de_DE.UTF-8;LC_NAME=de_DE.UTF-8;LC_ADDRESS=de_DE.UTF-8;LC_TELEPHONE=de_DE.UTF-8;LC_MEASUREMENT=de_DE.UTF-8;
LC_IDENTIFICATION=de_DE.UTF-8'
Jan 11 11:24:51 ba001 weewx[11365] INFO weewxd: Using configuration file /home/hes1/weewx-data/weewx.conf
Jan 11 11:24:51 ba001 weewx[11365] INFO weewxd: Debug is 0
Jan 11 11:24:51 ba001 weewx[11365] INFO weewxd: PID file is /var/run/weewx.pid
Jan 11 11:24:51 ba001 weewx[11368] INFO weewx.engine: Loading station type WLL (user.wll)
Jan 11 11:24:51 ba001 weewx[11355]: Starting weewx weather system: weewx.
Jan 11 11:24:51 ba001 systemd[1]: Started LSB: weewx weather system.
Jan 11 11:24:52 ba001 weewx[11368] ERROR user.wll: The WeatherLink Live hostname or ip address is required.
Jan 11 11:24:52 ba001 weewx[11368] INFO user.airDavis: service version is 3.0.2
Jan 11 11:24:52 ba001 weewx[11368] INFO user.airDavisOut: service version is 3.0.1
Jan 11 11:24:52 ba001 weewx[11368] INFO user.davishealthapi: service version is 4.0.2
Jan 11 11:24:52 ba001 weewx[11368] INFO user.davishealthapi: archive interval is 1220
Jan 11 11:24:52 ba001 weewx[11368] INFO user.airQ: AirQ-18 0.18 service
Jan 11 11:24:52 ba001 weewx[11368] INFO user.airQ: volume_mass_method 1
Jan 11 11:24:52 ba001 weewx[11368] INFO user.airQ: reading air-Q-18 'AirQ', host '192.168.38.18': starting
Jan 11 11:24:52 ba001 weewx[11368] INFO user.airQ_dbE: AirQ-19 0.19 service
Jan 11 11:24:52 ba001 weewx[11368] INFO user.airQ_dbE: volume_mass_method 1
Jan 11 11:24:52 ba001 weewx[11368] INFO user.airQ_dbE: reading airQ-19 'AirQ19', host '192.168.38.19': starting
Jan 11 11:24:52 ba001 weewx[11368] INFO weewx.engine: StdConvert target unit is 0x10
Jan 11 11:24:52 ba001 weewx[11368] INFO weewx.wxservices: StdWXCalculate will use data binding wx_binding
Jan 11 11:24:53 ba001 weewx[11368] INFO user.xgreenGTS: Version 0.8a3
Jan 11 11:24:53 ba001 weewx[11368] INFO user.xgreenGTS: Local mean time (LMT) UTC offset 0:45:21.937680
Jan 11 11:24:53 ba001 weewx[11368] INFO weewx.engine: Archive will use data binding wx_binding
Jan 11 11:24:53 ba001 weewx[11368] INFO weewx.engine: Record generation will be attempted in 'hardware'
Jan 11 11:24:53 ba001 weewx[11368] INFO weewx.engine: Using archive interval of 300 seconds (specified in weewx configuration)
Jan 11 11:24:53 ba001 weewx[11368] INFO weewx.engine: 'pyephem' detected, extended almanac data is available
Jan 11 11:24:53 ba001 weewx[11368] INFO weewxd: Starting up weewx version 5.0.0a10
Jan 11 11:24:53 ba001 weewx[11368] INFO weewx.engine: Using binding 'wx_binding' to database 'weewxBA001'
Jan 11 11:24:53 ba001 weewx[11368] INFO weewx.manager: Starting backfill of daily summaries
Jan 11 11:24:53 ba001 weewx[11368] INFO weewx.manager: Daily summaries up to date
Jan 11 11:24:53 ba001 weewx[11368] INFO weewx.engine: Starting main packet loop.
Jan 11 11:25:24 ba001 weewx[11368] INFO weewx.manager: Added record 2023-01-11 11:24:51 CET (1673432691) to database 'weewxAirDavis'
Jan 11 11:25:24 ba001 weewx[11368] INFO weewx.manager: Added record 2023-01-11 11:24:51 CET (1673432691) to daily summary in 'weewxAirDavis'
Jan 11 11:25:24 ba001 weewx[11368] INFO weewx.manager: Added record 2023-01-11 11:24:52 CET (1673432692) to database 'weewxAirDavisOut'
Jan 11 11:25:24 ba001 weewx[11368] INFO weewx.manager: Added record 2023-01-11 11:24:52 CET (1673432692) to daily summary in 'weewxAirDavisOut'
Jan 11 11:25:24 ba001 weewx[11368] INFO user.xgreenGTS: GTS initialized 2023-01-01 00:14:38
Jan 11 11:25:24 ba001 weewx[11368] INFO user.xgreenGTS: GTS 35.081304164769676, 10 loops
Jan 11 11:25:24 ba001 weewxd: AqiService: ValueError AQI calculation for pm10_0 on 1673432700 failed: Not enough observations wanted 216, but got 29
Jan 11 11:25:24 ba001 weewxd: AqiService: ValueError AQI calculation for pm2_5 on 1673432700 failed: Not enough observations wanted 216, but got 29
Jan 11 11:25:24 ba001 weewxd: AqiService: not storing record for dateTime 1673432700
Jan 11 11:25:25 ba001 weewx[11368] INFO weewx.manager: Added record 2023-01-11 11:25:00 CET (1673432700) to database 'weewxBA001'
Jan 11 11:25:26 ba001 weewx[11368] INFO weewx.manager: Added record 2023-01-11 11:25:00 CET (1673432700) to daily summary in 'weewxBA001'
Jan 11 11:25:44 ba001 weewx[11368] INFO weewx.cheetahgenerator: Generated 8 files for report SeasonsReport in 17.88 seconds
Jan 11 11:25:49 ba001 weewx[11368] INFO weewx.imagegenerator: Generated 18 images for report SeasonsReport in 4.34 seconds
Jan 11 11:25:49 ba001 weewx[11368] INFO weewx.reportengine: Copied 5 files to /home/hes1/weewx-data/public_html
Jan 11 11:25:49 ba001 weewx[11368] INFO weewx.cheetahgenerator: Generated 1 files for report AirLinkReport in 0.35 seconds
Jan 11 11:25:49 ba001 weewx[11368] INFO weewx.imagegenerator: Generated 1 images for report AirLinkReport in 0.19 seconds
Jan 11 11:26:03 ba001 weewx[11368] INFO weewx.cheetahgenerator: Generated 2 files for report AirQReport in 13.84 seconds
Jan 11 11:26:03 ba001 weewx[11368] INFO weewx.imagegenerator: Generated 0 images for report AirQReport in 0.09 seconds
Jan 11 11:26:03 ba001 weewx[11368] INFO weewx.reportengine: Copied 0 files to /home/hes1/weewx-data/public_html
Jan 11 11:26:05 ba001 weewx[11368] INFO weewx.cheetahgenerator: Generated 1 files for report DavisReport in 1.22 seconds
Jan 11 11:26:05 ba001 weewx[11368] INFO weewx.imagegenerator: Generated 2 images for report DavisReport in 0.40 seconds
Jan 11 11:26:05 ba001 weewx[11368] INFO weewx.reportengine: Copied 0 files to /home/hes1/weewx-data/public_html/davis

Den Vorschlag werde testen
Hartmut

Tom Keffer

unread,
Jan 11, 2023, 9:35:26 AM1/11/23
to Hartmut Schweidler, weewx-development
Well, I guess using symbolic links works, but I don't think the average user is going to want to do that.

In any case, glad to see that it is working for you.

-tk

Tom Keffer

unread,
Jan 15, 2023, 6:43:37 PM1/15/23
to Hartmut Schweidler, weewx-development
Hartmut (and others)

See the updated pip install instructions. It now recommends pip --user (instead of pipx).

Give V5.0.0a11 a try. It was built around this assumption.

python3 -m pip install weewx --user
weectl station create


Vince Skahan

unread,
Jan 15, 2023, 11:11:34 PM1/15/23
to weewx-development
 WARNING: The scripts weectl and weewxd are installed in '/home/vagrant/.local/bin' which is not on PATH.
  Consider adding this directory to PATH or, if you prefer to suppress this warning, use --no-warn-script-location.

I worked around it with a quickie script for ubuntu 2204...

cd
sudo apt-get install -y python3-pip

python3 -m pip install weewx --user
export PATH=~/.local/bin:$PATH
weectl station create --driver weewx.drivers.simulator --no-prompt
weewxd

Hartmut Schweidler

unread,
Jan 16, 2023, 4:27:00 AM1/16/23
to weewx-development
Nach:
hes1@ba001:~$ python3 -m pip install --user weewx.zip
Processing ./weewx.zip
  Installing build dependencies ... done
  Getting requirements to build wheel ... done
  Preparing metadata (pyproject.toml) ... done
Requirement already satisfied: configobj>=4.7 in /usr/lib/python3/dist-packages (from weewx==5.0.0a11) (5.0.6)
Requirement already satisfied: Pillow<10.0,>=9.3 in /usr/local/lib/python3.9/dist-packages (from weewx==5.0.0a11) (9.4.0)
Requirement already satisfied: pyephem<4.0,>=3.7 in /usr/local/lib/python3.9/dist-packages (from weewx==5.0.0a11) (3.7.7.0)
Requirement already satisfied: pyusb<2.0.0,>=1.0.2 in /usr/lib/python3/dist-packages (from weewx==5.0.0a11) (1.0.2)
Requirement already satisfied: PyMySQL<2.0,>=1.0 in /usr/local/lib/python3.9/dist-packages (from weewx==5.0.0a11) (1.0.2)
Requirement already satisfied: CT3<4.0,>=3.1 in /usr/local/lib/python3.9/dist-packages (from weewx==5.0.0a11) (3.3.1)
Requirement already satisfied: pyserial<4.0,>=3.4 in /usr/lib/python3/dist-packages (from weewx==5.0.0a11) (3.5b0)
Requirement already satisfied: six<2,>=1 in /usr/lib/python3/dist-packages (from weewx==5.0.0a11) (1.16.0)
Requirement already satisfied: ephem==3.7.7.0 in /usr/local/lib/python3.9/dist-packages (from pyephem<4.0,>=3.7->weewx==5.0.0a11) (3.7.7.0)
Building wheels for collected packages: weewx
  Building wheel for weewx (pyproject.toml) ... done
  Created wheel for weewx: filename=weewx-5.0.0a11-py3-none-any.whl size=1202865 sha256=b8a1f2efc03d583caf61b9dad3232f0a56e345a81f12b7080cea68d0c5c9b4d7
  Stored in directory: /tmp/pip-ephem-wheel-cache-sheuu57b/wheels/73/05/72/94f1f0ea1969fcbed9fa217709c68a80e6d7746e139eb17f89
Successfully built weewx
Installing collected packages: weewx
Successfully installed weewx-5.0.0a11
hes1@ba001:~$ weectl station create
The configuration file will be created at /home/hes1/weewx-data/weewx.conf.

Give a description of your station. This will be used for the title of any reports.
Description [WeeWX station]: klein

Specify altitude, with units 'foot' or 'meter'.  For example:
35, foot
12, meter
altitude [700, foot]: 54, meter

Specify latitude in decimal degrees, negative for south.
latitude [0.0]: 53.6
Specify longitude in decimal degrees, negative for west.
longitude [0.0]: 11.3

You can register your station on weewx.com, where it will be included
in a map. If you choose to do so, you will also need a unique URL to identify
your station (such as a website, or a WeatherUnderground link).
Include station in the station registry [n]? n

Choose a unit system for your reports. Possible choices are:
  'us' (ºF, inHg, in, mph)
  'metricwx' (ºC, mbar, mm, m/s)
  'metric' (ºC, mbar, cm, km/h)
Later, you can modify your choice, or choose a combination of units.
Your choice [us]: metric

Installed drivers include:
  0) AcuRite         (weewx.drivers.acurite)  
  1) CC3000          (weewx.drivers.cc3000)    
  2) FineOffsetUSB   (weewx.drivers.fousb)    
  3) Simulator       (weewx.drivers.simulator)
  4) TE923           (weewx.drivers.te923)    
  5) Ultimeter       (weewx.drivers.ultimeter)
  6) Vantage         (weewx.drivers.vantage)  
  7) WMR100          (weewx.drivers.wmr100)    
  8) WMR300          (weewx.drivers.wmr300)    
  9) WMR9x8          (weewx.drivers.wmr9x8)    
 10) WS1             (weewx.drivers.ws1)      
 11) WS23xx          (weewx.drivers.ws23xx)    
 12) WS28xx          (weewx.drivers.ws28xx)    
choose a driver [3]: 3

Traceback (most recent call last):
  File "/home/hes1/.local/bin/weectl", line 8, in <module>
    sys.exit(main())
  File "/home/hes1/.local/lib/python3.9/site-packages/weectl.py", line 52, in main
    namespace.func(namespace)
  File "/home/hes1/.local/lib/python3.9/site-packages/weectllib/parse_station.py", line 117, in create_station
    weecfg.station_config.station_create(config_path=namespace.config,
  File "/home/hes1/.local/lib/python3.9/site-packages/weecfg/station_config.py", line 65, in station_create
    copy_docs(dist_config_dict, docs_root=docs_root)
  File "/home/hes1/.local/lib/python3.9/site-packages/weecfg/station_config.py", line 483, in copy_docs
    shutil.copytree(docs_resources, docs_dir)
  File "/usr/lib/python3.9/shutil.py", line 555, in copytree
    with os.scandir(src) as itr:
FileNotFoundError: [Errno 2] No such file or directory: '/home/hes1/.local/lib/python3.9/site-packages/wee_resources/docs'

hes1@ba001:~$ weewxd
Error parsing config file: Unable to find file 'weewx.conf'. Tried directories ['/home/hes1/weewx-data', '/etc/weewx', '/home/weewx']
    ****  Traceback (most recent call last):

    ****    File "/home/hes1/.local/lib/python3.9/site-packages/weewxd.py", line 83, in main

    ****      config_path, config_dict = weecfg.read_config(options.config_path, list(args))

    ****    File "/home/hes1/.local/lib/python3.9/site-packages/weecfg/__init__.py", line 147, in read_config

    ****      config_path = find_file(config_path, args,

    ****    File "/home/hes1/.local/lib/python3.9/site-packages/weecfg/__init__.py", line 115, in find_file

    ****      raise IOError("Unable to find file '%s'. Tried directories %s"

    ****  OSError: Unable to find file 'weewx.conf'. Tried directories ['/home/hes1/weewx-data', '/etc/weewx', '/home/weewx']

Gruss
Hartmut

Hartmut Schweidler

unread,
Jan 16, 2023, 4:41:21 AM1/16/23
to weewx-development
Nachtrag:
ich habe einfach das Verzeichnis "/docs" aus der zip.Datei nach '/home/hes1/.local/lib/python3.9/site-packages/wee_resources/docs'  kopiert
und anschließend das alte "user-Verzeichnis" und das alte "skins-Verzeichnis " nach '/home/hes1/.local/lib/python3.9/site-packages/' bzw. '/home/hes1/weewx-data/skins' kopiert.

dann noch
root@ba001:~# systemctl stop weewx
root@ba001:~# systemctl start weewx && tail -f /var/log/syslog
Jan 16 10:25:03 ba001 weewx[3278] INFO weewxd: Using configuration file /home/hes1/weewx-data/weewx.conf
Jan 16 10:25:03 ba001 weewx[3278] INFO weewxd: Debug is 0
Jan 16 10:25:03 ba001 weewx[3278] INFO weewx.engine: Loading station type WLL (user.wll)
Jan 16 10:25:04 ba001 weewx[3278] INFO weewxd: Received signal TERM (15).
Jan 16 10:25:04 ba001 weewx[3278] INFO weewxd: Terminating weewx version 5.0.0a11
Jan 16 10:25:04 ba001 systemd[1]: Stopping WeeWX weather system...
Jan 16 10:25:04 ba001 systemd[1]: weewx.service: Succeeded.
Jan 16 10:25:04 ba001 systemd[1]: Stopped WeeWX weather system.
Jan 16 10:25:04 ba001 systemd[1]: weewx.service: Consumed 2.031s CPU time.
Jan 16 10:25:07 ba001 systemd[1]: Started WeeWX weather system.
Jan 16 10:25:08 ba001 weewx[3286] INFO weewxd: Initializing weewx version 5.0.0a11
Jan 16 10:25:08 ba001 weewx[3286] INFO weewxd: Using Python 3.9.2 (default, Feb 28 2021, 17:03:44) #012[GCC 10.2.1 20210110]
Jan 16 10:25:08 ba001 weewx[3286] INFO weewxd: Located at /usr/bin/python3
Jan 16 10:25:08 ba001 weewx[3286] INFO weewxd: Platform Linux-5.15.80-sunxi-armv7l-with-glibc2.31
Jan 16 10:25:08 ba001 weewx[3286] INFO weewxd: Locale is 'LC_CTYPE=de_DE.UTF-8;LC_NUMERIC=de_DE.UTF-8;LC_TIME=de_DE.UTF-8;LC_COLLATE=de_DE.UTF-8;LC_MONETARY=de_DE.UTF-8;LC_MESSAGES=en_US.UTF-8;LC_PAPER=de_DE.UTF-8;LC_NAME=de_DE.UTF-8;LC_ADDRESS=de_DE.UTF-8;LC_TELEPHONE=de_DE.UTF-8;LC_MEASUREMENT=de_DE.UTF-8;LC_IDENTIFICATION=de_DE.UTF-8'
Jan 16 10:25:08 ba001 weewx[3286] INFO weewxd: Using configuration file /home/hes1/weewx-data/weewx.conf
Jan 16 10:25:08 ba001 weewx[3286] INFO weewxd: Debug is 0
Jan 16 10:25:08 ba001 weewx[3286] INFO weewx.engine: Loading station type WLL (user.wll)
Jan 16 10:25:09 ba001 weewx[3286] ERROR user.wll: The WeatherLink Live hostname or ip address is required.
Jan 16 10:25:09 ba001 weewx[3286] INFO user.airDavis: service version is 3.0.2

und es läuft.

Hartmut

Tom Keffer

unread,
Jan 16, 2023, 6:39:47 AM1/16/23
to Vince Skahan, weewx-development
On Sun, Jan 15, 2023 at 8:11 PM Vince Skahan <vince...@gmail.com> wrote:
 WARNING: The scripts weectl and weewxd are installed in '/home/vagrant/.local/bin' which is not on PATH.
  Consider adding this directory to PATH or, if you prefer to suppress this warning, use --no-warn-script-location.

I worked around it with a quickie script for ubuntu 2204...

The reason you're getting a warning is that most .profiles look like this:

if [ -d "$HOME/.local/bin" ] ; then
    PATH="$HOME/.local/bin:$PATH"
fi
With a virgin system there is no ~/.local/bin, so it's not put in your PATH. After installing WeeWX there is. 

We could tell people to "source .profile" if they get the error, but there are so many different combinations of .profile, .bashrc, .zsh, etc, that I'm reluctant to do that. I'll just include a warning in the pip install instructions.


Tom Keffer

unread,
Jan 16, 2023, 7:12:48 AM1/16/23
to Hartmut Schweidler, weewx-development
Hartmut,

Where did you get weewx.zip? 

When pip is used to install weewx it should not be referring to pyproject.toml, nor building wheels. That is part of the development build process.



Vince Skahan

unread,
Jan 16, 2023, 1:27:43 PM1/16/23
to weewx-development
FIWW, I'd just do it my way and explain why.  Then it won't matter what their startup files do.

This one is a bit unusual because weectl calls weewxd under the hood, so not having your PATH set up before you call weectl means no go.

We've trained users for a decade to 'when in doubt use an absolute pathname' which has always worked before.  Not any more it seems...

Using an absolute pathname:

~/.local/bin/weectl station create --driver weewx.drivers.simulator --no-prompt
The configuration file will be created at /home/vagrant/weewx-data/weewx.conf.

Traceback (most recent call last):
  File "/home/vagrant/.local/bin/weectl", line 8, in <module>
    sys.exit(main())
  File "/home/vagrant/.local/lib/python3.10/site-packages/weectl.py", line 52, in main
    namespace.func(namespace)
  File "/home/vagrant/.local/lib/python3.10/site-packages/weectllib/parse_station.py", line 117, in create_station
    weecfg.station_config.station_create(config_path=namespace.config,
  File "/home/vagrant/.local/lib/python3.10/site-packages/weecfg/station_config.py", line 64, in station_create
    config_config(config_path, dist_config_dict, weewx_root=weewx_root, *args, **kwargs)
  File "/home/vagrant/.local/lib/python3.10/site-packages/weecfg/station_config.py", line 104, in config_config
    copy_util(config_path, config_dict)
  File "/home/vagrant/.local/lib/python3.10/site-packages/weecfg/station_config.py", line 522, in copy_util
    raise FileNotFoundError("Cannot find weewxd")
FileNotFoundError: Cannot find weewxd

FWIW, a very ugly way 'does' work:

$ PATH=~/.local/bin:$PATH weectl station create --driver weewx.drivers.simulator --no-prompt
The configuration file will be created at /home/vagrant/weewx-data/weewx.conf.

Suggestion - if you can alter weectl to realize weewxd is in the same directory it's in, perhaps the good 'ol "use an absolute pathname" method will still work and we won't have to do special training on this one.  As-is it's going to cause a lot of the 'command not found - what do I do' things we get flooded with on the -user group.

Tom Keffer

unread,
Jan 16, 2023, 2:08:50 PM1/16/23
to Vince Skahan, weewx-development
Just want to make sure I understand the sequence you used. 
  • Fresh copy of Debian with no ~/.local/bin.
  • Installed WeeWX using pip.
  • Got the warning about ~/.local/bin not in your path.
  • So, invoked weectl using an absolute path.
Is that about right?

Yes, we could search the same directory as weectl.

--
You received this message because you are subscribed to the Google Groups "weewx-development" group.
To unsubscribe from this group and stop receiving emails from it, send an email to weewx-developm...@googlegroups.com.

Vince Skahan

unread,
Jan 16, 2023, 2:25:05 PM1/16/23
to weewx-development
Yes. That's it.

### uncomment to clean up previous runs
# rm -rf ~/.local
# rm -rf ~/.cache
cd
python3 -m pip install weewx --user
~/.local/bin/weectl station create --driver weewx.drivers.simulator --no-prompt

Tom Keffer

unread,
Jan 16, 2023, 2:44:22 PM1/16/23
to Vince Skahan, weewx-development
Turns out, it's not so easy to find weectl either. The actual executable is generated by pip, so I can't add something to it to record its location. 

I've settled for pressing on, but printing a diagnostic:

The configuration file will be created at /Users/tkeffer/weewx-data/weewx.conf.

Processing configuration file /Users/tkeffer/weewx-data/weewx.conf.

Making directory /Users/tkeffer/weewx-data/skins.

Copying new skin Smartphone into /Users/tkeffer/weewx-data/skins/Smartphone.

Copying new skin Rsync into /Users/tkeffer/weewx-data/skins/Rsync.

Copying new skin Standard into /Users/tkeffer/weewx-data/skins/Standard.

Copying new skin Ftp into /Users/tkeffer/weewx-data/skins/Ftp.

Copying new skin Mobile into /Users/tkeffer/weewx-data/skins/Mobile.

Copying new skin Seasons into /Users/tkeffer/weewx-data/skins/Seasons.

Unable to find the WeeWX executable 'weewxd'.

No daemon utility files will be created.

Make sure the pip user directory (typically ~/.local/bin) is in your PATH, then retry.

Removing /Users/tkeffer/weewx-data/docs.

Copying new docs into /Users/tkeffer/weewx-data/docs.

Removing directory /Users/tkeffer/weewx-data/examples.

Copying new examples into /Users/tkeffer/weewx-data/examples.

Creating a new 'user' directory at /Users/tkeffer/weewx-data/bin/user.

Save the configuration file to /Users/tkeffer/weewx-data/weewx.conf.





Vince Skahan

unread,
Jan 16, 2023, 3:17:33 PM1/16/23
to weewx-development
Quick grep for weewxd in the v5 branch says that station_config.py will fail if $PATH isn't complete, but it looks at first glance like daemom_install in daemon_config.py has a nicer failsafe way to search for weewxd.   Maybe it's just a cut+paste thing to try (?)

Tom Keffer

unread,
Jan 16, 2023, 4:35:18 PM1/16/23
to Vince Skahan, weewx-development
I abandoned that approach because it's possible that the user is installing into a virtual environment. Searching ~/.local/bin could find a weewxd that is not at all related to the implementation at hand.

On Mon, Jan 16, 2023 at 12:17 PM Vince Skahan <vince...@gmail.com> wrote:
Quick grep for weewxd in the v5 branch says that station_config.py will fail if $PATH isn't complete, but it looks at first glance like daemom_install in daemon_config.py has a nicer failsafe way to search for weewxd.   Maybe it's just a cut+paste thing to try (?)

--
You received this message because you are subscribed to the Google Groups "weewx-development" group.
To unsubscribe from this group and stop receiving emails from it, send an email to weewx-developm...@googlegroups.com.

Vince Skahan

unread,
Jan 16, 2023, 5:36:49 PM1/16/23
to weewx-development
I'm suggesting adding one more lowest-precedence check before giving up, just like you do in the other utility.

Not seeing a downside here.  This closes one chance for failure to install.
  • If you are installing and 'not' in a venv, it would try ~/.local/bin as a last-gasp try to find it in the place pip put it.   That fixes the clean installation problem.
  • If you 'are' in an activated venv, it will find the right weewxd since the venv's bin/ tree is first in an activated venv's $PATH, so no later belts+suspenders checks are never called.  You could put lowest precedence 20 'try here, no here' checks in there safely.  (tested on ubuntu2204)
But I'd suggest there some should be consistency in daemon_config.py (which has the last-gasp test) and station_config.py (which does not).  Personally I'd cut+paste from one to the other and have the last-gasp check in both.

matthew wall

unread,
Jan 16, 2023, 7:04:06 PM1/16/23
to weewx-development
um, why is "create a station" even looking for the location of weewxd?

at 'station create' time, why not just copy all of the parameterized utils into the utils directory, without replacing any parameters?

(by 'parameters' i mean the WEEWX_ROOT, WEEWX_BINDIR, WEEWX_CFGDIR and others like them.  btw we need to canonicalize that list...)

when someone actually installs something from utils, only *then* do you replace the parameters.  that is done either manually, or with weectl.  at that time you know *exactly* where everything is located, because if you are doing it with weectl, you know where weectl, is thus you know where weewxd is.  and if you are doing it manually, then you know what you are doing.

the package installers are gonna want untouched, still-with-parameters-not-replaced-in-them files in the util directory.  otherwise they will have to dig through the python tree to find them in their virgin form.

or maybe i am misunderstanding this thread?

m

matthew wall

unread,
Jan 16, 2023, 7:08:37 PM1/16/23
to weewx-development
On Monday, January 16, 2023 at 5:36:49 PM UTC-5 vince...@gmail.com wrote:
I'm suggesting adding one more lowest-precedence check before giving up, just like you do in the other utility.

imho, all of this path guessing is a recipe for confusion, and not very future-proof 

even having a list ['/etc/weewx/weewx.conf', '/home/weewx/weewx.conf'] for guessing where the config is located is dangerous.  is it not better to just fail hard with a good explanation of why the fail, instead of guessing (and thus misleading?)

matthew wall

unread,
Jan 16, 2023, 7:21:30 PM1/16/23
to weewx-development
ok, so i figured out why this path stuff is chaffing me.  it is analogous to the 'what do we put in the shebang?' question for python.

for the weewx source code, we want '#!/usr/bin/env python'

when you use python to install weewx, those get replaced with the full path to whatever python was actually used to install the weewx code.

so if you run weewx from a clone of the git repo, you can easily change which python you use by changing how '/usr/bin/env python' resolves.  this is really handy for switching pythons during testing, btw.  or for running multiple weewx instances from a single tree using different pythons.  (yes, these are corner cases, but very useful ones!)

the package installers retain the '/usr/bin/env python' so that the /etc/default/weewx file can dictate which python will be used.  that also lets you easily switch between the system's python or some locally installed python (from anaconda or brew or build-it-yourself).

anyway, as soon as you replace the shebang, you make the installation very brittle.  in many cases that is ok, but in many cases it is not.

i think there is a similar pattern in the use of the weewx parameters for where things are located.  as soon as you replace them, you have a very brittle installation.  that makes upgrades more difficult, and makes more complication for maintaining backward compatibility.

defer replacement as long as possible.

m

Tom Keffer

unread,
Jan 16, 2023, 8:34:39 PM1/16/23
to Vince Skahan, weewx-development
I deleted daemon_config.py in 5.0.0a11, so it is consistent. :-)

I couldn't get sudo weectl daemon install to work because sudo causes the path to change. So, the user would have to give an explicit path to weectl. Too complicated.



Tom Keffer

unread,
Jan 16, 2023, 8:50:35 PM1/16/23
to matthew wall, weewx-development
On Mon, Jan 16, 2023 at 4:04 PM matthew wall <mwall...@gmail.com> wrote:
um, why is "create a station" even looking for the location of weewxd?

So it knows what to fill in for the daemon configuration files. It needs a value for things like ExecStart.

at 'station create' time, why not just copy all of the parameterized utils into the utils directory, without replacing any parameters?
(by 'parameters' i mean the WEEWX_ROOT, WEEWX_BINDIR, WEEWX_CFGDIR and others like them.  btw we need to canonicalize that list...)

weectl station create does exactly this, although in a backwards compatible way.
 
when someone actually installs something from utils, only *then* do you replace the parameters.  that is done either manually, or with weectl.  at that time you know *exactly* where everything is located, because if you are doing it with weectl, you know where weectl, is thus you know where weewxd is.  and if you are doing it manually, then you know what you are doing.

Can't do this because it requires 'sudo', which changes the path. In other words, you can't do

sudo weectl daemon install

because it can't find weectl. Instead, you're asking the user to do

sudo /home/username/.local/bin/weectl daemon install

Even then, you have problems because weectl can't find weewxd. Remember, we don't have access to weectl or weewxd: they're both provided by pip, not me. The application weectl has no idea where weewxd is located except by searching PATH, which is truncated when you do sudo. So, it can't find it.

To find weewxd, you must do it with an app that is not running sudo. That's "weectl station create".
 
the package installers are gonna want untouched, still-with-parameters-not-replaced-in-them files in the util directory.  otherwise they will have to dig through the python tree to find them in their virgin form.

That's exactly what they get. The virgin weewx.conf is almost exactly the same as in v4.9. That's how we provide backwards compatibility for setup.py users. The only difference is that SQLITE_ROOT is now relative to WEEWX_ROOT, instead of an absolute path. 

or maybe i am misunderstanding this thread?

Believe me, I have explored every possibility. It's possible I've missed something, but there's been a dead end in every approach I've tried.

Give it a try:

pip install weewx --user
weectl station create
sudo cp ~/weewx-data/systemd/weewx.service /etc/systemd/system

That's it to get a daemon going.

-tk

Vince Skahan

unread,
Jan 16, 2023, 9:43:43 PM1/16/23
to weewx-development
On Monday, January 16, 2023 at 5:50:35 PM UTC-8 Tom Keffer wrote:
Give it a try:
pip install weewx --user
weectl station create
sudo cp ~/weewx-data/systemd/weewx.service /etc/systemd/system

That's it to get a daemon going.


You have a typo on the path to the service file there.

For a non-venv setup, the $PATH issue is still there unless you've fixed it in git and not in the pip stuff yet.  This sequence works for me end-to-end and weewx is running after this runs...

python3 -m pip install weewx --user
export PATH=~/.local/bin:$PATH

weectl station create --driver weewx.drivers.simulator --no-prompt
sudo cp ~/weewx-data/util/systemd/weewx.service /etc/systemd/system
sudo systemctl enable weewx
sudo systemctl start weewx
 
I did also test a venv-based script that worked ok, if it matters.  This requires python3-venv to be there as a prerequisite.

python3 -m venv ~/weewx_venv
cd ~/weewx_venv
source bin/activate

python3 -m pip install weewx
weectl station create --driver weewx.drivers.simulator --no-prompt
sudo cp ~/weewx-data/util/systemd/weewx.service /etc/systemd/system
sudo systemctl enable weewx
sudo systemctl start weewx


FWIW, the service files generated 'do' run as a non-privileged user, which is pretty nice.

matthew wall

unread,
Jan 16, 2023, 9:44:15 PM1/16/23
to weewx-development
On Monday, January 16, 2023 at 8:50:35 PM UTC-5 Tom Keffer wrote:
at 'station create' time, why not just copy all of the parameterized utils into the utils directory, without replacing any parameters?
(by 'parameters' i mean the WEEWX_ROOT, WEEWX_BINDIR, WEEWX_CFGDIR and others like them.  btw we need to canonicalize that list...)

weectl station create does exactly this, although in a backwards compatible way.

we might have a different interpretation of 'backward compatible'.  when i say 'backward compatible', this means that i can take any old weewx config file, and it will work, unmodified, with the latest backward-compatible release.  there should be no need to modify the config - if there is, then that weewx release is not backward compatible.

i realize that the convention for weewx has been to modify a user's config file during an upgrade.  to me, this is not "backward compatible", this is an upgrade of the config file.

just to clarify: at some point we explicitly separated the config-file-upgrade code so that dpkg/rpm could invoke that independently of upgrading the weewx code.  now this will be available as 'weectl station upgrade' - upgrade the indicated weewx config file - with a separate option for explicitly upgrading the skins.

 
Give it a try:

pip install weewx --user
weectl station create
sudo cp ~/weewx-data/systemd/weewx.service /etc/systemd/system

That's it to get a daemon going.

fwiw, this is what i get on an ancient macos (intel) using anaconda3 (python 3.8):

% which pip
/Volumes/Software/sw/anaconda3/bin/pip
% pip install weewx --user
Requirement already satisfied: weewx in ./.local/lib/python3.8/site-packages (5.0.0a4)
Requirement already satisfied: PyMySQL<2.0,>=1.0 in ./.local/lib/python3.8/site-packages (from weewx) (1.0.2)
Requirement already satisfied: configobj>=4.7 in /Volumes/Software/sw/anaconda3/lib/python3.8/site-packages (from weewx) (5.0.6)
Requirement already satisfied: six<2,>=1 in /Volumes/Software/sw/anaconda3/lib/python3.8/site-packages (from weewx) (1.15.0)
Requirement already satisfied: Pillow<10.0,>=9.3 in ./.local/lib/python3.8/site-packages (from weewx) (9.3.0)
Requirement already satisfied: pyusb<2.0.0,>=1.0.2 in ./.local/lib/python3.8/site-packages (from weewx) (1.2.1)
Requirement already satisfied: pyephem<4.0,>=3.7 in ./.local/lib/python3.8/site-packages (from weewx) (3.7.7.0)
Requirement already satisfied: CT3<4.0,>=3.1 in ./.local/lib/python3.8/site-packages (from weewx) (3.3.1)
Requirement already satisfied: pyserial<4.0,>=3.4 in ./.local/lib/python3.8/site-packages (from weewx) (3.5)
Requirement already satisfied: ephem==3.7.7.0 in ./.local/lib/python3.8/site-packages (from pyephem<4.0,>=3.7->weewx) (3.7.7.0)

% export PATH=/Users/mwall/.local/bin:$PATH
% weectl --version
weectl v5.0.0a4
% weectl station create
The configuration file will be created at /Users/Shared/weewx/weewx.conf.


Give a description of your station. This will be used for the title of any reports.
Description [WeeWX station]:

Specify altitude, with units 'foot' or 'meter'. For example:
35, foot
12, meter
altitude [700, foot]:

Specify latitude in decimal degrees, negative for south.
latitude [0.0]:
Specify longitude in decimal degrees, negative for west.
longitude [0.0]:

You can register your station on weewx.com, where it will be included
in a map. If you choose to do so, you will also need a unique URL to identify
your station (such as a website, or a WeatherUnderground link).
Include station in the station registry [n]?

Choose a unit system for your reports. Possible choices are:
'us' (ºF, inHg, in, mph)
'metricwx' (ºC, mbar, mm, m/s)
'metric' (ºC, mbar, cm, km/h)
Later, you can modify your choice, or choose a combination of units.
Your choice [us]:

Installed drivers include:
0) AcuRite (weewx.drivers.acurite)
1) CC3000 (weewx.drivers.cc3000)
2) FineOffsetUSB (weewx.drivers.fousb)
3) Simulator (weewx.drivers.simulator)
4) TE923 (weewx.drivers.te923)
5) Ultimeter (weewx.drivers.ultimeter)
6) Vantage (weewx.drivers.vantage)
7) WMR100 (weewx.drivers.wmr100)
8) WMR300 (weewx.drivers.wmr300)
9) WMR9x8 (weewx.drivers.wmr9x8)
10) WS1 (weewx.drivers.ws1)
11) WS23xx (weewx.drivers.ws23xx)
12) WS28xx (weewx.drivers.ws28xx)
choose a driver [3]:

i expected it would have defaulted to $HOME/weewx-data, not /Users/Shared/weewx. it succeeded only because i had /Users/Shared/weewx and had permissions on that dir leftover from macos testing.

apparently 'weectl station create' does not install the utils:


% ls -la /Users/Shared/weewx
total 40
drwxr-xr-x 4 mwall wheel 128 Jan 16 21:02 .
drwxrwxrwt 8 root wheel 256 Jan 16 21:02 ..
drwxr-xr-x 8 mwall wheel 256 Jan 16 21:02 skins
-rw-r--r-- 1 mwall wheel 19533 Jan 16 21:02 weewx.conf

what should we expect to see in `weewx-data` (i.e., in a virgin WEEWX_ROOT after 'station create')?

weewx-data/
weewx-data/weewx.conf  - config file constructed from response to prompts
weewx-data/skins/ - all of the skins that ship with weewx
weewx-data/bin/user/ - the 'user' directory where extensions put python code
weewx-data/util - directories with virgin rc, unit, udev, logrotate, logwatch, syslog examples

regarding the directory specifications in the weewx config file:
1) is SQLITE_ROOT relative to WEEWX_ROOT *only* if it is a relative path? (where relative path is something that starts with anything other than /)  so i assume that "SQLITE_ROOT = %(WEEWX_ROOT)s/archive" will become simply "SQLITE_ROOT = archive".  however, if weewx is going to be backward compatible, then it will still have to do expansion of WEEWX_ROOT when it finds %(WEEWX_ROOT)s...
2) are SKIN_ROOT and HTML_ROOT also relative to WEEWX_ROOT? (but only if they are a relative path)
3) where do the local, html-ified weewx docs live on a pip install?

> Believe me, I have explored every possibility. It's possible I've missed something, but there's been a 
> dead end in every approach I've tried.

i feel your pain!  the first release is easy.  by the 5th release you want to start over, punt backward-compatibility, or give up ;)

i can start running v5 through the dpkg and rpm packaging the first week of february.  can't wait to try the new virtualbox on apple's m1 hardware...

m

Vince Skahan

unread,
Jan 17, 2023, 2:52:32 AM1/17/23
to weewx-development
Matthew - I ran the venv installation steps on my M1 mini and it put the software under the venv tree and made a $HOME/weewx-data tree as expected for the skins, archive, and (later) public_html tree .  weewxd does start up ok and populates public_html a few minutes later.  So it looks as expected here on a clean M1 mini FWIW.    (I did not install the system startup file to try that).    Cleanup was a simple as deleting the $HOME/weewx-dat and the venv parent directory.

Tom - how do I run the v5 equivalent of wee_reports ?  Or is that on the to-do list ?

Tom Keffer

unread,
Jan 17, 2023, 7:52:42 AM1/17/23
to matthew wall, weewx-development
On Mon, Jan 16, 2023 at 6:44 PM matthew wall <mwall...@gmail.com> wrote:


On Monday, January 16, 2023 at 8:50:35 PM UTC-5 Tom Keffer wrote:
at 'station create' time, why not just copy all of the parameterized utils into the utils directory, without replacing any parameters?
(by 'parameters' i mean the WEEWX_ROOT, WEEWX_BINDIR, WEEWX_CFGDIR and others like them.  btw we need to canonicalize that list...)

weectl station create does exactly this, although in a backwards compatible way.

we might have a different interpretation of 'backward compatible'.  when i say 'backward compatible', this means that i can take any old weewx config file, and it will work, unmodified, with the latest backward-compatible release.  there should be no need to modify the config - if there is, then that weewx release is not backward compatible.

What I meant by the "in a backwards compatible way" comment is that it doesn't actually use your symbols. It uses the old symbols.

Here's the diff between the V4.9.1 weewx.conf and the V5 version:


tkeffer@gray-owl-air weewx-4.9.1 % diff weewx.conf  -c ~/git/weewx/bin/wee_resources

*** weewx.conf Tue Oct 25 04:28:25 2022

--- /Users/tkeffer/git/weewx/bin/wee_resources/weewx.conf Sun Jan 15 15:07:38 2023

***************

*** 13,18 ****

--- 13,21 ----

  # Root directory of the weewx data file hierarchy for this station

  WEEWX_ROOT = /home/weewx

  

+ # Where the 'user' directory is located, relative to WEEWX_ROOT:

+ USER_ROOT = bin/user

+ 

  # Whether to log successful operations. May get overridden below.

  log_success = True

  

***************

*** 20,26 ****

  log_failure = True

  

  # Do not modify this. It is used when installing and updating weewx.

! version = 4.9.1

  

  ##############################################################################

  

--- 23,29 ----

  log_failure = True

  

  # Do not modify this. It is used when installing and updating weewx.

! version = 5.0.0a11

  

  ##############################################################################

  

***************

*** 28,35 ****

  

  [Station]

  

!     # Description of the station location

!     location = "My Little Town, Oregon"

  

      # Latitude in decimal degrees. Negative for southern hemisphere

      latitude = 0.00

--- 31,38 ----

  

  [Station]

  

!     # Description of the station location, such as your town:

!     location = "WeeWX station"

  

      # Latitude in decimal degrees. Negative for southern hemisphere

      latitude = 0.00

***************

*** 46,52 ****

  

      # If you have a website, you may specify an URL. This is required if you

      # intend to register your station.

!     #station_url = http://www.example.com

  

      # The start of the rain year (1=January; 10=October, etc.). This is

      # downloaded from the station if the hardware supports it.

--- 49,55 ----

  

      # If you have a website, you may specify an URL. This is required if you

      # intend to register your station.

!     #station_url = https://www.example.com

  

      # The start of the rain year (1=January; 10=October, etc.). This is

      # downloaded from the station if the hardware supports it.

***************

*** 457,464 ****

      # Defaults for SQLite databases

      [[SQLite]]

          driver = weedb.sqlite

!         # Directory in which the database files are located

!         SQLITE_ROOT = %(WEEWX_ROOT)s/archive

  

      # Defaults for MySQL databases

      [[MySQL]]

--- 460,467 ----

      # Defaults for SQLite databases

      [[SQLite]]

          driver = weedb.sqlite

!         # Directory in which the database files are located, relative to WEEWX_ROOT:

!         SQLITE_ROOT = archive

  

      # Defaults for MySQL databases

      [[MySQL]]

The only substantive differences is the addition of USER_ROOT (the location of the user subdirectory) and the change of SQLITE_ROOT (to be relative to WEEWX_ROOT). The former is not really necessary, but it seemed like a good idea because 'user' is no longer located amongst the rest of the weewx code. The default is to find it at $WEEWX_ROOT/bin/user, which works for a pip install. For a package install, it will be in the regular PYTHONPATH, so it doesn't need USER_ROOT at all. I could remove it, but, like I said, it seems like a good idea...

i realize that the convention for weewx has been to modify a user's config file during an upgrade.  to me, this is not "backward compatible", this is an upgrade of the config file.

A v4.9.1 weewx.conf can be run in a v5 environment without change. It is not modified by the upgrade process. 
 
 
just to clarify: at some point we explicitly separated the config-file-upgrade code so that dpkg/rpm could invoke that independently of upgrading the weewx code.  now this will be available as 'weectl station upgrade' - upgrade the indicated weewx config file - with a separate option for explicitly upgrading the skins.
 
The weectl station upgrade command runs the old upgrade code to get an ancient weewx.conf up to something modern. It doesn't do anything to a V4.3+ weewx.conf. However, it does upgrade the docs, examples, and utility files.

I haven't written it yet, but weectl station upgrade-skins will upgrade the skins.

Give it a try:

pip install weewx --user
weectl station create
sudo cp ~/weewx-data/systemd/weewx.service /etc/systemd/system

I didn't help my case by including a typo. It should be

sudo cp ~/weewx-data/util/systemd/weewx.service /etc/systemd/system
 
That's it to get a daemon going.

fwiw, this is what i get on an ancient macos (intel) using anaconda3 (python 3.8):

% which pip
/Volumes/Software/sw/anaconda3/bin/pip
% pip install weewx --user
Requirement already satisfied: weewx in ./.local/lib/python3.8/site-packages (5.0.0a4)
Requirement already satisfied: PyMySQL<2.0,>=1.0 in ./.local/lib/python3.8/site-packages (from weewx) (1.0.2)
Requirement already satisfied: configobj>=4.7 in /Volumes/Software/sw/anaconda3/lib/python3.8/site-packages (from weewx) (5.0.6)
Requirement already satisfied: six<2,>=1 in /Volumes/Software/sw/anaconda3/lib/python3.8/site-packages (from weewx) (1.15.0)
Requirement already satisfied: Pillow<10.0,>=9.3 in ./.local/lib/python3.8/site-packages (from weewx) (9.3.0)
Requirement already satisfied: pyusb<2.0.0,>=1.0.2 in ./.local/lib/python3.8/site-packages (from weewx) (1.2.1)
Requirement already satisfied: pyephem<4.0,>=3.7 in ./.local/lib/python3.8/site-packages (from weewx) (3.7.7.0)
Requirement already satisfied: CT3<4.0,>=3.1 in ./.local/lib/python3.8/site-packages (from weewx) (3.3.1)
Requirement already satisfied: pyserial<4.0,>=3.4 in ./.local/lib/python3.8/site-packages (from weewx) (3.5)
Requirement already satisfied: ephem==3.7.7.0 in ./.local/lib/python3.8/site-packages (from pyephem<4.0,>=3.7->weewx) (3.7.7.0)

% export PATH=/Users/mwall/.local/bin:$PATH
% weectl --version
weectl v5.0.0a4
% weectl station create
The configuration file will be created at /Users/Shared/weewx/weewx.conf.

...

i expected it would have defaulted to $HOME/weewx-data, not /Users/Shared/weewx. it succeeded only because i had /Users/Shared/weewx and had permissions on that dir leftover from macos testing.

apparently 'weectl station create' does not install the utils:

...


You're still using a very old version of V5. Try it with --upgrade.


regarding the directory specifications in the weewx config file:
1) is SQLITE_ROOT relative to WEEWX_ROOT *only* if it is a relative path? (where relative path is something that starts with anything other than /)  so i assume that "SQLITE_ROOT = %(WEEWX_ROOT)s/archive" will become simply "SQLITE_ROOT = archive".  however, if weewx is going to be backward compatible, then it will still have to do expansion of WEEWX_ROOT when it finds %(WEEWX_ROOT)s...

As always, WEEWX_ROOT is defined at the top of weewx.conf. So, for a V4.9 weewx.conf it becomes /home/weewx//home/weewx/archive, which is equivalent to /home/weewx/archive. For V5.0, it becomes ~/weewx-data/archive.

2) are SKIN_ROOT and HTML_ROOT also relative to WEEWX_ROOT? (but only if they are a relative path)

Yes. They've always been that way.
3) where do the local, html-ified weewx docs live on a pip install?

$WEEWX_ROOT/$HTML_ROOT, which becomes /home/weewx/public_html for a v4.9 install, ~/weewx-data/public_html for a V5 install.

Hope that answers everything.

-tk


matthew wall

unread,
Jan 17, 2023, 8:45:47 AM1/17/23
to weewx-development
On Tuesday, January 17, 2023 at 7:52:42 AM UTC-5 Tom Keffer wrote:

You're still using a very old version of V5. Try it with --upgrade.

confirmed that the weewx pip install and 'weectl station create' is working as designed (so far) using weewx-5.0.0a11, anaconda3 (python 3.8) on macos 10.14.6

thanks!
Reply all
Reply to author
Forward
0 new messages