Installing Home Assistant Core 2023.2.2 in a Python vEnv on Raspberry Pi 3B+ step by step

Installing Home Assistant Core 2023.2.2 on Raspberry Pi 3B+ step by step

I installed Home Assistant Core 2022.11.3 in a virtual environment (pip) on a clean Raspberry Pi 3B+ device(debian 11).

I can’t guarantee that the new version will install and run successfully, so I decided to do a fresh install first in order not to affect the operation of the existing system. After all problems are resolved, the existing system will be upgraded. This article is the problems encountered during the installation process and the solutions. It took me days for my peers to refer to.

Environment

  • Operating system and architecture: Debain 11, arm64

I tired following this official guide: Installation - Home Assistant

I’ve updated to Python 3.10 and installed 2022.11.3

In summary there is a couple of steps involved, but from a High-Level, this is what’s required:

Create and change to a virtual environment for Home Assistant Core

sudo useradd -rm homeassistant20230201 -G dialout,gpio,i2c


#create a directory for the installation of Home Assistant Core
sudo mkdir /srv/homeassistant20230201

#change the owner to the homeassistant20230201 account
sudo chown homeassistant20230200:homeassistant20230200 /srv/homeassistant20230200

sudo -u homeassistant20230201 -H -s
cd /srv/homeassistant20230201
python3.10 -m venv .
source bin/activate

before install Home Assistant Core(in a virtual environment)

You have to install wheels first. Try following this official guide: Installation - Home Assistant

pip install --upgrade pip
python3 -m pip install wheel

Install Home Assistant Core


#Stop the Homeassistant service for free port 8123
sudo systemctl stop home-assistant@homeassistant
pip3 install homeassistant==2023.2.1  (in a virtual environment)

resolve some errors


pip3 install cryptography  (in a virtual environment)
curl https://sh.rustup.rs -sSf | sh  (in a virtual environment)
sudo apt -y install rustc    (not in a virtual environment)
pip3 install pyOpenSSL --upgrade


Other:checklist

(homeassistant20230201) homeassistant20230201@raspberrypi:/srv/homeassistant20230201 $ python3 -m pip --version
pip 22.3.1 from /srv/homeassistant20230201/lib/python3.10/site-packages/pip (python 3.10)
1 Like

first Install

(homeassistant20230201) homeassistant20230201@raspberrypi:/srv/homeassistant20230201 $ pip3 install homeassistant==2023.2.1


Looking in indexes: https://mirrors.aliyun.com/pypi/simple, https://www.piwheels.org/simple
Collecting homeassistant==2023.2.1
  Downloading https://mirrors.aliyun.com/pypi/packages/19/91/17283c16691b53e7cdcd48faaa9a12b7c96c26cc4c26d2017818a2e68ad4/homeassistant-2023.2.1-py3-none-any.whl (21.7 MB)
     ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 21.7/21.7 MB 319.3 kB/s eta 0:00:00
Collecting home-assistant-bluetooth==1.9.2
  Downloading https://mirrors.aliyun.com/pypi/packages/03/1d/f2a3bd355bb312995afc9d6e823f868f8c0e8ef961481b9eac62e7c419e1/home_assistant_bluetooth-1.9.2.tar.gz (10 kB)
  Installing build dependencies ... done
  Getting requirements to build wheel ... done
  Preparing metadata (pyproject.toml) ... done
Collecting PyJWT==2.5.0
  Using cached https://www.piwheels.org/simple/pyjwt/PyJWT-2.5.0-py3-none-any.whl (20 kB)
Collecting astral==2.2
  Using cached https://www.piwheels.org/simple/astral/astral-2.2-py2.py3-none-any.whl (30 kB)
Collecting orjson==3.8.5
  Downloading https://mirrors.aliyun.com/pypi/packages/4e/3e/50e5c09fe2357aa2f1aa4f59f9383ef8fd4a68722ddbe382c7b747f0d5e6/orjson-3.8.5-cp310-cp310-manylinux_2_17_armv7l.manylinux2014_armv7l.whl (149 kB)
     ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 149.5/149.5 kB 460.9 kB/s eta 0:00:00
Collecting async-timeout==4.0.2
  Using cached https://www.piwheels.org/simple/async-timeout/async_timeout-4.0.2-py3-none-any.whl (5.8 kB)
Collecting bcrypt==4.0.1
  Downloading https://mirrors.aliyun.com/pypi/packages/8c/ae/3af7d006aacf513975fd1948a6b4d6f8b4a307f8a244e1a3d3774b297aad/bcrypt-4.0.1.tar.gz (25 kB)
  Installing build dependencies ... done
  Getting requirements to build wheel ... done
  Preparing metadata (pyproject.toml) ... done
Collecting yarl==1.8.1
  Downloading https://mirrors.aliyun.com/pypi/packages/d6/04/255c68974ec47fa754564c4abba8f61f9ed68b869bbbb854198d6259c4f7/yarl-1.8.1.tar.gz (172 kB)
     ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 172.3/172.3 kB 590.4 kB/s eta 0:00:00
  Installing build dependencies ... done
  Getting requirements to build wheel ... done
  Preparing metadata (pyproject.toml) ... done
Collecting pyyaml==6.0
  Downloading https://mirrors.aliyun.com/pypi/packages/36/2b/61d51a2c4f25ef062ae3f74576b01638bebad5e045f747ff12643df63844/PyYAML-6.0.tar.gz (124 kB)
     ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 125.0/125.0 kB 429.6 kB/s eta 0:00:00
  Installing build dependencies ... done
  Getting requirements to build wheel ... done
  Preparing metadata (pyproject.toml) ... done
Collecting ifaddr==0.1.7
  Using cached https://www.piwheels.org/simple/ifaddr/ifaddr-0.1.7-py2.py3-none-any.whl (10 kB)
