Problems installing homeassistant-2022.2.2 on Debian Linux 11 Bullseye 64

I am trying to install de last version of homeassistant on an updated Debian Linux 11 Bullseye 64 computer.

I edited the instructions <https://www.home-assistant.io/installation/linux#install-home-assistant-core> as follows:

sudo apt-get update
sudo apt-get upgrade -y
sudo apt-get install -y python3 python3-dev python3-venv python3-pip libffi-dev libssl-dev libjpeg-dev zlib1g-dev autoconf build-essential libopenjp2-7 libtiff5 libturbojpeg0 tzdata
sudo useradd -rm -d /opt/homeassistant --shell /bin/false homeassistant
cd /opt/homeassistant
python3.9 -m venv .
source bin/activate
python3 -m pip install wheel
pip3 install homeassistant
hass

hass reports the following errors and hangs.

(homeassistant) homeassistant@artio:~$ hass
Unable to find configuration. Creating default one in /opt/homeassistant/.homeassistant
2022-02-06 20:32:03 ERROR (MainThread) [homeassistant] Error doing job: Task exception was never retrieved
Traceback (most recent call last):
  File "/opt/homeassistant/lib/python3.9/site-packages/pkg_resources/__init__.py", line 3021, in _dep_map
    return self.__dep_map
  File "/opt/homeassistant/lib/python3.9/site-packages/pkg_resources/__init__.py", line 2815, in __getattr__
    raise AttributeError(attr)
AttributeError: _DistInfoDistribution__dep_map

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/opt/homeassistant/lib/python3.9/site-packages/pkg_resources/__init__.py", line 3012, in _parsed_pkg_info
    return self._pkg_info
  File "/opt/homeassistant/lib/python3.9/site-packages/pkg_resources/__init__.py", line 2815, in __getattr__
    raise AttributeError(attr)
AttributeError: _pkg_info

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/opt/homeassistant/lib/python3.9/site-packages/homeassistant/data_entry_flow.py", line 203, in async_init
    flow, result = await task
  File "/opt/homeassistant/lib/python3.9/site-packages/homeassistant/data_entry_flow.py", line 221, in _async_init
    flow = await self.async_create_flow(handler, context=context, data=data)
  File "/opt/homeassistant/lib/python3.9/site-packages/homeassistant/config_entries.py", line 730, in async_create_flow
    await async_process_deps_reqs(self.hass, self._hass_config, integration)
  File "/opt/homeassistant/lib/python3.9/site-packages/homeassistant/setup.py", line 351, in async_process_deps_reqs
    await requirements.async_get_integration_with_requirements(
  File "/opt/homeassistant/lib/python3.9/site-packages/homeassistant/requirements.py", line 83, in async_get_integration_with_requirements
    await _async_process_integration(hass, integration, done)
  File "/opt/homeassistant/lib/python3.9/site-packages/homeassistant/requirements.py", line 99, in _async_process_integration
    await async_process_requirements(
  File "/opt/homeassistant/lib/python3.9/site-packages/homeassistant/requirements.py", line 162, in async_process_requirements
    await _async_process_requirements(
  File "/opt/homeassistant/lib/python3.9/site-packages/homeassistant/requirements.py", line 182, in _async_process_requirements
    if pkg_util.is_installed(req):
  File "/opt/homeassistant/lib/python3.9/site-packages/homeassistant/util/package.py", line 38, in is_installed
    pkg_resources.get_distribution(package)
  File "/opt/homeassistant/lib/python3.9/site-packages/pkg_resources/__init__.py", line 481, in get_distribution
    dist = get_provider(dist)
  File "/opt/homeassistant/lib/python3.9/site-packages/pkg_resources/__init__.py", line 357, in get_provider
    return working_set.find(moduleOrReq) or require(str(moduleOrReq))[0]
  File "/opt/homeassistant/lib/python3.9/site-packages/pkg_resources/__init__.py", line 900, in require
    needed = self.resolve(parse_requirements(requirements))
  File "/opt/homeassistant/lib/python3.9/site-packages/pkg_resources/__init__.py", line 794, in resolve
    new_requirements = dist.requires(req.extras)[::-1]
  File "/opt/homeassistant/lib/python3.9/site-packages/pkg_resources/__init__.py", line 2736, in requires
    dm = self._dep_map
  File "/opt/homeassistant/lib/python3.9/site-packages/pkg_resources/__init__.py", line 3023, in _dep_map
    self.__dep_map = self._compute_dependencies()
  File "/opt/homeassistant/lib/python3.9/site-packages/pkg_resources/__init__.py", line 3032, in _compute_dependencies
    for req in self._parsed_pkg_info.get_all('Requires-Dist') or []:
  File "/opt/homeassistant/lib/python3.9/site-packages/pkg_resources/__init__.py", line 3014, in _parsed_pkg_info
    metadata = self.get_metadata(self.PKG_INFO)
  File "/opt/homeassistant/lib/python3.9/site-packages/pkg_resources/__init__.py", line 1420, in get_metadata
    value = self._get(path)
  File "/opt/homeassistant/lib/python3.9/site-packages/pkg_resources/__init__.py", line 1616, in _get
    with open(path, 'rb') as stream:
FileNotFoundError: [Errno 2] No such file or directory: '/opt/homeassistant/lib/python3.9/site-packages/multidict-6.0.2.dist-info/METADATA'
^C
(homeassistant) homeassistant@artio:~$

What is going on?

FileNotFoundError: [Errno 2] No such file or directory: '/opt/homeassistant/lib/python3.9/site-packages/multidict-6.0.2.dist-info/METADATA'

The directory ‘/opt/homeassistant/lib/python3.9/site-packages/multidict-6.0.2.dist-info/’ does not exist, ‘multidict-5.2.0.dist-info’ does.

Hi
python3 -V
respectively
pip3 -V
both show Python 3.9 as version?

Made the mistake here once, python3 and pip3 were aliases to an older version of python.

You also didn’t “sudo” to the “homeassistant”-user you just created
sudo -u homeassistant -H -s
That’s in the instructions for a core installation before you create the venv.

Armin