I just got this working and thought it might be useful to pass on some hints collected together here.
Now install pysftp. This package is a bit old and lots of net searches tell you to use something else, but it works fine once you get it in. The key is that on the latest Raspbian you need to install this in a virtual environment. You can't install stuff system wide (without really knowing what you are doing). You do this by
- be sure the virtual environment is activated in your terminal process. (The prompt will start (weewx-venv).
-pip install --user --break-system-packages pysftp
(Don't be scared of "break system packages" if you also say -user. If you don't say -user, this overrides the checks and installs it system wide. It may be fine, but not recommended)
-feel free to let it start and make sure it is working, setting up the database, etc. If you have an old database from a previous incarnation you can just drop it in the right place, assuming it is not corrupted.
- stop weewx using the command 'systemctl stop weewx'
- Now install weewx-sftp. The readme in
https://github.com/matthewwall/weewx-sftp is a bit out of date, as are a couple other things. Get the zip file as the readme says, but then the correct command to install it on these newer versions is
weectl extension install weewx-sftp.zip
-DO NOT start weewx back up yet. First you will find some stuff in sftp.py that does not work on the latest of everything. sftp.py is in ~/weew-data/bbin/user assuming you did everything based on your login directory. Edit it, and everywhere you see cPickle (or maybe cpickle) change it to just pickle. This requirement must have been fairly recent since Matthew Wall did a checkin that was supposed to make this work for Pip V3.
-Change the [SFTP] username, password, and destination directory to where you want it to be.
- restart weewx using 'systemctl start weewx'
If there is a problem, you can look at error messages using
journalctl -e (the last page or so of the log) or
journalctl -n 100 (number of your choice...show the last 100 lines of the log)
==============================
I hope this will help someone. Honestly, there is nothing here that is not likely to be somewhere else, but I thought it would be nice to put it all together. BTW, I used ChatGPT to help figure out some of this stuff. It was not always right, but usually pointed me in the right direction. And surprisingly it knows a lot about weewx!