From e3b2804aa076f0bfa4f6d713b775b75b7520d8a9 Mon Sep 17 00:00:00 2001 From: Franzz Date: Mon, 14 Sep 2026 21:18:13 +0200 Subject: [PATCH] Install into a virtual environment Raspberry Pi OS refuses pip install into the system Python, so the venv step is the difference between the README working and not. The systemd unit points at that interpreter for the same reason. Co-Authored-By: Claude Opus 5 --- README.md | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 66232d9..1f09d99 100644 --- a/README.md +++ b/README.md @@ -25,12 +25,24 @@ Any other mix works — it is all in `config.py`. ## Install ```bash -pip3 install -r requirements.txt +cd /home/pi/heos +python3 -m venv .venv +source .venv/bin/activate +pip install -r requirements.txt python3 app.py ``` Then open `http://:5005/`. +The virtual environment is not optional on a current Raspberry Pi OS: +`pip install` straight into the system Python is refused there with +`externally-managed-environment`. It also keeps Flask out of the way of +anything else running on the Pi. + +Every later `python3 ...` command here assumes the environment is active +(`source .venv/bin/activate`); `deactivate` when you are done. The service +below calls the environment's Python directly, so it does not care. + ## Configure Open `http://:5005/api/targets` and copy the exact `name` HEOS reports @@ -70,7 +82,7 @@ Description=HEOS panel After=network-online.target [Service] -ExecStart=/usr/bin/python3 /home/pi/heos/app.py +ExecStart=/home/pi/heos/.venv/bin/python /home/pi/heos/app.py WorkingDirectory=/home/pi/heos Restart=always User=pi