Collecting lru-dict==1.1.8
  Downloading https://mirrors.aliyun.com/pypi/packages/79/da/138e76e2e9ecf074a5ee26cacbd0676e1efdfff2bda3e6f40a6dc8728bf3/lru-dict-1.1.8.tar.gz (10 kB)
  Preparing metadata (setup.py) ... done
Collecting requests==2.28.1
  Using cached https://www.piwheels.org/simple/requests/requests-2.28.1-py3-none-any.whl (62 kB)
Collecting awesomeversion==22.9.0
  Using cached https://www.piwheels.org/simple/awesomeversion/awesomeversion-22.9.0-py3-none-any.whl (12 kB)
Collecting ciso8601==2.3.0
  Downloading https://mirrors.aliyun.com/pypi/packages/05/29/39180b182b53acf7b68abd74f79df995fcb1eee077047cb265c16e227fbc/ciso8601-2.3.0.tar.gz (26 kB)
  Installing build dependencies ... done
  Getting requirements to build wheel ... done
  Preparing metadata (pyproject.toml) ... done
Collecting pyOpenSSL==23.0.0
  Using cached https://www.piwheels.org/simple/pyopenssl/pyOpenSSL-23.0.0-py3-none-any.whl (57 kB)
Requirement already satisfied: pip<22.4,>=21.0 in ./lib/python3.10/site-packages (from homeassistant==2023.2.1) (22.3.1)
Collecting voluptuous-serialize==2.5.0
  Using cached https://www.piwheels.org/simple/voluptuous-serialize/voluptuous_serialize-2.5.0-py3-none-any.whl (3.4 kB)
Collecting typing-extensions<5.0,>=4.4.0
  Using cached https://www.piwheels.org/simple/typing-extensions/typing_extensions-4.4.0-py3-none-any.whl (26 kB)
Collecting jinja2==3.1.2
  Using cached https://www.piwheels.org/simple/jinja2/Jinja2-3.1.2-py3-none-any.whl (133 kB)
Collecting attrs==22.2.0
  Using cached https://www.piwheels.org/simple/attrs/attrs-22.2.0-py3-none-any.whl (60 kB)
Collecting python-slugify==4.0.1
  Using cached https://www.piwheels.org/simple/python-slugify/python_slugify-4.0.1-py2.py3-none-any.whl (7.0 kB)
Collecting voluptuous==0.13.1
  Using cached https://www.piwheels.org/simple/voluptuous/voluptuous-0.13.1-py3-none-any.whl (35 kB)
Collecting httpx==0.23.3
  Using cached https://www.piwheels.org/simple/httpx/httpx-0.23.3-py3-none-any.whl (71 kB)
Collecting atomicwrites-homeassistant==1.4.1
  Using cached https://www.piwheels.org/simple/atomicwrites-homeassistant/atomicwrites_homeassistant-1.4.1-py2.py3-none-any.whl (7.1 kB)
WARNING: Retrying (Retry(total=4, connect=None, read=None, redirect=None, status=None)) after connection broken by 'ProtocolError('Connection aborted.', RemoteDisconnected('Remote end closed connection without response'))': /simple/cryptography/
Collecting cryptography==39.0.0
  Downloading https://mirrors.aliyun.com/pypi/packages/12/e3/c46c274cf466b24e5d44df5d5cd31a31ff23e57f074a2bb30931a8c9b01a/cryptography-39.0.0.tar.gz (603 kB)
     ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 603.4/603.4 kB 124.2 kB/s eta 0:00:00
  Installing build dependencies ... done
  Getting requirements to build wheel ... done
  Preparing metadata (pyproject.toml) ... done
Collecting certifi>=2021.5.30
  Using cached https://www.piwheels.org/simple/certifi/certifi-2022.12.7-py3-none-any.whl (155 kB)
Collecting aiohttp==3.8.1
  Downloading https://mirrors.aliyun.com/pypi/packages/5a/86/5f63de7a202550269a617a5d57859a2961f3396ecd1739a70b92224766bc/aiohttp-3.8.1.tar.gz (7.3 MB)
     ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 7.3/7.3 MB 315.7 kB/s eta 0:00:00
  Installing build dependencies ... done
  Getting requirements to build wheel ... done
  Installing backend dependencies ... done
  Preparing metadata (pyproject.toml) ... done
Collecting frozenlist>=1.1.1
  Downloading https://mirrors.aliyun.com/pypi/packages/e9/10/d629476346112b85c912527b9080944fd2c39a816c2225413dbc0bb6fcc0/frozenlist-1.3.3.tar.gz (66 kB)
     ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 66.6/66.6 kB 472.4 kB/s eta 0:00:00
  Installing build dependencies ... done
  Getting requirements to build wheel ... done
  Preparing metadata (pyproject.toml) ... done
Collecting aiosignal>=1.1.2
  Using cached https://www.piwheels.org/simple/aiosignal/aiosignal-1.3.1-py3-none-any.whl (7.6 kB)
Collecting charset-normalizer<3.0,>=2.0
  Using cached https://www.piwheels.org/simple/charset-normalizer/charset_normalizer-2.1.1-py3-none-any.whl (39 kB)
Collecting multidict<7.0,>=4.5
  Downloading https://mirrors.aliyun.com/pypi/packages/4a/15/bd620f7a6eb9aa5112c4ef93e7031bcd071e0611763d8e17706ef8ba65e0/multidict-6.0.4.tar.gz (51 kB)
     ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 51.3/51.3 kB 378.9 kB/s eta 0:00:00
  Installing build dependencies ... done
  WARNING: Missing build requirements in pyproject.toml for multidict<7.0,>=4.5 from https://mirrors.aliyun.com/pypi/packages/4a/15/bd620f7a6eb9aa5112c4ef93e7031bcd071e0611763d8e17706ef8ba65e0/multidict-6.0.4.tar.gz#sha256=3666906492efb76453c0e7b97f2cf459b0682e7402c0489a95484965dbc1da49 (from aiohttp==3.8.1->homeassistant==2023.2.1).
  WARNING: The project does not specify a build backend, and pip cannot fall back to setuptools without 'wheel'.
  Getting requirements to build wheel ... done
  Installing backend dependencies ... done
  Preparing metadata (pyproject.toml) ... done
