Graham - in experimenting a little, I think this isn't necessarily a weewx 
bug but perhaps a minor documentation tweak might help.

   - If you create the venv ala "*python3* -m venv weewx_venv" then you are 
   using the os python version, which can float upward if you update the os
   - If you create the venv ala "*python3.11 *-m venv weewx_venv" then you 
   are hard pinning it to a particular version of python that is stable.

In the latter example, the weewx-venv/bin symlinks look much better:

lrwxrwxrwx 1 vagrant vagrant   10 Sep  1 18:52 python -> python3.11
lrwxrwxrwx 1 vagrant vagrant   10 Sep  1 18:52 python3 -> python3.11
lrwxrwxrwx 1 vagrant vagrant   19 Sep  1 18:52 python3.11 -> 
/usr/bin/python3.11

And the service files also look better after running setup-daemon.sh:

ExecStart=/home/vagrant/weewx-venv/bin/*python3.11* 
/home/vagrant/weewx-venv/lib/*python3.11*/site-packages/weewxd.py 
/home/vagrant/weewx-data/weewx.conf

So I have to retract my guess that this is a weewx 'code' bug but perhaps a 
minor docs tweak might help venv installations be a little more upgrade 
safe.

Sorry for any confusion previously.  FWIW in the original case I replied 
with earlier, I still think that one symlink change should have gotten the 
pre-existing condition to better pin to a specific python version.  The 
procedural change above here is perhaps what a new installation might 
better use to be os upgrade safe.

On Monday, September 1, 2025 at 10:50:26 AM UTC-7 vince wrote:

> You're going to have to describe with 'effectively wiped' means. 
>
> A weewx venv installation is not consistent in where it pins things to a 
> specific python version vs. where it relies on the os default python 
> version (perhaps a bug). Long answer follows, but there might be a quick 
> fix...
>
> Background:
>
>    - bookworm uses python3.11 so your original venv expected python3.11 
>    for everything under the hood, as well as its systemd service files
>    -  Unfortunately bookworm => trixie changes your system python version 
>    from 3.11 to 3.13
>    - so you've created a mismatch between the os python (new) and the 
>    weewx configuration that still expects the older 3.11 version of python
>    - and weewx being inconsistent in where it relies on the os python 
>    version is what you are likely running into
>
> Looking in weewx-venv/bin:
> lrwxrwxrwx 1 root root    7 Sep  1 17:14 python -> python3
> lrwxrwxrwx 1 root root   16 Sep  1 17:14 python3 -> /usr/bin/python3
> lrwxrwxrwx 1 root root    7 Sep  1 17:14 python3.11 -> python3
>
> But the /etc/systemd/system weewx service files (there are three) contain:
>
> ExecStart=/home/pi/weewx-venv/bin/python3 \
>     /home/pi/weewx-venv/lib/python3.11/site-packages/weewxd.py \
>     /home/pi/weewx-data/weewx.conf
>
> So when you walk the symlinks the ExecStart is using the 'os' python 
> version not the 'venv' python version.  That (to me) is a bug.
>
>    - weewx-venv/bin/python3 points to /usr/bin/python3 (the os version)
>    - when it should point to /usr/bin/python3.11 (the specific version 
>    the venv was created under)
>
> A quick fix is to change one symlink to make things consistently point to 
> the original 3.11 python still present (but not the default) of your os:
>
>    - deactivate the venv
>    - remove the weewx-bin/python3 symlink
>    - add a new symlink pointing it to /usr/bin/python3.11
>    - activate the venv
>    - run "python3 --version" and you'll see it points to the original 3.11
>    - so everything will be consistently pointing to the original 3.11 
>    version
>
> I'm thinking this might be a weewx bug - the symlink in the venv should 
> point to the specific python version the venv was created in, once you read 
> through all the symlinks.   If apps are going to set up a venv to be immune 
> from the os default python version changing, they need to do so 
> consistently to effectively pin themselves end-to-end to a specific version 
> of python.
>
>
> On Monday, September 1, 2025 at 12:54:44 AM UTC-7 Graham Eddy wrote:
>
>> i just did an in situ upgrade from bookworm to trixie (edit sources.list, 
>> update, dist-upgrade) and hit a snag:
>> my old ~weewx/venv had been effectively wiped, so i had to reinstall 
>> weewx5 (i use pip method) plus my own private modules. it also needed 
>> module ’six’ reinstalled, which i thought would have been picked up in 
>> dependencies but…
>> smooth sailing apart from that.
>> cheers
>> *⊣GE⊢*
>>
>>

-- 
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 visit 
https://groups.google.com/d/msgid/weewx-user/922f59c2-eca3-425a-b245-9fd8c1f27e0cn%40googlegroups.com.

Reply via email to