Installing Home Assistant in python virtual environment on Ubuntu 18.04

This is a video on how to install Home Assistant in a python virtual environment on Ubuntu 18.04

Here is a link to get you started…..

As always, i like to start out by making sure my system is up to date….

sudo apt update
sudo apt upgrade

Once that is done, there are a couple of prerequisites we need to install….

sudo apt install python3-pip python3-venv

After that we can setup our virtual environment….

python3 -m venv homeassistant
cd homeassistant
source bin/activate

python3 -m pip install wheel

now we are ready to install home assistant….

python3 -m pip install homeassistant

Once its installed, you can make sure everything installed properly by running it manually….

hass –open-ui

now we are going to setup a service file so we can run HASS as a service….

make sure you know the path to your HASS install
whereis hass

This should display the path to your HASS install. Now lets create the service file….

sudo vi /etc/systemd/system/[email protected]

Description=Home Assistant

ExecStart=/home/adrian/homeassistant/bin/hass -c “/home/adrian/.homeassistant”


Once that is done save it and lets set it up….

sudo systemctl daemon-reload
sudo systemctl enable [email protected]
sudo systemctl start [email protected]
sudo systemctl status [email protected]

At this point you should be done, you can now move over to the web frontend and see what it looks like…. (the IP is the IP of your machine that you installed it on and 8123 is the default port)

If you like the video, please subscribe to my channel. If you have any questions or comments, hit me up in the comments below. As always, if there are any videos out there you would like to see, let me know in the comments below and ill see if i can’t get something put together for you!!!!

30 thoughts on “Installing Home Assistant in python virtual environment on Ubuntu 18.04

  1. Hello, I receive the error (code=exited, status=217/USER) failed to determine user credentials. have tried %i as the user and my user for Ubuntu desktop and Home Assistant

  2. Hi Adrian

    Looks like I am getting a permission error when HomeAssistant is trying to install packages.

    Unable to install package yeelight==0.5.0: ERROR: Could not install packages due to an EnvironmentError: [Errno 13] Permission denied: '/home/ryan/homeassistant/lib/python3.7/site-packages/enum_compat-0.0.3.dist-info'

    Consider using the `–user` option or check the permissions.

    Tried searching around home assistant forums with no luck, Do you know what could cause this?

  3. I am currently using Python 3.6.9 Xubuntu 18.04 side by side with windows. But where I am stuck is creating the service file. I had typed the first set of command incorrectly and when I tried to delete and fix what I miss typed, I messed it all up. So I exited and I am trying to rewrite the commands but I receive error 35: No previous regular expression. I am just learning all of this so beginner is my level. It sounds to me like I cannot repeat what I have already inputted in the prior attempt. Of course I'm not sure, but would you have any advice to correct this and proceed. I might as well mention that I thought I messed up earlier as well and accidentally installed the homeassistant outside of the virtual environment because I never did see the homeassistant in parenthesis. But I'm not quite sure about that either. Any help would be great.

  4. shame this does not work on my Odroid C2 with ubuntu 18. i got errors when i ran this command: python3 -m pip install homeassistant

    but thanks for your tutorial. very comprehensive and the description has all the commands for us to copy n paste.

  5. My HASS never finished after finding Logitech harmony so I killed the terminal. Now when I resume the hass -open-ui, I get "command hass not found, did you mean sass, ass or pass—–". What steps to fix this? I believe whatever was installed should be there other than devices. (Not linux user)

Leave a Reply

Your email address will not be published. Required fields are marked *