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 <noreply@anthropic.com>
This commit is contained in:
@@ -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://<pi-ip>: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://<pi-ip>: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
|
||||
|
||||
Reference in New Issue
Block a user