How to update a python package? HA seems to revert once it boots up

sudo su -s /bin/bash homeassistant
source /srv/homeassistant/bin/activate
pip3 install --upgrade [package]

cd /srv/homeassistant/lib/python3.5/site-packages

  • New package appears
  • Reboot
  • Return to ‘cd /srv/homeassistant/lib/python3.5/site-packages’ ← Old package appears.

Does HA re-synchronize all packages according to the requirements, and if so, where is that file?

All components specify the python packages they require. If a component requests a strict version, then yes HA will downgrade it at startup. I think that will appear in your log file.

You can avoid this by starting HA with the --skip-pip flag (described in the development docs). But be careful. There’s a good chance that dependency is locked to that version for a reason, and upgrading it may have unintended side effects.

Thanks. I checked the component (in my case Switch/mochad.py) and it doesn’t have a strict version number. I understand that I can override the component version locally (from your linked doc) but now i’m curious where HASS stores the ‘requirements_all.txt’ information. It does indeed contain the old version of the component but how HASS determines the packages it needs to upgrade/downgrade is a mystery to me.

The switch platform doesn’t but the component does. We are pinning the release to make sure that the integrations work. Look for REQUIREMENTS.

Ahhh thanks, indeed the component .py contains the REQUIREMENT string. Updating it to a newer version of the dependency does indeed install the newer package upon startup.