core icon indicating copy to clipboard operation
core copied to clipboard

HA 2024.7 Detected blocking call to import_module + Setup failed for 'qbittorrent': Unable to import component

Open AnthonyBe opened this issue 7 months ago • 3 comments

The problem

HA 2024.7 - qBittorrent integration error on initialization as below.

2024-07-06 14:06:08.065 WARNING (MainThread) [homeassistant.util.loop] Detected blocking call to import_module with args ('homeassistant.components.qbittorrent',) in /usr/src/homeassistant/homeassistant/loader.py, line 1050: ComponentProtocol, importlib.import_module(self.pkg_path) inside the event loop; This is causing stability issues. Please create a bug report at https://github.com/home-assistant/core/issues?q=is%3Aopen+is%3Aissue
For developers, please see https://developers.home-assistant.io/docs/asyncio_blocking_operations/#import_module
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", line 223, in <module>
    sys.exit(main())
  File "/usr/src/homeassistant/homeassistant/__main__.py", line 209, in main
    exit_code = runner.run(runtime_conf)
  File "/usr/src/homeassistant/homeassistant/runner.py", line 190, in run
    return loop.run_until_complete(setup_and_run_hass(runtime_config))
  File "/usr/local/lib/python3.12/asyncio/base_events.py", line 674, in run_until_complete
    self.run_forever()
  File "/usr/local/lib/python3.12/asyncio/base_events.py", line 641, in run_forever
    self._run_once()
  File "/usr/local/lib/python3.12/asyncio/base_events.py", line 1990, in _run_once
    handle._run()
  File "/usr/local/lib/python3.12/asyncio/events.py", line 88, in _run
    self._context.run(self._callback, *self._args)
  File "/usr/src/homeassistant/homeassistant/setup.py", line 167, in async_setup_component
    result = await _async_setup_component(hass, domain, config)
  File "/usr/src/homeassistant/homeassistant/setup.py", line 322, in _async_setup_component
    component = await integration.async_get_component()
  File "/usr/src/homeassistant/homeassistant/loader.py", line 1002, in async_get_component
    comp = self._get_component()
  File "/usr/src/homeassistant/homeassistant/loader.py", line 1050, in _get_component
    ComponentProtocol, importlib.import_module(self.pkg_path)

Followed by

Setup failed for 'qbittorrent': Unable to import component: cannot import name 'TorrentStatusesT' from 'qbittorrentapi.torrents' (/usr/local/lib/python3.12/site-packages/qbittorrentapi/torrents.py)
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/loader.py", line 990, in async_get_component
    comp = await self.hass.async_add_import_executor_job(
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/concurrent/futures/thread.py", line 58, in run
    result = self.fn(*self.args, **self.kwargs)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/loader.py", line 1050, in _get_component
    ComponentProtocol, importlib.import_module(self.pkg_path)
                       ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/util/loop.py", line 200, in protected_loop_func
    return func(*args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/importlib/__init__.py", line 90, 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 995, in exec_module
  File "<frozen importlib._bootstrap>", line 488, in _call_with_frames_removed
  File "/usr/src/homeassistant/homeassistant/components/qbittorrent/__init__.py", line 30, in <module>
    from .coordinator import QBittorrentDataCoordinator
  File "/usr/src/homeassistant/homeassistant/components/qbittorrent/coordinator.py", line 16, in <module>
    from qbittorrentapi.torrents import TorrentStatusesT
ImportError: cannot import name 'TorrentStatusesT' from 'qbittorrentapi.torrents' (/usr/local/lib/python3.12/site-packages/qbittorrentapi/torrents.py). Did you mean: 'TorrentStates'?

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/setup.py", line 322, in _async_setup_component
    component = await integration.async_get_component()
                ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/loader.py", line 1010, in async_get_component
    self._component_future.result()
  File "/usr/src/homeassistant/homeassistant/loader.py", line 1002, in async_get_component
    comp = self._get_component()
           ^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/loader.py", line 1050, in _get_component
    ComponentProtocol, importlib.import_module(self.pkg_path)
                       ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/util/loop.py", line 200, in protected_loop_func
    return func(*args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/importlib/__init__.py", line 90, 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 995, in exec_module
  File "<frozen importlib._bootstrap>", line 488, in _call_with_frames_removed
  File "/usr/src/homeassistant/homeassistant/components/qbittorrent/__init__.py", line 30, in <module>
    from .coordinator import QBittorrentDataCoordinator
  File "/usr/src/homeassistant/homeassistant/components/qbittorrent/coordinator.py", line 16, in <module>
    from qbittorrentapi.torrents import TorrentStatusesT
ImportError: cannot import name 'TorrentStatusesT' from 'qbittorrentapi.torrents' (/usr/local/lib/python3.12/site-packages/qbittorrentapi/torrents.py). Did you mean: 'TorrentStates'?

What version of Home Assistant Core has the issue?

core-2024.7.1

What was the last working version of Home Assistant Core?

core-2024.6.5

What type of installation are you running?

Home Assistant OS

Integration causing the issue

qBittorrent

Link to integration documentation on our website

https://www.home-assistant.io/integrations/qbittorrent

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

AnthonyBe avatar Jul 06 '24 04:07 AnthonyBe