DubhAd 5587190866 Added note about venv upgrade (#5030)
* Added note about venv upgrade

Added a note that if you've upgraded Python you'll need to rebuild the venv.

* Minor changes

* Replace short version
2018-03-29 09:23:20 +02:00

2.8 KiB

layout, title, description, date, sidebar, comments, sharing, footer, redirect_from
layout title description date sidebar comments sharing footer redirect_from
page Installation in Python virtual environment How to install Home Assistant in a Python virtual environment. 2016-4-16 16:40 true false true true /getting-started/installation-virtualenv/

If you already have Python 3.5.3 or later installed, you can easily give Home Assistant a spin.

It's recommended when installing Python packages that you use a virtual environment. This will make sure that your Python installation and Home Assistant installation won't impact one another. The following steps will work on most unix like systems.

(If you're on a Debian based system, you will need to install Python virtual environment support using apt-get install python3-pip python3-venv.)

It is recommended to use the [advanced guide](/docs/installation/raspberry-pi/) which allows for the installation to run as a `homeassistant` user. The steps below may be shorter but some users find difficulty when applying updates and may run into issues.

{% linkable_title Install %}

  1. Create a virtual environment in your current directory:
    $ python3 -m venv homeassistant
    
  2. Open the virtual environment:
    $ cd homeassistant
    
  3. Activate the virtual environment:
    $ source bin/activate
    
  4. Install wheel:
    $ python3 -m pip install wheel
    
  5. Install Home Assistant:
    $ python3 -m pip install homeassistant
    
  6. Configure it to autostart
  7. Or run Home Assistant manually:
    $ hass --open-ui
    

{% linkable_title Upgrade %}

  1. Stop Home Assistant

  2. Open the directory where the virtual environment is located:

    $ cd homeassistant
    
  3. Activate the virtual environment:

    $ source bin/activate
    
  4. Upgrade Home Assistant:

    $ python3 -m pip install --upgrade homeassistant
    
  5. Start Home Assistant

{% linkable_title Notes %}

  • In the future, if you want to start Home Assistant manually again, follow step 2, 3 and 5.
  • It's recommended to run Home Assistant as a dedicated user.

Looking for more advanced guides? Check our [Rasbian guide](/docs/installation/raspberry-pi/) or the [other installation guides](/docs/installation/).

{% linkable_title After upgrading Python %}

If you've upgraded Python (for example, you were running 3.5.2 and now you've installed 3.5.4) then you'll need to build a new virtual environment. Simply rename your existing virtual environment directory:

$ mv homeassistant homeassistant.old

Then follow the Install steps again, being sure to use the newly installed version of Python.