Unable to start Raspberry GPIO switch

Hello,

I have a brand new setup of Hass on Raspberry Pi Buster, with manual installation following the procedure on hass website.
Hass starts up fine until I modify the config file to insert “Switch”.
My config file is as follows:

Configure a default setup of Home Assistant (frontend, api, etc)

default_config:

Text to speech

tts:

  • platform: google_translate

switch:

  • platform: rpi_gpio
    invert_logic: true
    ports:
    22: Top
    23: Bottom
    27: Lights

group: !include groups.yaml
automation: !include automations.yaml
script: !include scripts.yaml
scene: !include scenes.yaml

Here’s the error that is generated when starting Hass:

2021-03-04 23:04:02 ERROR (MainThread) [homeassistant.bootstrap] Error setting up integration switch - received exception
Traceback (most recent call last):
File “/srv/homeassistant/lib/python3.7/site-packages/homeassistant/setup.py”, line 64, in async_setup_component
return await task # type: ignore
File “/srv/homeassistant/lib/python3.7/site-packages/homeassistant/setup.py”, line 175, in _async_setup_component
hass, config, integration
File “/srv/homeassistant/lib/python3.7/site-packages/homeassistant/config.py”, line 817, in async_process_component_config
p_integration = await async_get_integration_with_requirements(hass, p_name)
File “/srv/homeassistant/lib/python3.7/site-packages/homeassistant/requirements.py”, line 77, in async_get_integration_with_requirements
hass, integration.domain, integration.requirements
File “/srv/homeassistant/lib/python3.7/site-packages/homeassistant/requirements.py”, line 123, in async_process_requirements
if pkg_util.is_installed(req):
File “/srv/homeassistant/lib/python3.7/site-packages/homeassistant/util/package.py”, line 54, in is_installed
return version(req.project_name) in req
File “/srv/homeassistant/lib/python3.7/site-packages/pkg_resources/init.py”, line 3078, in contains
return self.specifier.contains(item, prereleases=True)
File “/srv/homeassistant/lib/python3.7/site-packages/pkg_resources/_vendor/packaging/specifiers.py”, line 703, in contains
item = parse(item)
File “/srv/homeassistant/lib/python3.7/site-packages/pkg_resources/_vendor/packaging/version.py”, line 31, in parse
return Version(version)
File “/srv/homeassistant/lib/python3.7/site-packages/pkg_resources/_vendor/packaging/version.py”, line 200, in init
match = self._regex.search(version)
TypeError: expected string or bytes-like object

Does anybody know what to do with this Error?
Still using Python 3.7 .

This guide assumes that you already have an operating system setup and have installed Python 3.8 (including the package python3-dev ) or newer.

Start with updating Python …

Thank you. It works now after upgrading to 3.8