-
Notifications
You must be signed in to change notification settings - Fork 301
v5 upgrade
This is a guide for migrating V4.x installations that were installed using the
setup.py
method, to Version 5.0, using pip.
With V5.0, there is now a clean separation between WeeWX code, and station
data. They are stored in separate areas, rather than everything under
/home/weewx
.
While there are many ways to install WeeWX using pip,
if you follow the WeeWX install recommendations, pip will install your code in a
virtual environment, located in ~/weewx-venv
in your home directory.
This contrasts with the setup.py
method, which installed everything under
/home/weewx/bin
.
By contrast, station data is specific to your station. Typically, it includes:
- The configuration file,
weewx.conf
; - Skins;
- Database;
- Generated HTML files and images; and
- Extensions (Python code specific to a station).
By default, it is now stored in your home directory in ~/weewx-data
, although
you may continue to use your old station data located in /home/weewx
by
following this guide. With this in mind, here is how to install Version 5, while
continuing to use the old station data in /home/weewx
.
-
Install V5.0 by using the tool
pip
. See the guide Installation using pip, but note that you are only going to follow the first step Install in a virtual environment. Do not do step 2, Provision a new station.When you are done, the new V5.0 executable will be in
~/weewx-venv/bin/weewxd
, rather than the more familiar V4.x location/home/weewx/bin/weewxd
.For what follows, make sure your virtual environment is still active. When in doubt, you can always reactivate it:
source ~/weewx-venv/bin/activate
-
The step to follow (step 3) will require write privileges to
/home/weewx
. If you already have them, you can skip this step. Otherwise, the following will create them.sudo chown -R $USER: /home/weewx
-
While you will be reusing your old station data in
/home/weewx
, you will need to upgrade your old examples and daemon utility files to the V5 versions.weectl station upgrade --config=/home/weewx/weewx.conf
-
At this point, try running the V5.0 version of
weewxd
directly, using your old configuration file.weewxd --config=/home/weewx/weewx.conf
-
If that works, then it's time to replace your old daemon configuration file with one that uses the new V5.0 executable. These steps will require root privileges.
# systems with systemd # This will run weewx as you, not root. If you prefer to run as # the root user, modify the weewx.service file. sudo cp /home/weewx/util/systemd/weewx.service /etc/systemd/system sudo systemctl daemon-reload sudo systemctl enable weewx sudo systemctl start weewx
# systems with sysVinit sudo cp /home/weewx/util/init.d/weewx.debian /etc/init.d/weewx sudo chmod +x /etc/init.d/weewx sudo update-rc.d weewx defaults 98 sudo systemctl start weewx
# macOS sudo cp /Users/Shared/weewxutil/launchd/com.weewx.weewxd.plist /Library/LaunchDaemons sudo launchctl load /Library/LaunchDaemons/com.weewx.weewxd.plist
Note that your old V4.x code will still be under /home/weewx/bin
(/Users/Shared/weewx
for macOS).
To avoid confusing yourself and any tools that you might use, you should
consider moving your old code aside. Unfortunately, you cannot simply rename it,
because your user
directory is located underneath, so you would lose access to
it and any extensions it might contain. Here's how to do it without disturbing
the things you want to keep:
cd /home/weewx
mv bin bin.old
mkdir bin
cp -r ./bin.old/user bin
cd /Users/Shared/weewx
mv bin bin.old
mkdir bin
cp -r ./bin.old/user bin
When you're done, you should have a directory tree that looks something like this:
bin
└── user
├── __init__.py
├── extensions.py
└── installer
bin.old
├── daemon.py
├── schemas
... etc