WeeWX: Installation using setup.py

These are generic instructions for installing WeeWX using the Python utility setup.py.

Which version of Python?

While WeeWX will run under either Python 2 or Python 3, you should run it under Python 3, if possible. Python 2 is no longer supported by the Python Software Foundation.

The "default" version of Python, that is, the version that is invoked with the simple command python, varies from system to system. However, the command python3 will always invoke Python 3, so it's safest to use that.

The instructions below assume you will be using Python 3.

1. Install prerequisites

First, install the prerequisites appropriate for your operating system.

Prerequisites for Debian 10 (Buster), Raspbian 10, Ubuntu 18.04-19.10

sudo apt update

# Required
sudo apt install python3-configobj
sudo apt install python3-pil
sudo apt install python3-serial
sudo apt install python3-usb
sudo apt install python3-pip

# This works for most installations...
sudo apt install python3-cheetah
# ... if not, try this:
sudo pip3 install Cheetah3

# Optional: for extended almanac information
sudo apt install python3-ephem

# Required if you are using MySQL (MariaDB):
sudo apt install mariadb-client
sudo apt install python3-mysqldb

2. Download

Download the source archive weewx-X.Y.Z.tar.gz from weewx.com/downloads.

3. Install WeeWX

After installing the prerequisites, you can install WeeWX itself.

  1. Expand the source archive:

    tar xvfz weewx-X.Y.Z.tar.gz
  2. Change directory into the expanded archive:

    cd weewx-X.Y.Z
  3. To specify an install location different from the default /home/weewx, modify the parameter home in the setup.cfg file. Mac users will want to change it to /Users/Shared/weewx.

  4. Then build and install. Python 2 users: substitute python2 for python3.

    python3 ./setup.py build
    sudo python3 ./setup.py install

4. Run

Run the main program directly:

cd /home/weewx
sudo ./bin/weewxd

Or as a daemon automatically when the computer starts:

 #-- preferred option - use systemd
cd /home/weewx
sudo cp util/systemd/weewx.service /etc/systemd/system
sudo systemctl enable weewx
sudo systemctl start weewx

#-- option 2 - use the old init.d method if your os is ancient
cd /home/weewx
sudo cp util/init.d/weewx.debian /etc/init.d/weewx
sudo chmod +x /etc/init.d/weewx
sudo update-rc.d weewx defaults 98
sudo /etc/init.d/weewx start 

5. Status

Look in the system log for messages from WeeWX. For example, on Debian systems:

sudo tail -f /var/log/syslog

6. Verify

After about 5 minutes, open the station web page in a web browser. You should see your station information and data. If your hardware supports hardware archiving, then how long you wait will depend on the archive interval set in your hardware.

file:///home/weewx/public_html/index.html

Customize

To enable uploads such as Weather Underground or to customize reports, modify the configuration file /home/weewx/weewx.conf. See the User Guide and Customization Guide for details.

WeeWX must be restarted for configuration file changes to take effect.

Uninstall

To uninstall, simply stop weewx and delete the directory /home/weewx. This will delete WeeWX, configuration files, and data. Also remove the startup file previously put into place.

sudo rm -r /home/weewx

# if you used the systemd startup file method in step (4) above
sudo rm /etc/systemd/system/weewx.service

# or if you used the init.d startup file method in step (4)  above
sudo rm /etc/init.d/weewx

Layout

The installation will place WeeWX in the /home/weewx directory with the following layout:

executable: /home/weewx/bin/weewxd
configuration file: /home/weewx/weewx.conf
skins and templates: /home/weewx/skins/
sqlite databases: /home/weewx/archive/
generated web pages and images: /home/weewx/public_html/
documentation: /home/weewx/docs/
examples: /home/weewx/examples/
utilities: /home/weewx/bin/