# Home Assistant Launch Error \[cannot import name OrPattern\]

**URL:** <https://dietpi.com/forum/t/home-assistant-launch-error-cannot-import-name-orpattern/23737>\
**Category:** Troubleshooting\
**Created:** [30 June 2025 18:18 UTC](https://dietpi.com/forum/t/home-assistant-launch-error-cannot-import-name-orpattern/23737 "2025-06-30T18:18:04Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![6jmw1pn0](https://dietpi.com/forum/letter_avatar_proxy/v4/letter/6/258eb7/32.png) [@6jmw1pn0](https://dietpi.com/forum/u/6jmw1pn0)\
**Post date:** [30 June 2025 18:18 UTC](https://dietpi.com/forum/t/home-assistant-launch-error-cannot-import-name-orpattern/23737/1 "2025-06-30T18:18:04Z")

</div>

### Creating a bug report/issue

[Y] I have searched the existing open and closed issues

#### Required Information

- DietPi version | `cat /boot/dietpi/.version`

> G\_DIETPI\_VERSION\_CORE=9  
> G\_DIETPI\_VERSION\_SUB=14  
> G\_DIETPI\_VERSION\_RC=2  
> G\_GITBRANCH=‘master’  
> G\_GITOWNER=‘MichaIng’  
> G\_LIVE\_PATCH\_STATUS[0]=‘applied’

- Distro version | `echo $G_DISTRO_NAME $G_RASPBIAN`

> Bookworm

- Kernel version | `uname --all`

> Linux DietPi 6.12.23-current-sunxi64 #1 SMP Thu Apr 10 12:39:41 UTC 2025 aarch64 GNU/Linux

- Architecture | `dpkg --print-architecture`

> arm64

- SBC model | `echo $G_HW_MODEL_NAME` or (EG: RPi3)

> Orange Pi Zero 3 (aarch64)

- Power supply used | (EG: 5V 1A RAVpower)  
– 5V 1A
- SD card used | (EG: SanDisk ultra)  
– Sandisk

#### Additional Information (if applicable)

- Software title | (EG: Nextcloud)  
– Home Assistant
- Was the software title installed freshly or updated/migrated?  
– Fresh
- Can this issue be replicated on a fresh installation of DietPi?
- – Yes, it is a fresh installation.  
 ← If you sent a “dietpi-bugreport”, please paste the ID here → 
- Bug report ID | `echo $G_HW_UUID`

#### Steps to reproduce

- Install Home Assistant from DietPi Software Store

#### Expected behaviour

- Launching normally

#### Actual behaviour

```auto
root@DietPi:/home/homeassistant# systemctl status home-assistant
× home-assistant.service - Home Assistant (DietPi)
     Loaded: loaded (/etc/systemd/system/home-assistant.service; enabled; preset: enabled)
     Active: failed (Result: exit-code) since Mon 2025-06-30 19:04:55 BST; 5s ago
   Duration: 8.644s
    Process: 43758 ExecStart=/home/homeassistant/homeassistant-start.sh (code=exited, status=1/FAILURE)
   Main PID: 43758 (code=exited, status=1/FAILURE)
        CPU: 8.512s

Jun 30 19:04:54 DietPi Home Assistant[43758]: from homeassistant.helpers.config_entry_oauth2_flow import OAuth2AuthorizeCallbackView
Jun 30 19:04:54 DietPi Home Assistant[43758]: File "/home/homeassistant/.pyenv/versions/3.13.5/lib/python3.13/site-packages/homeassistant/helpers/config_entry_oauth2_flow.py", line 25, in <module>
Jun 30 19:04:54 DietPi Home Assistant[43758]: from habluetooth import BluetoothServiceInfoBleak
Jun 30 19:04:54 DietPi Home Assistant[43758]: File "/home/homeassistant/.pyenv/versions/3.13.5/lib/python3.13/site-packages/habluetooth/ __init__.py", line 26, in <module>
Jun 30 19:04:54 DietPi Home Assistant[43758]: from .scanner import BluetoothScanningMode, HaScanner, ScannerStartError
Jun 30 19:04:54 DietPi Home Assistant[43758]: File "src/habluetooth/scanner.py", line 39, in init habluetooth.scanner
Jun 30 19:04:54 DietPi Home Assistant[43758]: ImportError: cannot import name OrPattern
Jun 30 19:04:55 DietPi systemd[1]: home-assistant.service: Main process exited, code=exited, status=1/FAILURE
Jun 30 19:04:55 DietPi systemd[1]: home-assistant.service: Failed with result 'exit-code'.
Jun 30 19:04:55 DietPi systemd[1]: home-assistant.service: Consumed 8.512s CPU time.

```

#### Extra details

- Tried reinstalling, even activating the pyenv and trying to downgrade/upgrade the Bluetooth dependencies, nothing works.

---

<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:** [1 July 2025 08:53 UTC](https://dietpi.com/forum/t/home-assistant-launch-error-cannot-import-name-orpattern/23737/2 "2025-07-01T08:53:24Z")

</div>

can you share the whole service log

```auto
journalctl -u home-assistant

```

---

<div class="post-metadata">

**Author:** ![tims](https://dietpi.com/forum/user_avatar/dietpi.com/tims/32/8062_2.png) [@tims](https://dietpi.com/forum/u/tims)\
**Post date:** [1 July 2025 19:26 UTC](https://dietpi.com/forum/t/home-assistant-launch-error-cannot-import-name-orpattern/23737/3 "2025-07-01T19:26:05Z")

</div>

> [@Joulinar](#):
>
> ```auto
> journalctl -u home-assistant
> 
> ```

I have the same problem.  
My journalctl -u home-assistant says the following:

```auto
dietpi@DietPi:~$ sudo journalctl -u home-assistant
Jun 29 23:49:12 DietPi systemd[1]: Started home-assistant.service - Home Assistant (DietPi).
Jun 29 23:49:16 DietPi Home Assistant[17055]: Traceback (most recent call last):
Jun 29 23:49:16 DietPi Home Assistant[17055]: File "/home/homeassistant/.pyenv/versions/3.13.5/bin/hass", line 8, in <module>
Jun 29 23:49:16 DietPi Home Assistant[17055]: sys.exit(main())
Jun 29 23:49:16 DietPi Home Assistant[17055]: ~~~~ ^^
Jun 29 23:49:16 DietPi Home Assistant[17055]: File "/home/homeassistant/.pyenv/versions/3.13.5/lib/python3.13/site-packages/homeassistant/ __main__.py", line 192, in main
Jun 29 23:49:16 DietPi Home Assistant[17055]: from . import config, runner
Jun 29 23:49:16 DietPi Home Assistant[17055]: File "/home/homeassistant/.pyenv/versions/3.13.5/lib/python3.13/site-packages/homeassistant/runner.py", line 16, in <module>
Jun 29 23:49:16 DietPi Home Assistant[17055]: from . import bootstrap
Jun 29 23:49:16 DietPi Home Assistant[17055]: File "/home/homeassistant/.pyenv/versions/3.13.5/lib/python3.13/site-packages/homeassistant/bootstrap.py", line 41, in <module>
Jun 29 23:49:16 DietPi Home Assistant[17055]: from .components import (
Jun 29 23:49:16 DietPi Home Assistant[17055]: ...<22 lines>...
Jun 29 23:49:16 DietPi Home Assistant[17055]: )
Jun 29 23:49:16 DietPi Home Assistant[17055]: File "/home/homeassistant/.pyenv/versions/3.13.5/lib/python3.13/site-packages/homeassistant/components/auth/ __init__.py", line 158, in <module>
Jun 29 23:49:16 DietPi Home Assistant[17055]: from homeassistant.helpers.config_entry_oauth2_flow import OAuth2AuthorizeCallbackView
Jun 29 23:49:16 DietPi Home Assistant[17055]: File "/home/homeassistant/.pyenv/versions/3.13.5/lib/python3.13/site-packages/homeassistant/helpers/config_entry_oauth2_flow.py", line 25, in <module>
Jun 29 23:49:16 DietPi Home Assistant[17055]: from habluetooth import BluetoothServiceInfoBleak
Jun 29 23:49:16 DietPi Home Assistant[17055]: File "/home/homeassistant/.pyenv/versions/3.13.5/lib/python3.13/site-packages/habluetooth/ __init__.py", line 26, in <module>
Jun 29 23:49:16 DietPi Home Assistant[17055]: from .scanner import BluetoothScanningMode, HaScanner, ScannerStartError
Jun 29 23:49:16 DietPi Home Assistant[17055]: File "src/habluetooth/scanner.py", line 39, in init habluetooth.scanner
Jun 29 23:49:16 DietPi Home Assistant[17055]: ImportError: cannot import name OrPattern
Jun 29 23:49:17 DietPi systemd[1]: home-assistant.service: Main process exited, code=exited, status=1/FAILURE
Jun 29 23:49:17 DietPi systemd[1]: home-assistant.service: Failed with result 'exit-code'.
Jun 29 23:49:17 DietPi systemd[1]: home-assistant.service: Consumed 5.166s CPU time.
Jun 30 20:26:54 DietPi systemd[1]: Started home-assistant.service - Home Assistant (DietPi).
Jun 30 20:27:00 DietPi Home Assistant[26616]: Traceback (most recent call last):
Jun 30 20:27:00 DietPi Home Assistant[26616]: File "/home/homeassistant/.pyenv/versions/3.13.5/bin/hass", line 8, in <module>
Jun 30 20:27:00 DietPi Home Assistant[26616]: sys.exit(main())
Jun 30 20:27:00 DietPi Home Assistant[26616]: ~~~~ ^^
Jun 30 20:27:00 DietPi Home Assistant[26616]: File "/home/homeassistant/.pyenv/versions/3.13.5/lib/python3.13/site-packages/homeassistant/ __main__.py", line 192, in main
Jun 30 20:27:00 DietPi Home Assistant[26616]: from . import config, runner
Jun 30 20:27:00 DietPi Home Assistant[26616]: File "/home/homeassistant/.pyenv/versions/3.13.5/lib/python3.13/site-packages/homeassistant/runner.py", line 16, in <module>
Jun 30 20:27:00 DietPi Home Assistant[26616]: from . import bootstrap
Jun 30 20:27:00 DietPi Home Assistant[26616]: File "/home/homeassistant/.pyenv/versions/3.13.5/lib/python3.13/site-packages/homeassistant/bootstrap.py", line 41, in <module>
Jun 30 20:27:00 DietPi Home Assistant[26616]: from .components import (
Jun 30 20:27:00 DietPi Home Assistant[26616]: ...<22 lines>...
Jun 30 20:27:00 DietPi Home Assistant[26616]: )
Jun 30 20:27:00 DietPi Home Assistant[26616]: File "/home/homeassistant/.pyenv/versions/3.13.5/lib/python3.13/site-packages/homeassistant/components/auth/ __init__.py", line 158, in <module>
Jun 30 20:27:00 DietPi Home Assistant[26616]: from homeassistant.helpers.config_entry_oauth2_flow import OAuth2AuthorizeCallbackView
Jun 30 20:27:00 DietPi Home Assistant[26616]: File "/home/homeassistant/.pyenv/versions/3.13.5/lib/python3.13/site-packages/homeassistant/helpers/config_entry_oauth2_flow.py", line 25, in <module>
Jun 30 20:27:00 DietPi Home Assistant[26616]: from habluetooth import BluetoothServiceInfoBleak
Jun 30 20:27:00 DietPi Home Assistant[26616]: File "/home/homeassistant/.pyenv/versions/3.13.5/lib/python3.13/site-packages/habluetooth/ __init__.py", line 26, in <module>
Jun 30 20:27:00 DietPi Home Assistant[26616]: from .scanner import BluetoothScanningMode, HaScanner, ScannerStartError
Jun 30 20:27:00 DietPi Home Assistant[26616]: File "src/habluetooth/scanner.py", line 39, in init habluetooth.scanner
Jun 30 20:27:00 DietPi Home Assistant[26616]: ImportError: cannot import name OrPattern
Jun 30 20:27:01 DietPi systemd[1]: home-assistant.service: Main process exited, code=exited, status=1/FAILURE
Jun 30 20:27:01 DietPi systemd[1]: home-assistant.service: Failed with result 'exit-code'.
Jun 30 20:27:01 DietPi systemd[1]: home-assistant.service: Consumed 6.667s CPU time.

```

---

<div class="post-metadata">

**Author:** ![Jappe](https://dietpi.com/forum/user_avatar/dietpi.com/jappe/32/1788_2.png) [@Jappe](https://dietpi.com/forum/u/Jappe)\
**Post date:** [2 July 2025 11:21 UTC](https://dietpi.com/forum/t/home-assistant-launch-error-cannot-import-name-orpattern/23737/4 "2025-07-02T11:21:52Z")

</div>

The `habluetooth` module tries to import `OrPattern`, until python 3.13 it was part of pythons regex module, but was changed with python 3.13

So your python version is not compatible with the HA modules you use.  
So you could downgrade python or you wait until HA (or the provider of the third party modules you are using) provides an update to fix this.

BTW the “most optimal” python version for HA is version 3.11.9

---

<div class="post-metadata">

**Author:** ![MichaIng](https://dietpi.com/forum/user_avatar/dietpi.com/michaing/32/7_2.png) [@MichaIng](https://dietpi.com/forum/u/MichaIng)\
**Post date:** [2 July 2025 16:47 UTC](https://dietpi.com/forum/t/home-assistant-launch-error-cannot-import-name-orpattern/23737/6 "2025-07-02T16:47:55Z")

</div>

> [@Jappe](#):
>
> BTW the “most optimal” python version for HA is version 3.11.9

Latest HA requires Python 3.13.2 minimum 😄: [core/pyproject.toml at 80a1e0e4cda4644cb12e30ebdffef8229b7bc03f · home-assistant/core · GitHub](https://github.com/home-assistant/core/blob/80a1e0e4cda4644cb12e30ebdffef8229b7bc03f/pyproject.toml#L24)

But yeah, that does not mean that all integrations are compatible. Some are just not maintained anymore.

Looks like `habluetooth` imports `OrPattern` from `bleak`, which just released its first major v1. There is a PR to add `bleak` v1 support: [feat!: support bleak 1.x by Expl0dingBanana · Pull Request #252 · Bluetooth-Devices/habluetooth · GitHub](https://github.com/Bluetooth-Devices/habluetooth/pull/252)

Workaround until this has been merged and released might be to downgrade `bleak`:

```sh
sudo -u homeassistant bash
. /home/homeassistant/pyenv-activate.sh
pip3 install bleak==0.22.3
exit
systemctl restart home-assistant

```
