Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

error when using python-3.13 #733

Closed
gilcu3 opened this issue Dec 9, 2024 · 2 comments
Closed

error when using python-3.13 #733

gilcu3 opened this issue Dec 9, 2024 · 2 comments

Comments

@gilcu3
Copy link

gilcu3 commented Dec 9, 2024

Description

Homeasistant 2024.12 deprecated python-3.12. Using python-3.13 this integration fails because the ovnif package is not compatible.

Logger: homeassistant.setup
Source: setup.py:334
First occurred: 2:22:13 PM (1 occurrences)
Last logged: 2:22:13 PM

Setup failed for 'onvif': Unable to import component: No module named 'cgi'
Traceback (most recent call last):
  File "/home/homeassistant/.homeassistant/venv313/lib/python3.13/site-packages/homeassistant/setup.py", line 334, in _async_setup_component
    component = await integration.async_get_component()
                ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/homeassistant/.homeassistant/venv313/lib/python3.13/site-packages/homeassistant/loader.py", line 1034, in async_get_component
    self._component_future.result()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/homeassistant/.homeassistant/venv313/lib/python3.13/site-packages/homeassistant/loader.py", line 1014, in async_get_component
    comp = await self.hass.async_add_import_executor_job(
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
        self._get_component, True
        ^^^^^^^^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/home/homeassistant/.pyenv/versions/3.13.0/lib/python3.13/concurrent/futures/thread.py", line 58, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/homeassistant/.homeassistant/venv313/lib/python3.13/site-packages/homeassistant/loader.py", line 1074, in _get_component
    ComponentProtocol, importlib.import_module(self.pkg_path)
                       ~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^
  File "/home/homeassistant/.homeassistant/venv313/lib/python3.13/site-packages/homeassistant/util/loop.py", line 200, in protected_loop_func
    return func(*args, **kwargs)
  File "/home/homeassistant/.pyenv/versions/3.13.0/lib/python3.13/importlib/__init__.py", line 88, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
           ~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "<frozen importlib._bootstrap>", line 1387, in _gcd_import
  File "<frozen importlib._bootstrap>", line 1360, in _find_and_load
  File "<frozen importlib._bootstrap>", line 1331, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 935, in _load_unlocked
  File "<frozen importlib._bootstrap_external>", line 1022, in exec_module
  File "<frozen importlib._bootstrap>", line 488, in _call_with_frames_removed
  File "/home/homeassistant/.homeassistant/venv313/lib/python3.13/site-packages/homeassistant/components/onvif/__init__.py", line 9, in <module>
    from onvif.exceptions import ONVIFError
  File "/home/homeassistant/.homeassistant/venv313/lib/python3.13/site-packages/onvif/__init__.py", line 1, in <module>
    from onvif.client import ONVIFService, ONVIFCamera, SERVICES
  File "/home/homeassistant/.homeassistant/venv313/lib/python3.13/site-packages/onvif/client.py", line 11, in <module>
    from zeep.client import Client, CachingClient, Settings
  File "/home/homeassistant/.homeassistant/venv313/lib/python3.13/site-packages/zeep/__init__.py", line 1, in <module>
    from zeep.client import AsyncClient, CachingClient, Client
  File "/home/homeassistant/.homeassistant/venv313/lib/python3.13/site-packages/zeep/client.py", line 6, in <module>
    from zeep.transports import AsyncTransport, Transport
  File "/home/homeassistant/.homeassistant/venv313/lib/python3.13/site-packages/zeep/transports.py", line 11, in <module>
    from zeep.utils import get_media_type, get_version
  File "/home/homeassistant/.homeassistant/venv313/lib/python3.13/site-packages/zeep/utils.py", line 1, in <module>
    import cgi
ModuleNotFoundError: No module named 'cgi'

Is there any workaround?

I am using an aarch64 core installation which was working fine on python3.12.

Reproduction Steps

Start homeassistant

Expected behavior

Load integration properly

If applicable, add error logs.

.

Device Firmware

1.3.9 Build 231019

Integration Version

5.8.6

Using stream component

Yes

Does camera work via official integrations?

Yes

Camera has all attributes filled out in developer tools

Yes

HASS Environment

core-2024.12.1

Search for similar issues

Yes

Additional information

No response

@JurajNyiri
Copy link
Owner

JurajNyiri commented Dec 9, 2024

If HA does not manage dependencies for you and an unrecommended install method is used, you will need to install the dependencies manually.

Integration works on Python3.13 and latest HA without any issues on both HA OS and Docker where HA handles dependencies.

@gilcu3
Copy link
Author

gilcu3 commented Dec 9, 2024

Thanks for the confirmation that it is supposed to be working on python-3.13. I will try to solve it myself then and report back the solution if needed.

PS: solution was to install onvif-zeep-async==3.1.13 in the venv

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants