core: ModuleNotFoundError: No module named 'cgi'

The problem

Since upgrading to 2021.12 my HA Core container keeps restarting:

Traceback (most recent call last):
  File "<frozen runpy>", line 198, in _run_module_as_main
  File "<frozen runpy>", line 88, in _run_code
  File "/usr/src/homeassistant/homeassistant/__[main__.py](https://l.facebook.com/l.php?u=http%3A%2F%2Fmain__.py%2F%3Ffbclid%3DIwZXh0bgNhZW0CMTAAAR3KPwJG2BD6sQQSN9hop2vDGucClN3rcwu11cUtfsjWSWrPS5-Sk3IrxYY_aem_F09jcK8K0edBBy8aSYSIDg&h=AT2XZEIaXXTWXEtwfMtSCHtyKwDB6fyFZdZzcEWBiL99tRHpy0HgFXukkAyDDQyuynXffMIL9bPt8VV-B0n2ZjNR6wu7ENx0pj6zArYFrPRJR5iCRADeXoXqSzVWeTC6g1jvHp0&__tn__=-UK-R&c[0]=AT0jK2RDbrqXFNLsP_vFMsL38DPEVgv8kQu-KAuH4LZhm--ohhOSuDeeKzb9Hi8abbmjLksJ9wV4mzlD3GOXkZxIAefynHFklANW74nzPKIlRfwk5c0hW1OYt02YIzl81KE5L1s02oQ4v8cjsB1xp2TwlYCRFPr-0K0NHJve)", line 227, in <module>
    sys.exit(main())
             ~~~~^^
  File "/usr/src/homeassistant/homeassistant/__[main__.py](https://l.facebook.com/l.php?u=http%3A%2F%2Fmain__.py%2F%3Ffbclid%3DIwZXh0bgNhZW0CMTAAAR2Zz_QoF8uVJrE0ccPJ4br2TC0tbFv0BvsWy3a-5QTu4wF0StyKAm3U3SI_aem_EazylM-GQnOPJwzTIxsNnQ&h=AT2XZEIaXXTWXEtwfMtSCHtyKwDB6fyFZdZzcEWBiL99tRHpy0HgFXukkAyDDQyuynXffMIL9bPt8VV-B0n2ZjNR6wu7ENx0pj6zArYFrPRJR5iCRADeXoXqSzVWeTC6g1jvHp0&__tn__=-UK-R&c[0]=AT0jK2RDbrqXFNLsP_vFMsL38DPEVgv8kQu-KAuH4LZhm--ohhOSuDeeKzb9Hi8abbmjLksJ9wV4mzlD3GOXkZxIAefynHFklANW74nzPKIlRfwk5c0hW1OYt02YIzl81KE5L1s02oQ4v8cjsB1xp2TwlYCRFPr-0K0NHJve)", line 192, in main
    from . import config, runner
  File "/usr/src/homeassistant/homeassistant/runner.py", line 16, in <module>
    from . import bootstrap
  File "/usr/src/homeassistant/homeassistant/bootstrap.py", line 27, in <module>
    from . import (
    ...<6 lines>...
    )
  File "/usr/src/homeassistant/homeassistant/config_entries.py", line 33, in <module>
    from .components import persistent_notification
  File "/usr/src/homeassistant/homeassistant/components/persistent_notification/__[init__.py](https://l.facebook.com/l.php?u=http%3A%2F%2Finit__.py%2F%3Ffbclid%3DIwZXh0bgNhZW0CMTAAAR08dbDPVwGUsKc43d8HlrKZREvYe9qGYEVx5OpBVDa76CLSibemKhzdPRA_aem_uhioM36oXMSNqLau28vkhw&h=AT35Is4CgIMY4bXnhq5N6AARO6vUNhgJPaAg0WaxJW8yFt4gOsgnGiguKlr5hgfTv1k0_JihU7fux-33aLLGxp1kdztm9-qxXrklvnflZrxWPaK5p6PX0JqXPWDZiRfL2gD6z0U&__tn__=-UK-R&c[0]=AT0jK2RDbrqXFNLsP_vFMsL38DPEVgv8kQu-KAuH4LZhm--ohhOSuDeeKzb9Hi8abbmjLksJ9wV4mzlD3GOXkZxIAefynHFklANW74nzPKIlRfwk5c0hW1OYt02YIzl81KE5L1s02oQ4v8cjsB1xp2TwlYCRFPr-0K0NHJve)", line 14, in <module>
    from homeassistant.components import websocket_api
  File "/usr/src/homeassistant/homeassistant/components/websocket_api/__[init__.py](https://l.facebook.com/l.php?u=http%3A%2F%2Finit__.py%2F%3Ffbclid%3DIwZXh0bgNhZW0CMTAAAR2y744bV57kA_cLgpVe5-524HT_mt6hc4z9jz-N4sJtvs4skdVh6mqZEmg_aem_Pdh7DifezxaNBCmcTU2qtg&h=AT35Is4CgIMY4bXnhq5N6AARO6vUNhgJPaAg0WaxJW8yFt4gOsgnGiguKlr5hgfTv1k0_JihU7fux-33aLLGxp1kdztm9-qxXrklvnflZrxWPaK5p6PX0JqXPWDZiRfL2gD6z0U&__tn__=-UK-R&c[0]=AT0jK2RDbrqXFNLsP_vFMsL38DPEVgv8kQu-KAuH4LZhm--ohhOSuDeeKzb9Hi8abbmjLksJ9wV4mzlD3GOXkZxIAefynHFklANW74nzPKIlRfwk5c0hW1OYt02YIzl81KE5L1s02oQ4v8cjsB1xp2TwlYCRFPr-0K0NHJve)", line 12, in <module>
    from . import commands, connection, const, decorators, http, messages  # noqa: F401
    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/components/websocket_api/http.py", line 16, in <module>
    from homeassistant.components.http import KEY_HASS, HomeAssistantView
  File "/usr/src/homeassistant/homeassistant/components/http/__[init__.py](https://l.facebook.com/l.php?u=http%3A%2F%2Finit__.py%2F%3Ffbclid%3DIwZXh0bgNhZW0CMTAAAR3KPwJG2BD6sQQSN9hop2vDGucClN3rcwu11cUtfsjWSWrPS5-Sk3IrxYY_aem_F09jcK8K0edBBy8aSYSIDg&h=AT35Is4CgIMY4bXnhq5N6AARO6vUNhgJPaAg0WaxJW8yFt4gOsgnGiguKlr5hgfTv1k0_JihU7fux-33aLLGxp1kdztm9-qxXrklvnflZrxWPaK5p6PX0JqXPWDZiRfL2gD6z0U&__tn__=-UK-R&c[0]=AT0jK2RDbrqXFNLsP_vFMsL38DPEVgv8kQu-KAuH4LZhm--ohhOSuDeeKzb9Hi8abbmjLksJ9wV4mzlD3GOXkZxIAefynHFklANW74nzPKIlRfwk5c0hW1OYt02YIzl81KE5L1s02oQ4v8cjsB1xp2TwlYCRFPr-0K0NHJve)", line 50, in <module>
    from homeassistant.helpers.network import NoURLAvailableError, get_url
  File "/usr/src/homeassistant/homeassistant/helpers/network.py", line 10, in <module>
    from hass_nabucasa import remote
  File "/usr/local/lib/python3.13/site-packages/hass_nabucasa/__[init__.py](https://l.facebook.com/l.php?u=http%3A%2F%2Finit__.py%2F%3Ffbclid%3DIwZXh0bgNhZW0CMTAAAR2FA0tz5vWqxRahF1CiYdgoGKivy_atGp2giyXS02obm4pyyOE9KuSsKMA_aem_u4bfrlUc-A0JaOi2aUd6cQ&h=AT35Is4CgIMY4bXnhq5N6AARO6vUNhgJPaAg0WaxJW8yFt4gOsgnGiguKlr5hgfTv1k0_JihU7fux-33aLLGxp1kdztm9-qxXrklvnflZrxWPaK5p6PX0JqXPWDZiRfL2gD6z0U&__tn__=-UK-R&c[0]=AT0jK2RDbrqXFNLsP_vFMsL38DPEVgv8kQu-KAuH4LZhm--ohhOSuDeeKzb9Hi8abbmjLksJ9wV4mzlD3GOXkZxIAefynHFklANW74nzPKIlRfwk5c0hW1OYt02YIzl81KE5L1s02oQ4v8cjsB1xp2TwlYCRFPr-0K0NHJve)", line 18, in <module>
    from .auth import CloudError, CognitoAuth
  File "/usr/local/lib/python3.13/site-packages/hass_nabucasa/auth.py", line 12, in <module>
    import boto3
  File "/usr/local/lib/python3.13/site-packages/boto3/__[init__.py](https://l.facebook.com/l.php?u=http%3A%2F%2Finit__.py%2F%3Ffbclid%3DIwZXh0bgNhZW0CMTAAAR3Nj-AAhGM1kS1WMsHU8keND8aRO0OiDTJUWBXWOoB8SjglMFEJYB1xFC8_aem_NKciw4-0JoodQUZbi9RbpQ&h=AT35Is4CgIMY4bXnhq5N6AARO6vUNhgJPaAg0WaxJW8yFt4gOsgnGiguKlr5hgfTv1k0_JihU7fux-33aLLGxp1kdztm9-qxXrklvnflZrxWPaK5p6PX0JqXPWDZiRfL2gD6z0U&__tn__=-UK-R&c[0]=AT0jK2RDbrqXFNLsP_vFMsL38DPEVgv8kQu-KAuH4LZhm--ohhOSuDeeKzb9Hi8abbmjLksJ9wV4mzlD3GOXkZxIAefynHFklANW74nzPKIlRfwk5c0hW1OYt02YIzl81KE5L1s02oQ4v8cjsB1xp2TwlYCRFPr-0K0NHJve)", line 17, in <module>
    from boto3.session import Session
  File "/usr/local/lib/python3.13/site-packages/boto3/session.py", line 17, in <module>
    import botocore.session
  File "/usr/local/lib/python3.13/site-packages/botocore/session.py", line 26, in <module>
    import botocore.client
  File "/usr/local/lib/python3.13/site-packages/botocore/client.py", line 15, in <module>
    from botocore import waiter, xform_name
  File "/usr/local/lib/python3.13/site-packages/botocore/waiter.py", line 18, in <module>
    from botocore.docs.docstring import WaiterDocstring
  File "/usr/local/lib/python3.13/site-packages/botocore/docs/__[init__.py](https://l.facebook.com/l.php?u=http%3A%2F%2Finit__.py%2F%3Ffbclid%3DIwZXh0bgNhZW0CMTAAAR1XtrCaoDaPT9twjkZJ2xlBVE7F1woLTllnM1de7tpdsVCKEsi2Np13unc_aem_dqzZsGE0K5K4YfU1YbO-3Q&h=AT35Is4CgIMY4bXnhq5N6AARO6vUNhgJPaAg0WaxJW8yFt4gOsgnGiguKlr5hgfTv1k0_JihU7fux-33aLLGxp1kdztm9-qxXrklvnflZrxWPaK5p6PX0JqXPWDZiRfL2gD6z0U&__tn__=-UK-R&c[0]=AT0jK2RDbrqXFNLsP_vFMsL38DPEVgv8kQu-KAuH4LZhm--ohhOSuDeeKzb9Hi8abbmjLksJ9wV4mzlD3GOXkZxIAefynHFklANW74nzPKIlRfwk5c0hW1OYt02YIzl81KE5L1s02oQ4v8cjsB1xp2TwlYCRFPr-0K0NHJve)", line 15, in <module>
    from botocore.docs.service import ServiceDocumenter
  File "/usr/local/lib/python3.13/site-packages/botocore/docs/service.py", line 14, in <module>
    from botocore.docs.client import ClientDocumenter, ClientExceptionsDocumenter
  File "/usr/local/lib/python3.13/site-packages/botocore/docs/client.py", line 14, in <module>
    from botocore.docs.example import ResponseExampleDocumenter
  File "/usr/local/lib/python3.13/site-packages/botocore/docs/example.py", line 13, in <module>
    from botocore.docs.shape import ShapeDocumenter
  File "/usr/local/lib/python3.13/site-packages/botocore/docs/shape.py", line 19, in <module>
    from botocore.utils import is_json_value_header
  File "/usr/local/lib/python3.13/site-packages/botocore/utils.py", line 15, in <module>
    import cgi
ModuleNotFoundError: No module named 'cgi'
[17:22:29] INFO: Home Assistant Core finish process exit code 1
[17:22:29] INFO: Home Assistant Core service shutdown

What version of Home Assistant Core has the issue?

core-2024.12.1

What was the last working version of Home Assistant Core?

core-2024.11.3

What type of installation are you running?

Home Assistant Container

Integration causing the issue

No response

Link to integration documentation on our website

No response

Diagnostics information

No response

Example YAML snippet

No response

Anything in the logs that might be useful for us?

No response

Additional information

No response

About this issue

  • Original URL
  • State: closed
  • Created 2 years ago
  • Reactions: 3
  • Comments: 21

Most upvoted comments

I suspect it’s Rinnai. It has a dependency chain: aioboto3 10.4.0 -> aiobotocore 2.4.2 -> boto3 1.24.59 and botocore 1.27.59. I’m going through a similar process, just backing up first. Triggered recirculation is huge for us, so would be painful if we have to lose that one.

Good catch - I opened an issue on their github

https://github.com/explosivo22/rinnaicontrolr-ha/issues/90

I opened this since it seems to be related to hass-nabucasa.

https://github.com/NabuCasa/hass-nabucasa/issues/761

Yep I was too quick to close this issue, Home Assistant started to crash the same again.