Typo in my note… /home/python —> /home/weewx 
Sent from my iPhone

On Nov 26, 2023, at 2:48 PM, Joel Bion <[email protected]> wrote:

Hi -

I upgraded my setup from 4 to 5 around the time beta 15 came out. The work doing that wasn’t hard at all.

The case study I am referring to is _not_ a case study for telling how users upgrade to v5. Rather, it’s the case study of a standalone software system (weewx) migrating from the old Python setup/install/distribution paradigm (distutils? The use of /home/python) to the one Python recommends you use from 3.12 forward… with the use of venv, the split between the location of program data vs program, etc… 

Looking from the sidelines at the development of weewx 5 - it seems there were lots of steps for Tom and co. to follow, lots of work to make various user upgrade paths work, lots of details.

I am suggesting that the things you had to do might be interesting to others. Written up as a case study like a tough case in in a medical journal, it might make interesting reading. It could touch upon the adequacy of online information to inform you on how you migrated weewx to v5, on the applicability of documented conversation steps to your particular case, etc. little “gotchas” that you had to solve, etc.


Sent from my iPhone

On Nov 26, 2023, at 1:26 PM, Tom Keffer <[email protected]> wrote:


If that's the information Joel is seeking, I honestly don't think it's that complicated. Instead of setting up a new station data area by using "weectl station create," just use your old one: /home/weewx.

See the detailed instructions Migrating setup.py installs to Version 5.0 in the Wiki. There's also a link in the Upgrade Guide.

TL;DR? Read the Guide!

-tk

On Sun, Nov 26, 2023 at 1:05 PM Vince Skahan <[email protected]> wrote:

[...long answer follows...]

v5 beta pip user who came from setup.py installation here so let me pass along my experience and what I did....

This is my personal method and definitely differs from the official steps, but maybe it will help identify one way to approach setting up a test setup before throwing the switch and going live with it....

I might add that I'm a Vantage VP2 with datalogger user here, so it's easy to stop v4, run v5, and then even go back to v4 if needed (I never needed to do so) and the datalogger will handle catching up an old v4 installation.  This is a feature that not all stations have, but it was a nice security blanket here.

Anyway - apologies for this being verbose.  Writing it down just in case somebody needs to search for it.

1.  Set up a v5 pip virtual environment and the station's weewx-data directory
  • created a simulator station using the pip quickstart steps, but did a couple things differently:
    • I added the --no-prompt option to 'weectl station create' so it didn't prompt me
    • I didn't put the weewx.service file into place (yet)
  • installed all the skins and extensions I have in my v4 setup.py config into the new v5 pip weewx-data using 'weectl extension install'
  • installed any python modules my skins/extensions require (requests and paho-mqtt, to name two) into the python venv
    • at this point I could activate the python venv and run weewxd and see simulated data returned
    • and after 5 minutes it should save to the simulator weewx.sdb and run the reports
    • if anything goes boom, you missed adding something to your new pip based installation
  • do not (yet) edit weewx.conf to do anything that acts like an uploader (rsync, mqtt, pws, wu, cwop, and so on)
  • do not (yet) do anything to hook into systemd
  • if you want to hook the v5 pip public_html into your web at a test path, perhaps http://xyz/weewx-v5, you can do that now
2. Copied my NOAA files into place.  The historical ones take too long to regenerate if you have many years.  When we get to it later the current month/year will be overwritten correctly.

3. Copied my archive db into place.  Don't sweat it getting overwritten with simulator data.  We'll copy the real db (again) when putting v5 pip into production

4. Run weewxd interactively again and let it run the reports a couple times.  Verify nothing went boom.  You should see full graphs etc. and NOAA reports.  Don't sweat the contents.  Just ensure it generated them.

5. At this point you have a pretty close to done config.  Go ahead and edit weewx.conf and put in your normal edits there, but be sure to 'enable = false' all your uploaders etc. still at this point.  For me it was anything that uploaded using MQTT and Belchertown as well as RSYNC to my internet site and things like PWS.  Leave them off for now.

6. Now test the weewx.service file.  Save your old one.  Let me repeat that. Save your existing one.  Really.
  • Be a little careful here if you previously had a /etc/init.d file for v4 weewx.  If so, move that aside, saving the old one.
  • copy the service file into place. daemon-reload.  systemctl start.  Verify weewx started ok with "ps -elf" and watch your logs

At this point you should have a v5 pip installation that matches your v4 setup.py installation, other than having the uploaders disabled and having bogus data consisting of historical real data and some appended simulator cruft data.  If you're happy and want to jump to v5 pip you would then:
  • stop v5 weewx
  • once again copy the v4 archive over into the v5 data tree
  • this time you can enable your uploaders 
  • go for smoke and run v5 now
  • tweak your webserver setup to point to the v5 public_html directory
  • verify you can surf to your v5 web
  • Check your logs.  If good, go for the victory pizza.


On Sunday, November 26, 2023 at 11:41:11 AM UTC-8 Joel Bion wrote:
I seriously think there is a formal case study that needs to be written about the challenges of moving WeeWX to the current Python installation model. 

There’s a lesson here for not just the Python developers but others about the difficulty of this transition, because the way WeeWX did things (all things under /home/weewx) was not unreasonable but what has been required to migrate, and the need to support custom package managers, etc…. I just think that this information is useful.


Sent from my iPhone

On Nov 26, 2023, at 11:33 AM, Tom Keffer <[email protected]> wrote:


/etc/weewx/bin is added to the Python path dynamically when weewxd is started up. However, because it is added to the end of the path, the interpreter will find the version in /usr/share/weewx first.

So, why not add it to the beginning of the Python path? Because that causes problems for legacy setup.py installs. In this case, the interpreter will find the code in /home/weewx/bin first, which is the old V4.10 code. The V5 code is under ~/weewx-venv.

In summary, there's no good solution except to warn users.

-tk


On Sun, Nov 26, 2023 at 9:15 AM Karen K <[email protected]> wrote:
Tom Keffer schrieb am Sonntag, 26. November 2023 um 13:50:23 UTC+1:
This issue is already known (always read the Upgrade Guide!). See https://weewx.com/docs/5.0/upgrade/#new-location-for-user-directory

This is a slightly other problem here. I did a new clean install, no upgrade.

My problem was, that the old directory /usr/share/weewx/user still exists and Python looks for modules there only. 

So the extensions were installed to /etc/weewx/bin/user, but Python did not look for them there. 

--
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 [email protected].
To view this discussion on the web visit https://groups.google.com/d/msgid/weewx-development/35032165-08d5-4415-8e9d-d2996ce8ca84n%40googlegroups.com.

--
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 [email protected].

--
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 [email protected].
To view this discussion on the web visit https://groups.google.com/d/msgid/weewx-development/6062f16b-2fbb-452d-91e4-42037cc3ebc0n%40googlegroups.com.

--
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 [email protected].
To view this discussion on the web visit https://groups.google.com/d/msgid/weewx-development/CAPq0zEAVnxh7Un%3DSzbK9s0DkJpbhXWRsinEW1gXG75vm%3D3JzKA%40mail.gmail.com.

--
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 [email protected].
To view this discussion on the web visit https://groups.google.com/d/msgid/weewx-development/431524A8-AED3-40E7-9C0D-F2AF6F33C7B1%40gmail.com.

Reply via email to