[Solved] Home Assistant virtual environment?

Have some feedback, questions, suggestions, or just fancy a chat? Pop it in here.
Post Reply
polartx
Posts: 2
Joined: Mon Sep 25, 2017 10:33 pm

[Solved] Home Assistant virtual environment?

Post by polartx »

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!
User avatar
MichaIng
Site Admin
Posts: 2417
Joined: Sat Nov 18, 2017 6:21 pm

Re: Home Assistant virtual environment?

Post by MichaIng »

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:

Code: Select all

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
polartx
Posts: 2
Joined: Mon Sep 25, 2017 10:33 pm

Re: Home Assistant virtual environment?

Post by polartx »

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 -

Code: Select all

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!
User avatar
MichaIng
Site Admin
Posts: 2417
Joined: Sat Nov 18, 2017 6:21 pm

Re: Home Assistant virtual environment?

Post by MichaIng »

Great it worked :).
User avatar
novitibo
Posts: 86
Joined: Mon Feb 29, 2016 5:11 pm

Re: [Solved] Home Assistant virtual environment?

Post by novitibo »

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?
Post Reply