# Homeassistant fail to start after update

**URL:** https://dietpi.com/forum/t/homeassistant-fail-to-start-after-update/15104
**Category:** Troubleshooting
**Created:** [29 November 2022 17:58 UTC](https://dietpi.com/forum/t/homeassistant-fail-to-start-after-update/15104 "2022-11-29T17:58:42Z")
**Posts on this page:** 6
**Page:** 1

<div class="post-metadata">

### Author: ![mail2rst](https://dietpi.com/forum/letter_avatar_proxy/v4/letter/m/ee59a6/32.png) [@mail2rst](https://dietpi.com/forum/u/mail2rst)
#### Post date: [29 November 2022 17:58 UTC](https://dietpi.com/forum/t/homeassistant-fail-to-start-after-update/15104/1 "2022-11-29T17:58:42Z")

</div>

I have home assistant running on my Raspberry pi B2. I have upgrade dietpi-update & then regular apt-get update, apt-get upgrade commands. then home assistant fail to start. the logs are like this

```auto
 Installing Python with Home Assistant module into pyenv
│ - Command: sudo -u homeassistant dash -c
│ . /home/homeassistant/pyenv-activate.sh
│ pyenv install 3.9.15
│ pyenv local 3.9.15
│ pip3 install --no-cache-dir -U pip setuptools wheel
│ [-z ''] || pip3 install --no-cache-dir
│ exec pip3 install --no-cache-dir homeassistant
│ - Exit code: 1
│ - DietPi version: v8.11.2 (MichaIng/master) | HW_MODEL: 2 | HW_ARCH: 2 | DISTRO: 6
│ - Image creator: DietPi Core Team
│ - Pre-image: Raspbian Lite
│ - Error log:
│ Downloading Python-3.9.15.tar.xz...
│ -> https://www.python.org/ftp/python/3.9.15/Python-3.9.15.tar.xz
│ Installing Python-3.9.15...
│ WARNING: The Python lzma extension was not compiled. Missing the lzma lib?
│ Installed Python-3.9.15 to /home/homeassistant/.pyenv/versions/3.9.15
│
│ Looking in indexes: https://pypi.org/simple, https://www.piwheels.org/simple/
│ Requirement already satisfied: pip in ./.pyenv/versions/3.9.15/lib/python3.9/site-packages (22.0.4)
│ Collecting pip
│ Downloading pip-22.3.1-py3-none-any.whl (2.1 MB)
│ ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 2.1/2.1 MB 5.8 MB/s eta 0:00:00
│ Requirement already satisfied: setuptools in ./.pyenv/versions/3.9.15/lib/python3.9/site-packages (58.1.0)
│ Collecting setuptools
│ Downloading https://www.piwheels.org/simple/setuptools/setuptools-65.6.3-py3-none-any.whl (1.2 MB)
│ ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 1.2/1.2 MB 1.5 MB/s eta 0:00:00
│ Collecting wheel
│ Downloading https://www.piwheels.org/simple/wheel/wheel-0.38.4-py3-none-any.whl (36 kB)
│ Installing collected packages: wheel, setuptools, pip
│ Attempting uninstall: setuptools
│ Found existing installation: setuptools 58.1.0
│ Uninstalling setuptools-58.1.0:
│ Successfully uninstalled setuptools-58.1.0
│ Attempting uninstall: pip
│ Found existing installation: pip 22.0.4 

```

---

<div class="post-metadata">

### Author: ![mail2rst](https://dietpi.com/forum/letter_avatar_proxy/v4/letter/m/ee59a6/32.png) [@mail2rst](https://dietpi.com/forum/u/mail2rst)
#### Post date: [29 November 2022 17:59 UTC](https://dietpi.com/forum/t/homeassistant-fail-to-start-after-update/15104/2 "2022-11-29T17:59:45Z")

</div>

```auto
           =============================DEBUG ASSISTANCE=============================
          If you are seeing a compilation error please try the following steps to
          successfully install cryptography:
          1) Upgrade to the latest pip and try again. This will fix errors for most
             users. See: https://pip.pypa.io/en/stable/installing/#upgrading-pip
          2) Read https://cryptography.io/en/latest/installation/ for specific
             instructions for your platform.
          3) Check our frequently asked questions for more information:
             https://cryptography.io/en/latest/faq/
          4) Ensure you have a recent Rust toolchain installed:
             https://cryptography.io/en/latest/installation/#rust

          Python: 3.9.15
          platform: Linux-5.15.76-v7+-armv7l-with-glibc2.31
          pip: n/a
          setuptools: 65.6.3
          setuptools_rust: 1.5.2
          rustc: n/a
          =============================DEBUG ASSISTANCE=============================

      error: can't find Rust compiler

      If you are using an outdated pip version, it is possible a prebuilt wheel is available for this package but pip is not able to install from it. Installing from the wheel would avoid the need for a Rust compiler.

      To update pip, run:

          pip install --upgrade pip

      and then retry package installation.

      If you did intend to build this package from source, try installing a Rust compiler from your system package manager and ensure it is on the PATH during installation. Alternatively, rustup (available at https://rustup.rs) is the recommended way to download and update the Rust compiler toolchain.

      This package requires Rust >=1.48.0.
      [end of output]

  note: This error originates from a subprocess, and is likely not a problem with pip.
  ERROR: Failed building wheel for cryptography
Failed to build cryptography
ERROR: Could not build wheels for cryptography, which is required to install pyproject.toml-based projects

```

---

<div class="post-metadata">

### Author: ![Joulinar](https://dietpi.com/forum/user_avatar/dietpi.com/joulinar/32/57_2.png) [@Joulinar](https://dietpi.com/forum/u/Joulinar)
#### Post date: [29 November 2022 18:18 UTC](https://dietpi.com/forum/t/homeassistant-fail-to-start-after-update/15104/3 "2022-11-29T18:18:12Z")

</div>

> [@mail2rst](#):
>
> I have upgrade dietpi-update & then regular apt-get update, apt-get upgrade commands. then home assistant fail to start.

I guess you did way more than this. Because you have a failed HA install / re-install process. This has nothing to do with `dietpi-update`, `apt-get update` or `apt-get upgrade` 😉

The issue is with `piwheels.org` as we use pre-compiled wheels. Actually, builds for `cryptography` failded due to Rust dependency. We tried to assist `piwheels.org` guys but no luck so far.

A possible way around [Failed to build cryptography while either updating or installing sabnzbd - #2 by Joulinar](https://dietpi.com/forum/t/failed-to-build-cryptography-while-either-updating-or-installing-sabnzbd/15048/2)

---

<div class="post-metadata">

### Author: ![mail2rst](https://dietpi.com/forum/letter_avatar_proxy/v4/letter/m/ee59a6/32.png) [@mail2rst](https://dietpi.com/forum/u/mail2rst)
#### Post date: [29 November 2022 19:18 UTC](https://dietpi.com/forum/t/homeassistant-fail-to-start-after-update/15104/4 "2022-11-29T19:18:57Z")

</div>

I gave serial wise these commands but still system fail to start home assistant

```auto
 curl -sSfL 'https://sh.rustup.rs' -o rustup-init.sh
chmod +x rustup-init.sh
./rustup-init.sh -y --profile minimal
rm rustup-init.sh
source "$HOME/.cargo/env"
dietpi-software install 16 130
apt install libffi-dev libssl-dev
pip3 install cryptography

```

also in end system show this message

```auto
Installing collected packages: pycparser, cffi, cryptography
Successfully installed cffi-1.15.1 cryptography-38.0.4 pycparser-2.21
WARNING: Running pip as the 'root' user can result in broken permissions and conflicting behaviour with the system package manager. It is recommended to use a virtual environment instead: https://pip.pypa.io/warnings/venv 

```

so please tell me these command modify as per our home assistant installation. thanks

---

<div class="post-metadata">

### Author: ![Joulinar](https://dietpi.com/forum/user_avatar/dietpi.com/joulinar/32/57_2.png) [@Joulinar](https://dietpi.com/forum/u/Joulinar)
#### Post date: [29 November 2022 19:39 UTC](https://dietpi.com/forum/t/homeassistant-fail-to-start-after-update/15104/5 "2022-11-29T19:39:26Z")

</div>

you can’t follow the link I shared 1:1. This was just an idea on how to work around. You would need to install Rust for HA user. Same for `pip3 install cryptography`

To do so, you need to activate `Customize Python environment` as per our online docs. [Home Automation Software Options - DietPi.com Docs](https://dietpi.com/docs/software/home_automation/#home-assistant)

```auto
sudo -u homeassistant bash
. /home/homeassistant/pyenv-activate.sh
curl -sSfL 'https://sh.rustup.rs' -o rustup-init.sh
chmod +x rustup-init.sh
./rustup-init.sh -y --profile minimal
rm rustup-init.sh
source "$HOME/.cargo/env"
pip3 install cryptography

```

---

<div class="post-metadata">

### Author: ![mail2rst](https://dietpi.com/forum/letter_avatar_proxy/v4/letter/m/ee59a6/32.png) [@mail2rst](https://dietpi.com/forum/u/mail2rst)
#### Post date: [29 November 2022 21:06 UTC](https://dietpi.com/forum/t/homeassistant-fail-to-start-after-update/15104/6 "2022-11-29T21:06:29Z")

</div>

Thanks Joulinar, after your provided commands system & homeassistant updated to latest version & system works fine again. thanks
