Installing WeeWX
Scope: the two install routes — your distribution's package, or pip — what each one puts where, the Python underneath, and the difference between running WeeWX to look at it and running it as a daemon that survives reboots.
What you are installing
WeeWX is a Python program. Installing it means three separate things that are easy to blur:
- The program itself — the
weewxdengine, theweectlmanagement tool, and the libraries they share. This is versioned (this guide used WeeWX 5.5.2) and upgrades occasionally. - A station data area — your station: its configuration file, its skins, its database, its generated web pages. This is yours, and no upgrade should ever overwrite it.
- A way of running it — by hand in a terminal while you learn, or as a system service once it is real.
WeeWX 5 keeps the three firmly apart, and
the tooling respects the split: weectl
station create builds a fresh data area
(chapter 3), weectl manages it thereafter,
and installing a new program version never
touches it. Hold the split in mind and most
installation confusion evaporates.
Route one: the package
For Debian, Ubuntu, and Raspberry Pi OS,
WeeWX publishes its own package archive;
adding it and installing the weewx package
also installs a systemd service, creates a
weewx user, and puts the station data at
/etc/weewx (configuration) and
/var/lib/weewx (database), with reports in
/var/www/html/weewx. This is the route to
choose for a machine whose whole job is the
weather station: the system starts the
engine at boot, restarts it if it falls
over, and rotates its logs. The project's
documentation carries the current, exact
repository steps; they change rarely but
they are the project's to state.
This guide did not install the package — the build machine is a shared sandbox, not a weather Pi — so the package route here is documented-only. Everything after this chapter is route-independent: a station is a station however the program arrived.
Route two: pip (the route this guide ran)
WeeWX is also published on PyPI, and a pip install into a virtual environment is the clean way to run it on any Linux or macOS machine without handing it the system:
$ python3 -m venv weewx-lab/venv
$ weewx-lab/venv/bin/pip install weewx
$ weewx-lab/venv/bin/weewxd --version
5.5.2
Check: what pip brought in, and why each piece is there:
$ weewx-lab/venv/bin/pip list | grep -iE 'weewx|configobj|ct3|pillow|ephem|pyserial|pyusb|pymysql'
configobj 5.0.9
CT3 3.4.0.post5
ephem 4.2.1
Pillow 13.0.0
PyMySQL 1.2.3
pyserial 3.5
pyusb 1.3.1
weewx 5.5.2
| Package | Job in the system |
|---|---|
| configobj | reads and writes weewx.conf |
| CT3 | the Cheetah template engine that fills in the report pages |
| Pillow | draws the graph images |
| ephem | the almanac: sunrise, sunset, moon phase for the celestial page |
| pyserial, pyusb | talk to stations on serial and USB connections |
| PyMySQL | the optional MySQL database driver (unused in this guide) |
Two consequences of the pip route are worth
knowing up front. Nothing is registered with
the system: no service, no weewx user, no
log rotation — you run the engine yourself
(chapter 3), which is exactly right for a
lab. And the program lives in the virtual
environment, so upgrading later is pip
install --upgrade weewx in the same place,
with your station data untouched elsewhere.
Platform notes, plainly
- Linux is WeeWX's home: every driver and every install route assumes it first. Raspberry Pi OS is Debian underneath, and the package route fits it exactly.
- macOS runs WeeWX fine via pip (the
project even ships a launchd plist in the
station's
util/folder). USB station drivers may need the vendor's serial drivers for the Mac. - Windows is not a native WeeWX platform. The realistic Windows routes are a small Linux machine (the classic Pi by the router), a virtual machine, or WSL with USB passthrough arranged by hand — each a project of its own, and none of them run here, so this guide states them and moves on.
The daemon question
Run by hand, weewxd prints its startup to
the log, works in the foreground, and stops
when you stop it — the right shape for
chapter 3. Run as a service, the same engine
is started by systemd from the unit the
package installs (or the sample unit in the
station's util/systemd/ folder, which the
pip route leaves for you to install). The
engine does not care which way it was
started; only your patience does. Learn in
the foreground. Graduate to the service when
the station is real and the terminal is
closed.