[Solved] Home Assistant virtual environment?

Can anyone help me with the location and command of entering the homeassistant virtual environment?

In the past it was something like /srv/homeassistant but I believe that was prior to homeassistant becoming a dietpi-service.

Anyway I’d like to update the pip module, (says I’m running version 10 instead of version 19), when I updated from the main shell login as root, the update went fine, but when I did pip freeze I noticed that HA must be running in a virtual environment because none of my dependencies showed up and I was still getting the same error when trying to add a new module in HA.


Thanks for your help!

It is still located in /srv/homeassistant.

The following should work to upgrade the module, but you need to stop the homeassistant service first of course:

systemctl stop home-assistant
su --shell /bin/bash --command "cd /srv/homeassistant; export PATH=\"/home/homeassistant/.pyenv/bin:\$PATH\"; eval \"\$(pyenv init -)\"; eval \"\$(pyenv virtualenv-init -)\"; pyenv activate homeassistant-3.6.3; pip3 install --upgrade homeassistant" homeassistant
systemctl restart home-assistant

this is perfect, thank you!

my issue was that I needed to install pybluez into the pyenv that my homeassistant was running on. Following your advice I was able to solve the problem with the following steps -

sudo apt-get install python-pip python-dev ipython
sudo apt-get install bluetooth libbluetooth-dev

systemctl stop home-assistant
su --shell /bin/bash --command "cd /srv/homeassistant; export PATH=\"/home/homeassistant/.pyenv/bin:\$PATH\"; eval \"\$(pyenv init -)\"; eval \"\$(pyenv virtualenv-init -)\"; pyenv activate homeassistant-3.6.3; pip3 install pybluez" homeassistant
systemctl restart home-assistant

thanks again for you help!

Great it worked :slight_smile:.

Python 3.6 support is deprecated and will be removed in the first release after December 15, 2019. Please upgrade Python to 3.7.0 or higher.

What is the best way to update python for Home assistant in Dietpi virtualenv?