Collecting pytz
  Using cached https://www.piwheels.org/simple/pytz/pytz-2022.7.1-py3-none-any.whl (499 kB)
WARNING: Retrying (Retry(total=4, connect=None, read=None, redirect=None, status=None)) after connection broken by 'ProtocolError('Connection aborted.', RemoteDisconnected('Remote end closed connection without response'))': /simple/cffi/
Collecting cffi>=1.12
  Using cached cffi-1.15.1-cp310-cp310-linux_armv7l.whl
Collecting sniffio
  Using cached https://www.piwheels.org/simple/sniffio/sniffio-1.3.0-py3-none-any.whl (10 kB)
Collecting rfc3986[idna2008]<2,>=1.3
  Using cached https://www.piwheels.org/simple/rfc3986/rfc3986-1.5.0-py2.py3-none-any.whl (31 kB)
Collecting httpcore<0.17.0,>=0.15.0
  Using cached https://www.piwheels.org/simple/httpcore/httpcore-0.16.3-py3-none-any.whl (69 kB)
Collecting MarkupSafe>=2.0
  Downloading https://mirrors.aliyun.com/pypi/packages/95/7e/68018b70268fb4a2a605e2be44ab7b4dd7ce7808adae6c5ef32e34f4b55a/MarkupSafe-2.1.2.tar.gz (19 kB)
  Preparing metadata (setup.py) ... done
Collecting text-unidecode>=1.3
  Using cached https://www.piwheels.org/simple/text-unidecode/text_unidecode-1.3-py2.py3-none-any.whl (78 kB)
Collecting idna<4,>=2.5
  Using cached https://www.piwheels.org/simple/idna/idna-3.4-py3-none-any.whl (61 kB)
Collecting urllib3<1.27,>=1.21.1
  Using cached https://www.piwheels.org/simple/urllib3/urllib3-1.26.14-py2.py3-none-any.whl (140 kB)
Collecting pycparser
  Using cached https://www.piwheels.org/simple/pycparser/pycparser-2.21-py2.py3-none-any.whl (119 kB)
Collecting h11<0.15,>=0.13
  Using cached https://www.piwheels.org/simple/h11/h11-0.14.0-py3-none-any.whl (58 kB)
Collecting anyio<5.0,>=3.0
  Using cached https://www.piwheels.org/simple/anyio/anyio-3.6.2-py3-none-any.whl (80 kB)
Building wheels for collected packages: aiohttp, bcrypt, ciso8601, cryptography, home-assistant-bluetooth, lru-dict, pyyaml, yarl, frozenlist, MarkupSafe, multidict
  Building wheel for aiohttp (pyproject.toml) ... done
  Created wheel for aiohttp: filename=aiohttp-3.8.1-cp310-cp310-linux_armv7l.whl size=1225630 sha256=d012050fb8ac6acb15139a6c203e26c3490045f4788d5dc5e75e0bc8502ec364
  Stored in directory: /home/homeassistant20230201/.cache/pip/wheels/cb/5a/6c/529caec1abd2563d32217e76a29ed9e8dc50f7da70df034274
  Building wheel for bcrypt (pyproject.toml) ... done
  Created wheel for bcrypt: filename=bcrypt-4.0.1-cp310-cp310-linux_armv7l.whl size=608818 sha256=778640cdac9621ca0919f9843ecfe38966d9d746a5cfd75f915b23a2a76917da
  Stored in directory: /home/homeassistant20230201/.cache/pip/wheels/21/8a/d7/aaf44a92fd21aee7c5080a05cff208552191be42c08f06fe98
  Building wheel for ciso8601 (pyproject.toml) ... done
  Created wheel for ciso8601: filename=ciso8601-2.3.0-cp310-cp310-linux_armv7l.whl size=36445 sha256=c888e2e0b97d2973552596de9c27e128cc0203ff820597b4830831dc2defc63e
  Stored in directory: /home/homeassistant20230201/.cache/pip/wheels/bd/32/e0/164d36b44e7f96c8f02bbafcfb85a437af266fadca72b06ea7
  Building wheel for cryptography (pyproject.toml) ... done
  Created wheel for cryptography: filename=cryptography-39.0.0-cp310-cp310-linux_armv7l.whl size=2083082 sha256=33e6c25974df4b054ee3c42a75f0427cb2fe80fbf5ecf17701b2373c8b27ae29
  Stored in directory: /home/homeassistant20230201/.cache/pip/wheels/ea/ce/58/36427736ccf75f05ae4845861bbdde5ec8e2e9be5c3312c6a1
  Building wheel for home-assistant-bluetooth (pyproject.toml) ... done
  Created wheel for home-assistant-bluetooth: filename=home_assistant_bluetooth-1.9.2-cp310-cp310-manylinux_2_31_armv7l.whl size=9884 sha256=22d42563bfc6ece55318c719873a72c5afb9eaeef1ae2f5a39784b1379832033
  Stored in directory: /home/homeassistant20230201/.cache/pip/wheels/ba/d0/47/430b8f853207645481600059ab31c11f06edb89633f729baf9
  Building wheel for lru-dict (setup.py) ... done
  Created wheel for lru-dict: filename=lru_dict-1.1.8-cp310-cp310-linux_armv7l.whl size=26644 sha256=23e69983d4e5455399bb6d5c66a82da16783ec4cedc9ae3f5e5f569a20a53673
  Stored in directory: /home/homeassistant20230201/.cache/pip/wheels/4b/51/42/8bb1be75ffa09ff1a11394d8e5426a7298711b73d2d42fe328
  Building wheel for pyyaml (pyproject.toml) ... done
  Created wheel for pyyaml: filename=PyYAML-6.0-cp310-cp310-linux_armv7l.whl size=45331 sha256=0c81ad427be39cbe51d76176278f959e4e1b9ce11a8088f9f3d257b32db7fd74
  Stored in directory: /home/homeassistant20230201/.cache/pip/wheels/e8/fc/04/5ed443c36b05be73a7d90fbe7f74b41d92eb42e9a5601860dc
  Building wheel for yarl (pyproject.toml) ... done
  Created wheel for yarl: filename=yarl-1.8.1-cp310-cp310-linux_armv7l.whl size=248465 sha256=596306402894170281b1055cb58328038705be023f14810b289eabcb0b5cc20f
  Stored in directory: /home/homeassistant20230201/.cache/pip/wheels/c9/36/08/a6b688fbab70eaf6bcbdd3513797b322bd527098403a4b7415
  Building wheel for frozenlist (pyproject.toml) ... done
  Created wheel for frozenlist: filename=frozenlist-1.3.3-cp310-cp310-linux_armv7l.whl size=141369 sha256=0a505027e423ad2852321bd04cdd7c4479590b120ada4d98d4efda07700b5090
  Stored in directory: /home/homeassistant20230201/.cache/pip/wheels/62/df/4b/7b0e287b9ba527eb5f37ce0b07d25e7991a6225aaec7dc0c9c
  Building wheel for MarkupSafe (setup.py) ... done
  Created wheel for MarkupSafe: filename=MarkupSafe-2.1.2-cp310-cp310-linux_armv7l.whl size=24895 sha256=23ebf5a5f99f809c825a994701e60ed33190f866cab5700d6eb8352932f43535
  Stored in directory: /home/homeassistant20230201/.cache/pip/wheels/d7/5b/52/824f58e790814272955d414531f0d19841beec8acc436ec81a
  Building wheel for multidict (pyproject.toml) ... done
  Created wheel for multidict: filename=multidict-6.0.4-cp310-cp310-linux_armv7l.whl size=108456 sha256=8e54bee79fa0fa0154e7e2f3d03599bc8b6022e7237d89a8ba8a417883dd2e43
  Stored in directory: /home/homeassistant20230201/.cache/pip/wheels/84/89/57/9fdebb526f075d13263c5b18728f07d541de30bee71e056313
