2024年5月15日 5:01:15

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

1 年 前
#20208 引用
Installing Home Assistant Core 2023.2.2 on Raspberry Pi 3B+ step by step

https://community.home-assistant.io/t/upgrading-homeassistant-core-in-a-python-ve/420027

前言

我不能确保新版本是否能成功安装和成功运行,为了不影响现有系统的运行,我决定先全新安装一次。待所有的问题都解决后,再对现有的系统进行升级。这篇为安装过程中遇到的问题和解决办法。花了我好几天时间,供同行参考。
0
1 年 前
#20209 引用
Prerequisites

Install Python 3.10 (including the package python3-dev) or newer.
Create and change to a virtual environment  for Home Assistant Core


Install a required Python package((in a virtual environment!))

Install Home Assistant Core




树莓派的pip源在`/etc/pip.conf`

[global]
index-url=https://mirrors.aliyun.com/pypi/simple
extra-index-url=https://www.piwheels.org/simple



0
1 年 前
#20210 引用
Create and change to a virtual environment  for Home Assistant Core

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



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



In fact as follow:

root@raspberrypi:~/Python-3.10.9# sudo useradd -rm homeassistant20230202 -G dialout,gpio,i2c

root@raspberrypi:~/Python-3.10.9# sudo mkdir /srv/homeassistant20230202
root@raspberrypi:~/Python-3.10.9# sudo chown homeassistant20230202:homeassistant20230202 /srv/homeassistant20230202
root@raspberrypi:~/Python-3.10.9# sudo -u homeassistant20230202 -H -s
homeassistant20230202@raspberrypi:/root/Python-3.10.9 $ cd /srv/homeassistant20230202
homeassistant20230202@raspberrypi:/srv/homeassistant20230202 $ python3.10 -m venv .
homeassistant20230202@raspberrypi:/srv/homeassistant20230202 $ source bin/activate
(homeassistant20230202) homeassistant20230202@raspberrypi:/srv/homeassistant20230202 $

python3 -m pip install wheel

#(not in a virtual environment)
sudo apt remove rustc

#( in a virtual environment)

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



0
1 年 前
#20211 引用
Install a required Python package -  upgrade pip

If you are using Linux, then you should upgrade pip (in a virtual environment!)

pip3 --version
pip 22.3.1 from /srv/homeassistant20230200/lib/python3.10/site-packages/pip (python 3.10)

pip install --upgrade pip



(homeassistant20230200) homeassistant20230200@raspberrypi:/srv/homeassistant20230200 $ pip3 --version 
pip 23.0 from /srv/homeassistant20230200/lib/python3.10/site-packages/pip (python 3.10)
0
1 年 前
#20212 引用
Install a required Python package - install wheel

(homeassistant20230200) homeassistant20230200@raspberrypi:/srv/homeassistant20230200 $ which wheel
(homeassistant20230200) homeassistant20230200@raspberrypi:/srv/homeassistant20230200 $ wheel version
bash: wheel:未找到命令


 python3 -m pip install wheel



(homeassistant20230200) homeassistant20230200@raspberrypi:/srv/homeassistant20230200 $ which wheel
/srv/homeassistant20230200/bin/wheel
(homeassistant20230200) homeassistant20230200@raspberrypi:/srv/homeassistant20230200 $ wheel version
wheel 0.38.4
0
1 年 前
#20213 引用



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





(homeassistant20230201) homeassistant20230201@raspberrypi:/srv/homeassistant20230201 $ pip3 install homeassistant==2023.2.1
Looking in indexes: https://pypi.org/simple, https://www.piwheels.org/simple
Collecting homeassistant==2023.2.1
  WARNING: Retrying (Retry(total=4, connect=None, read=None, redirect=None, status=None)) after connection broken by 'ReadTimeoutError("HTTPSConnectionPool(host='files.pythonhosted.org', port=443): Read timed out. (read timeout=15)")': /packages/19/91/17283c16691b53e7cdcd48faaa9a12b7c96c26cc4c26d2017818a2e68ad4/homeassistant-2023.2.1-py3-none-any.whl
  Downloading homeassistant-2023.2.1-py3-none-any.whl (21.7 MB)

0
1 年 前
#20214 引用
ERROR: Failed building wheel for cryptography

Failed to build bcrypt cryptography
ERROR: Could not build wheels for bcrypt, cryptography, which is required to install pyproject.toml-based projects




pip3 install cryptography   

(in a virtual environment!)

- cryptography==39.0.0



(homeassistant20230201) homeassistant20230201@raspberrypi:/srv/homeassistant20230201 $ pip3 install cryptography  
Looking in indexes: https://pypi.org/simple, https://www.piwheels.org/simple
Collecting cryptography
  Using cached cryptography-39.0.0.tar.gz (603 kB)
  Installing build dependencies ... done
  Getting requirements to build wheel ... done
  Preparing metadata (pyproject.toml) ... done
Collecting cffi>=1.12
  Using cached cffi-1.15.1-cp310-cp310-linux_armv7l.whl
Collecting pycparser
  Using cached https://www.piwheels.org/simple/pycparser/pycparser-2.21-py2.py3-none-any.whl (119 kB)
Building wheels for collected packages: cryptography
  Building wheel for cryptography (pyproject.toml) ... done
  Created wheel for cryptography: filename=cryptography-39.0.0-cp310-cp310-linux_armv7l.whl size=2759556 sha256=4792a90780f756ce2b2bdd1579d18d90023bc55d80307bc58859714ebfdc7fe2
  Stored in directory: /home/homeassistant20230201/.cache/pip/wheels/b8/b4/9e/ace76bb7b85b406ccf121a1c38d14e266468f1967c7e979a79
Successfully built cryptography
Installing collected packages: pycparser, cffi, cryptography
Successfully installed cffi-1.15.1 cryptography-39.0.0 pycparser-2.21

[notice] A new release of pip available: 22.3.1 -> 23.0
[notice] To update, run: pip install --upgrade pip
(homeassistant20230201) homeassistant20230201@raspberrypi:/srv/homeassistant20230201 $




0
1 年 前
#20215 引用
1
0
1 年 前
#20216 引用
1
0
1 年 前
#20217 引用
error: Rust 1.48.0 does not match extension requirement >=1.56.0   ( in a virtual environment!)

install Rust

rust version 1.67.0


root@raspberrypi:~# curl https://sh.rustup.rs -sSf | sh
  ( in a virtual environment)



(homeassistant20230200) homeassistant20230200@raspberrypi:/srv/homeassistant20230200 $ 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

Continue? (y/N) y


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/homeassistant20230200/.rustup

This can be modified with the RUSTUP_HOME environment variable.

The Cargo home directory is located at:

  /home/homeassistant20230200/.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/homeassistant20230200/.cargo/bin

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

  /home/homeassistant20230200/.profile
  /home/homeassistant20230200/.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
info: syncing channel updates for 'stable-armv7-unknown-linux-gnueabihf'
info: latest update on 2023-01-26, rust version 1.67.0 (fc594f156 2023-01-24)



0