Successfully built aiohttp bcrypt ciso8601 cryptography home-assistant-bluetooth lru-dict pyyaml yarl frozenlist MarkupSafe multidict
Installing collected packages: voluptuous, text-unidecode, rfc3986, pytz, lru-dict, ifaddr, ciso8601, voluptuous-serialize, urllib3, typing-extensions, sniffio, pyyaml, python-slugify, PyJWT, pycparser, orjson, multidict, MarkupSafe, idna, home-assistant-bluetooth, h11, frozenlist, charset-normalizer, certifi, bcrypt, awesomeversion, attrs, atomicwrites-homeassistant, async-timeout, astral, yarl, requests, jinja2, cffi, anyio, aiosignal, httpcore, cryptography, aiohttp, pyOpenSSL, httpx, homeassistant
Successfully installed MarkupSafe-2.1.2 PyJWT-2.5.0 aiohttp-3.8.1 aiosignal-1.3.1 anyio-3.6.2 astral-2.2 async-timeout-4.0.2 atomicwrites-homeassistant-1.4.1 attrs-22.2.0 awesomeversion-22.9.0 bcrypt-4.0.1 certifi-2022.12.7 cffi-1.15.1 charset-normalizer-2.1.1 ciso8601-2.3.0 cryptography-39.0.0 frozenlist-1.3.3 h11-0.14.0 home-assistant-bluetooth-1.9.2 homeassistant-2023.2.1 httpcore-0.16.3 httpx-0.23.3 idna-3.4 ifaddr-0.1.7 jinja2-3.1.2 lru-dict-1.1.8 multidict-6.0.4 orjson-3.8.5 pyOpenSSL-23.0.0 pycparser-2.21 python-slugify-4.0.1 pytz-2022.7.1 pyyaml-6.0 requests-2.28.1 rfc3986-1.5.0 sniffio-1.3.0 text-unidecode-1.3 typing-extensions-4.4.0 urllib3-1.26.14 voluptuous-0.13.1 voluptuous-serialize-2.5.0 yarl-1.8.1

[notice] A new release of pip available: 22.3.1 -> 23.0
[notice] To update, run: pip install --upgrade pip

Change the title please, add something like „in a Python vEnv“.

Otherwise I’d tend to post a one-liner using Docker …

Of course, the correct approach is to just follow the documentation. If it’s outdated or wrong (eg missing the requirement for cargo) then submit an update using the links at the bottom of that page.

1 Like

Troubleshooting installation problems

first-install fails

error: Rust 1.48.0 does not match extension requirement >=1.56.0

Reason

I believe it was related to cryptography and a minimum required rust version

Solution

Building cryptography requires having a working Rust toolchain. The current minimum supported Rust version is 1.48.0. This is newer than the Rust some package managers ship , so users may need to install with the instructions below.


(homeassistant20230201) homeassistant20230201@raspberrypi:/srv/homeassistant20230201 $ curl https://sh.rustup.rs -sSf | sh
info: downloading installer
warning: it looks like you have an existing installation of Rust at:
warning: /usr/bin
warning: rustup should not be installed alongside Rust. Please uninstall your existing Rust first.
warning: Otherwise you may have confusion unless you are careful with your PATH
warning: If you are sure that you want both rustup and your already installed Rust
warning: then please reply `y' or `yes' or set RUSTUP_INIT_SKIP_PATH_CHECK to yes
warning: or pass `-y' to ignore all ignorable checks.
error: cannot install while Rust is installed

uninstall your existing Rust

sudo apt remove rustc

output


root@raspberrypi:~# sudo apt remove rustc
正在读取软件包列表... 完成
正在分析软件包的依赖关系树... 完成
正在读取状态信息... 完成                 
下列软件包是自动安装的并且现在不需要了:
  libgit2-1.1 libhttp-parser2.9 libmbedcrypto3 libmbedtls12 libmbedx509-0 libstd-rust-1.48 libstd-rust-dev rust-gdb
使用'sudo apt autoremove'来卸载它(它们)。
下列软件包将被【卸载】:
  cargo rustc
升级了 0 个软件包,新安装了 0 个软件包,要卸载 2 个软件包,有 11 个软件包未被升级。
解压缩后将会空出 13.6 MB 的空间。
您希望继续执行吗? [Y/n] y
(正在读取数据库 ... 系统当前共安装有 174104 个文件和目录。)
正在卸载 cargo (0.47.0-3) ...
正在卸载 rustc (1.48.0+dfsg1-1+rpi1) ...
正在处理用于 man-db (2.9.4-2) 的触发器 ...

re-install with

curl https://sh.rustup.rs -sSf | sh

output

(homeassistant20230201) homeassistant20230201@raspberrypi:/srv/homeassistant20230201 $ curl https://sh.rustup.rs -sSf | sh
info: downloading installer

Welcome to Rust!

This will download and install the official compiler for the Rust
programming language, and its package manager, Cargo.

Rustup metadata and toolchains will be installed into the Rustup
home directory, located at:

  /home/homeassistant20230201/.rustup

This can be modified with the RUSTUP_HOME environment variable.

The Cargo home directory is located at:

  /home/homeassistant20230201/.cargo

This can be modified with the CARGO_HOME environment variable.

The cargo, rustc, rustup and other commands will be added to
Cargo's bin directory, located at:

  /home/homeassistant20230201/.cargo/bin

This path will then be added to your PATH environment variable by
modifying the profile files located at:

  /home/homeassistant20230201/.profile
  /home/homeassistant20230201/.bashrc

You can uninstall at any time with rustup self uninstall and
these changes will be reverted.

Current installation options:


   default host triple: armv7-unknown-linux-gnueabihf
     default toolchain: stable (default)
               profile: default
  modify PATH variable: yes

1) Proceed with installation (default)
2) Customize installation
3) Cancel installation
>1

info: profile set to 'default'
info: default host triple is armv7-unknown-linux-gnueabihf
warning: Updating existing toolchain, profile choice will be ignored
info: syncing channel updates for 'stable-armv7-unknown-linux-gnueabihf'
info: default toolchain set to 'stable-armv7-unknown-linux-gnueabihf'

  stable-armv7-unknown-linux-gnueabihf unchanged - rustc 1.67.0 (fc594f156 2023-01-24)


Rust is installed now. Great!

To get started you may need to restart your current shell.
This would reload your PATH environment variable to include
Cargo's bin directory ($HOME/.cargo/bin).

To configure your current shell, run:
source "$HOME/.cargo/env"

restart your current shell

sudo -u homeassistant20230201 -H -s
cd /srv/homeassistant20230201

source bin/activate

useful links
Error: Failed building wheel for cryptography

second install

root@raspberrypi:~# sudo -u homeassistant20230201 -H -s
homeassistant20230201@raspberrypi:/root $ cd /srv/homeassistant20230201
homeassistant20230201@raspberrypi:/srv/homeassistant20230201 $ source bin/activate
(homeassistant20230201) homeassistant20230201@raspberrypi:/srv/homeassistant20230201 $ pip3 install homeassistant==2023.2.1

output

Looking in indexes: https://pypi.org/simple, https://www.piwheels.org/simple
Requirement already satisfied: homeassistant==2023.2.1 in ./lib/python3.10/site-packages (2023.2.1)
Requirement already satisfied: yarl==1.8.1 in ./lib/python3.10/site-packages (from homeassistant==2023.2.1) (1.8.1)
Requirement already satisfied: ifaddr==0.1.7 in ./lib/python3.10/site-packages (from homeassistant==2023.2.1) (0.1.7)
Requirement already satisfied: cryptography==39.0.0 in ./lib/python3.10/site-packages (from homeassistant==2023.2.1) (39.0.0)
Requirement already satisfied: async-timeout==4.0.2 in ./lib/python3.10/site-packages (from homeassistant==2023.2.1) (4.0.2)
Requirement already satisfied: atomicwrites-homeassistant==1.4.1 in ./lib/python3.10/site-packages (from homeassistant==2023.2.1) (1.4.1)
Requirement already satisfied: python-slugify==4.0.1 in ./lib/python3.10/site-packages (from homeassistant==2023.2.1) (4.0.1)
Requirement already satisfied: voluptuous-serialize==2.5.0 in ./lib/python3.10/site-packages (from homeassistant==2023.2.1) (2.5.0)
Requirement already satisfied: certifi>=2021.5.30 in ./lib/python3.10/site-packages (from homeassistant==2023.2.1) (2022.12.7)
Requirement already satisfied: PyJWT==2.5.0 in ./lib/python3.10/site-packages (from homeassistant==2023.2.1) (2.5.0)
Requirement already satisfied: jinja2==3.1.2 in ./lib/python3.10/site-packages (from homeassistant==2023.2.1) (3.1.2)
Requirement already satisfied: aiohttp==3.8.1 in ./lib/python3.10/site-packages (from homeassistant==2023.2.1) (3.8.1)
Requirement already satisfied: awesomeversion==22.9.0 in ./lib/python3.10/site-packages (from homeassistant==2023.2.1) (22.9.0)
Requirement already satisfied: pyOpenSSL==23.0.0 in ./lib/python3.10/site-packages (from homeassistant==2023.2.1) (23.0.0)
Requirement already satisfied: attrs==22.2.0 in ./lib/python3.10/site-packages (from homeassistant==2023.2.1) (22.2.0)
Requirement already satisfied: httpx==0.23.3 in ./lib/python3.10/site-packages (from homeassistant==2023.2.1) (0.23.3)
Requirement already satisfied: home-assistant-bluetooth==1.9.2 in ./lib/python3.10/site-packages (from homeassistant==2023.2.1) (1.9.2)
Requirement already satisfied: pip<22.4,>=21.0 in ./lib/python3.10/site-packages (from homeassistant==2023.2.1) (22.3.1)
Requirement already satisfied: astral==2.2 in ./lib/python3.10/site-packages (from homeassistant==2023.2.1) (2.2)
Requirement already satisfied: requests==2.28.1 in ./lib/python3.10/site-packages (from homeassistant==2023.2.1) (2.28.1)
Requirement already satisfied: voluptuous==0.13.1 in ./lib/python3.10/site-packages (from homeassistant==2023.2.1) (0.13.1)
Requirement already satisfied: bcrypt==4.0.1 in ./lib/python3.10/site-packages (from homeassistant==2023.2.1) (4.0.1)
Requirement already satisfied: orjson==3.8.5 in ./lib/python3.10/site-packages (from homeassistant==2023.2.1) (3.8.5)
Requirement already satisfied: pyyaml==6.0 in ./lib/python3.10/site-packages (from homeassistant==2023.2.1) (6.0)
Requirement already satisfied: lru-dict==1.1.8 in ./lib/python3.10/site-packages (from homeassistant==2023.2.1) (1.1.8)
Requirement already satisfied: typing-extensions<5.0,>=4.4.0 in ./lib/python3.10/site-packages (from homeassistant==2023.2.1) (4.4.0)
Requirement already satisfied: ciso8601==2.3.0 in ./lib/python3.10/site-packages (from homeassistant==2023.2.1) (2.3.0)
Requirement already satisfied: aiosignal>=1.1.2 in ./lib/python3.10/site-packages (from aiohttp==3.8.1->homeassistant==2023.2.1) (1.3.1)
Requirement already satisfied: frozenlist>=1.1.1 in ./lib/python3.10/site-packages (from aiohttp==3.8.1->homeassistant==2023.2.1) (1.3.3)
Requirement already satisfied: multidict<7.0,>=4.5 in ./lib/python3.10/site-packages (from aiohttp==3.8.1->homeassistant==2023.2.1) (6.0.4)
Requirement already satisfied: charset-normalizer<3.0,>=2.0 in ./lib/python3.10/site-packages (from aiohttp==3.8.1->homeassistant==2023.2.1) (2.1.1)
Requirement already satisfied: pytz in ./lib/python3.10/site-packages (from astral==2.2->homeassistant==2023.2.1) (2022.7.1)
Requirement already satisfied: cffi>=1.12 in ./lib/python3.10/site-packages (from cryptography==39.0.0->homeassistant==2023.2.1) (1.15.1)
Requirement already satisfied: rfc3986[idna2008]<2,>=1.3 in ./lib/python3.10/site-packages (from httpx==0.23.3->homeassistant==2023.2.1) (1.5.0)
Requirement already satisfied: sniffio in ./lib/python3.10/site-packages (from httpx==0.23.3->homeassistant==2023.2.1) (1.3.0)
Requirement already satisfied: httpcore<0.17.0,>=0.15.0 in ./lib/python3.10/site-packages (from httpx==0.23.3->homeassistant==2023.2.1) (0.16.3)
Requirement already satisfied: MarkupSafe>=2.0 in ./lib/python3.10/site-packages (from jinja2==3.1.2->homeassistant==2023.2.1) (2.1.2)
Requirement already satisfied: text-unidecode>=1.3 in ./lib/python3.10/site-packages (from python-slugify==4.0.1->homeassistant==2023.2.1) (1.3)
Requirement already satisfied: urllib3<1.27,>=1.21.1 in ./lib/python3.10/site-packages (from requests==2.28.1->homeassistant==2023.2.1) (1.26.14)
Requirement already satisfied: idna<4,>=2.5 in ./lib/python3.10/site-packages (from requests==2.28.1->homeassistant==2023.2.1) (3.4)
Requirement already satisfied: pycparser in ./lib/python3.10/site-packages (from cffi>=1.12->cryptography==39.0.0->homeassistant==2023.2.1) (2.21)
Requirement already satisfied: h11<0.15,>=0.13 in ./lib/python3.10/site-packages (from httpcore<0.17.0,>=0.15.0->httpx==0.23.3->homeassistant==2023.2.1) (0.14.0)
Requirement already satisfied: anyio<5.0,>=3.0 in ./lib/python3.10/site-packages (from httpcore<0.17.0,>=0.15.0->httpx==0.23.3->homeassistant==2023.2.1) (3.6.2)

[notice] A new release of pip available: 22.3.1 -> 23.0
[notice] To update, run: pip install --upgrade pip

run ok

First-run setup fails

Unfortunately I get some errors during startup which ends up in not workung integrations

hass -v

output

Installation pillow hass-nabucasa etc  fails

Solution

installed manually

Attempting install of pillow==9.4.0

(homeassistant20230201) homeassistant20230201@raspberrypi:/srv/homeassistant20230201 $ pip install pillow==9.4.0 -i https://pypi.tuna.tsinghua.edu.cn/simple

Pillow supports these Python versions.
https://pillow.readthedocs.io/en/latest/installation.html

Attempting install of hass-nabucasa==0.61.0

(homeassistant20230201) homeassistant20230201@raspberrypi:/srv/homeassistant20230201 $ pip install hass-nabucasa==0.61.0 -i https://pypi.tuna.tsinghua.edu.cn/simple

pip install home-assistant-frontend==20230202.0  -i https://pypi.tuna.tsinghua.edu.cn/simple

pip install PyNaCl==1.5.0  -i https://pypi.tuna.tsinghua.edu.cn/simple



Unable to install package home-assistant-frontend==20190626.0

https://github.com/home-assistant/core/issues/24968

No module named '_sqlite3

SQLite is a C library that implements an SQL database engine. Programs that link with the SQLite library can have SQL database access without running a separate RDBMS process.

1.sqlite3 is built into Python’s standard library (sqlite3 — DB-API 2.0 interface for SQLite databases — Python 3.11.4 documentation), you should not try to install it using pip.

If you had used the standard version of Python you would not have this problem.The standard Python version is 3.9.2

2.If import sqlite3 does not work either, it means you’ve compiled Python without SQLite support, and you need to build it again after installing the libsqlite3-dev package.

python3
root@raspberrypi:~# python3

>>> import sys
>>> sys.path
['', '/usr/local/lib/python310.zip', '/usr/local/lib/python3.10', '/usr/local/lib/python3.10/lib-dynload', '/usr/local/lib/python3.10/site-packages']
>>> import sqlite3
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/usr/local/lib/python3.10/sqlite3/__init__.py", line 57, in <module>
    from sqlite3.dbapi2 import *
  File "/usr/local/lib/python3.10/sqlite3/dbapi2.py", line 27, in <module>
    from _sqlite3 import *
ModuleNotFoundError: No module named '_sqlite3'
>>> 

Solution

  1. Install SQL Lite by:
sudo systemctl stop [email protected]
wget https://sqlite.org/2021/sqlite-autoconf-3360000.tar.gz
tar -xvf sqlite-autoconf-3360000.tar.gz
./configure
make
sudo make install

2 . Install Python-3.10.9 by:

root@raspberrypi:# cd Python-3.10.9

edit setup.py

root@raspberrypi:~/Python-3.10.9# vi setup.py

old

def detect_sqlite(self):
        # The sqlite interface
        sqlite_setup_debug = False   # verbose debug prints from this script?

        # We hunt for #define SQLITE_VERSION "n.n.n"
        sqlite_incdir = sqlite_libdir = None
        sqlite_inc_paths = [ '/usr/include',
                             '/usr/include/sqlite',
                             '/usr/include/sqlite3',

find " sqlite_inc_paths" add

'/usr/local/sqlite/include'
'/usr/local/sqlite/include/sqlite3'

as follow:

       sqlite_incdir = sqlite_libdir = None
        sqlite_inc_paths = [ '/usr/include',
                             '/usr/include/sqlite',
                             '/usr/include/sqlite3',
                             '/usr/local/include',
                             '/usr/local/include/sqlite',
                             '/usr/local/include/sqlite3',
                             '/usr/local/sqlite/include',
                             '/usr/local/sqlite/include/sqlite3',
                             ]

save & exit

upgrade Python as follow:

root@raspberrypi:~/Python-3.10.9#  ./configure --enable-loadable-sqlite-extensions
root@raspberrypi:~/Python-3.10.9# make -j 4
root@raspberrypi:~/Python-3.10.9# sudo make install

checklist

python3
>>> import sys
>>> sys.path
['', '/usr/local/lib/python310.zip', '/usr/local/lib/python3.10', '/usr/local/lib/python3.10/lib-dynload', '/usr/local/lib/python3.10/site-packages']
>>> import sqlite3
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/usr/local/lib/python3.10/sqlite3/__init__.py", line 57, in <module>
    from sqlite3.dbapi2 import *
  File "/usr/local/lib/python3.10/sqlite3/dbapi2.py", line 27, in <module>
    from _sqlite3 import *
ModuleNotFoundError: No module named '_sqlite3'
>>> import sqlite3

ok

useful links

https://community.home-assistant.io/t/raspberrypi-ha-core-version-3-27-2-of-sqlite-is-not-supported/352858/2?u=msly

https://community.home-assistant.io/t/raspberrypi-ha-core-version-3-27-2-of-sqlite-is-not-supported/352858

When you compiled Python you did so with some required system libraries missing.

Install home assistant core 2023.2.2 on debian 11 updated:20230206

run ok

#step 1.Install SQLite3
sudo systemctl stop [email protected]
wget https://sqlite.org/2021/sqlite-autoconf-3360000.tar.gz
tar -xvf sqlite-autoconf-3360000.tar.gz
./configure
make
sudo make install

#step 2.Install Python-3.10.9 with enable-loadable-sqlite-extensions
root@raspberrypi:# cd Python-3.10.9
edit setup.py

root@raspberrypi:~/Python-3.10.9# vi setup.py
find " sqlite_inc_paths" add

'/usr/local/sqlite/include'
'/usr/local/sqlite/include/sqlite3'
as follow:

       sqlite_incdir = sqlite_libdir = None
        sqlite_inc_paths = [ '/usr/include',
                             '/usr/include/sqlite',
                             '/usr/include/sqlite3',
                             '/usr/local/include',
                             '/usr/local/include/sqlite',
                             '/usr/local/include/sqlite3',
                             '/usr/local/sqlite/include',
                             '/usr/local/sqlite/include/sqlite3',
                             ]
save & exit

upgrade Python as follow:

root@raspberrypi:~/Python-3.10.9#  ./configure --enable-loadable-sqlite-extensions
root@raspberrypi:~/Python-3.10.9# make -j 4
root@raspberrypi:~/Python-3.10.9# sudo make install


#Stop the Homeassistant service for free port 8123
sudo systemctl stop home-assistant@homeassistant

#step 3.edit`/etc/pip.conf`
[global]
index-url=https://mirrors.aliyun.com/pypi/simple
extra-index-url=https://www.piwheels.org/simple

#step 4.Create and change to a virtual environment
# Create and change to a virtual environment
sudo useradd -rm homeassistant20230202 -G dialout,gpio,i2c

#create a directory for the installation of Home Assistant Core
sudo mkdir /srv/homeassistant20230202

#change the owner to the homeassistant20230202 account
sudo chown homeassistant20230202:homeassistant20230202 /srv/homeassistant20230202
# become homeassistant user
sudo -u homeassistant20230202 -H -s
#  cd into your new created directory
cd /srv/homeassistant20230202
# create your new virtual environmet in the current folder
python3.10 -m venv .
# activate the new viltual environment
source bin/activate

#(in a virtual environment)

# install necesary python module and homeassistant
python3 -m pip install wheel

#Install Rust 1.56.0
sudo apt remove rustc
curl https://sh.rustup.rs -sSf | sh

#Restart your current shell
sudo -u homeassistant20230202 -H -s
cd /srv/homeassistant20230202
source bin/activate

pip3 install homeassistant==2023.2.2  

# exit the virtual environment and
# start home assistant and check logs for errors
deactivate
sudo service hass start
# check logs

Not related to your issues but this is not a good idea to put the version in the directory name.
Except if you plan to do a new one on each release.
Expect a new release 2023.2.3 to be available within a week probably.

Either you’ll upgrade your existing version and the directory will not reflect the version inside it:

cd /srv/homeassistant20230202
source bin/activate
pip3 install -U homeassistant

Or you’ll create a new directory, new venv, new everything and you’ll face all the issues that you’re having today, again.

3 Likes

Hello,
I am trying to install HomeAssistant on my Raspberry Pi 3 model B, following manual Raspberry Pi - Home Assistant

On my Raspberry Pi 3 I am using newest “OS image Raspberry Pi OS with desktop and recommended software” Exactly this one.

I managed to solved all problems related to HA installation (Python 3.10 compilation with ssl, Rust, etc) and installation finally ends with success.

Howevere last step from manual Start Home Assistant Core for the first time
hass
does not take “5 to 10 minutes”… It takes long hours!

After few hours of waiting, I tried several times to clearly install HA. I tried two versions: 2023.2.2 and 2023.2.1 versions, I even made new totally clean instllation of Raspberry OS - all the time the same problem - running hass never ends.
At the moment I am on another try and currently it stuck on “homeassistant.setup”:

2023-02-07 01:34:13.276 WARNING (MainThread) [homeassistant.bootstrap] Waiting on integrations to complete setup: analytics
2023-02-07 01:38:40.927 WARNING (MainThread) [homeassistant.bootstrap] Waiting on integrations to complete setup: ssdp
2023-02-07 01:40:06.385 WARNING (MainThread) [homeassistant.bootstrap] Waiting on integrations to complete setup: bluetooth
2023-02-07 02:00:08.441 WARNING (MainThread) [homeassistant.bootstrap] Waiting on integrations to complete setup: cloud
2023-02-07 02:10:50.368 WARNING (MainThread) [homeassistant.bootstrap] Waiting on integrations to complete setup: mobile_app
2023-02-07 02:11:00.467 WARNING (MainThread) [homeassistant.setup] Setup of default_config is taking over 10 seconds.

Now it is 9:06, so we are on this step for almost 7 hours.
The only files changed during this time are:

pi@raspberrypi:/home/homeassistant $ find /home/homeassistant/ -type f  -mmin -400
/home/homeassistant/.homeassistant/home-assistant_v2.db
/home/homeassistant/.homeassistant/home-assistant_v2.db-wal
/home/homeassistant/.homeassistant/home-assistant_v2.db-shm
pi@raspberrypi:/home/homeassistant $ ls .homeassistant/home-assistant_v2.db* -Al
-rw-r--r-- 1 homeassistant homeassistant  180224 Feb  7 05:12 .homeassistant/home-assistant_v2.db
-rw-r--r-- 1 homeassistant homeassistant   32768 Feb  7 09:00 .homeassistant/home-assistant_v2.db-shm
-rw-r--r-- 1 homeassistant homeassistant 2954072 Feb  7 09:00 .homeassistant/home-assistant_v2.db-wal

It seems only db is built during this time, and it grows from time to time for a few kilobytes.

Anyone had such problem? Does it appear only on Raspberry Pi, or also on other platforms? Anyone has a solution for this? Finally: how log should I wait? Now it is 7 hours, the longest for me at the moment.

Honestly… I’d recommend using Docker.

Your startup is long/slow because there’s no wheels for your platform, and in another year you’ll have to build Python 3.11 from source and re-create the venv.

Oh, and if you type hass it won’t “end”, that’s you running Home Assistant (manually rather than from systemd). Now you need to connect to the web UI as covered in the getting started guide.

Oh, and if you type hass it won’t “end”, that’s you running Home Assistant (manually rather than from systemd). Now you need to connect to the web UI as covered in the getting started guide.


I don’t know how it happens. For sure I was checking http://homeassistant.local:8123 (which was not registered). That time I thought hass did not finish yet. But it seems, I didn’t check other aliases.

Indeed there is a service started on 8123 port, and indeed there is web interface available on localhost:8123.
Thank you so much! So let’s go for Getting Started now! :slight_smile:

homeassistant.local requires that mDNS is configured and that the host is called homeassitant, which it probably isn’t.

This guide covers the use of systemd to auto-start HA.

I’m about to start a clean install of HA with a python 3.10 upgrade.
Is this post saying that the Official Core Installation Guide needs updating?

reboot & reinstall it

no,I had an install of HA core 2022.11.2. I have decided to make a fresh install and restored my back up