hass-xiaomi-miot
hass-xiaomi-miot copied to clipboard
Setup failed for custom integration 'xiaomi_miot': Unable to import component: No module named 'imp'
Logger: homeassistant.setup Source: setup.py:251 First occurred: 2024年2月8日 23:51:12 (1 occurrences) Last logged: 2024年2月8日 23:51:12
Setup failed for custom integration 'xiaomi_miot': Unable to import component: No module named 'imp'
Traceback (most recent call last):
File "/usr/src/homeassistant/homeassistant/setup.py", line 251, in _async_setup_component
component = integration.get_component()
^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/src/homeassistant/homeassistant/loader.py", line 827, in get_component
ComponentProtocol, importlib.import_module(self.pkg_path)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.12/importlib/init.py", line 90, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "
Same issue...
同样的问题...
Same issue here as well
Same issue here
Same here
Same problem after update to 2024.2.1. Works after restoring to 2024.1.6
Same issue here
Works after upgrade to 2024.2.1. didn't work on 2024.2.0
Works after upgrade to 2024.2.1
For me not
Not working for me. Home Assistant 2024.2.1
Logger: homeassistant.setup
Source: setup.py:251
First occurred: 00:32:18 (1 occurrences)
Last logged: 00:32:18
Setup failed for custom integration 'xiaomi_miot': Unable to import component: No module named 'imp'
Traceback (most recent call last):
File "/usr/src/homeassistant/homeassistant/setup.py", line 251, in _async_setup_component
component = integration.get_component()
^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/src/homeassistant/homeassistant/loader.py", line 827, in get_component
ComponentProtocol, importlib.import_module(self.pkg_path)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
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 994, in exec_module
File "<frozen importlib._bootstrap>", line 488, in _call_with_frames_removed
File "/config/custom_components/xiaomi_miot/__init__.py", line 32, in <module>
from miio import (
File "/usr/local/lib/python3.12/site-packages/miio/__init__.py", line 12, in <module>
from miio.device import Device, DeviceStatus # isort: skip
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.12/site-packages/miio/device.py", line 13, in <module>
from .miioprotocol import MiIOProtocol
File "/usr/local/lib/python3.12/site-packages/miio/miioprotocol.py", line 13, in <module>
import construct
File "/usr/local/lib/python3.12/site-packages/construct/__init__.py", line 22, in <module>
from construct.core import *
File "/usr/local/lib/python3.12/site-packages/construct/core.py", line 3, in <module>
import struct, io, binascii, itertools, collections, pickle, sys, os, tempfile, hashlib, importlib, imp
ModuleNotFoundError: No module named 'imp'
The problem is caused by a Python upgrade (to 3.12). https://www.home-assistant.io/blog/2024/02/07/release-20242/#shipping-on-a-new-python-version
Logger: homeassistant.setup Source: setup.py:251 First occurred: 13:21:31 (1 occurrences) Last logged: 13:21:31
Setup failed for custom integration 'xiaomi_miot': Unable to import component: No module named 'imp'
Traceback (most recent call last):
File "/usr/src/homeassistant/homeassistant/setup.py", line 251, in _async_setup_component
component = integration.get_component()
^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/src/homeassistant/homeassistant/loader.py", line 827, in get_component
ComponentProtocol, importlib.import_module(self.pkg_path)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.12/importlib/init.py", line 90, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "
same issue
更新HA后不能用的, 应该是2024.2版本的HA更新了python, 如果急用可以回滚HA到2024.2之前的版本试试 (做好备份
谢谢!已经通过恢复备份修复。
---Original--- From: @.> Date: Mon, Feb 12, 2024 12:07 PM To: @.>; Cc: @.@.>; Subject: Re: [al-one/hass-xiaomi-miot] Setup failed for custom integration'xiaomi_miot': Unable to import component: No module named 'imp' (Issue #1526)
更新HA后不能用的, 应该是2024.2版本的HA更新了python, 如果急用可以回滚HA到2024.2之前的版本试试 (做好备份
— Reply to this email directly, view it on GitHub, or unsubscribe. You are receiving this because you authored the thread.Message ID: @.***>
run command:
pip install construct --upgrade
can solve the problem.
see #https://github.com/construct/construct/commit/a2d5c249b7039b70becbece4cc9c7bfa9e682f00
Thanks!
---Original--- From: "Bob @.> Date: Tue, Feb 13, 2024 02:59 AM To: @.>; Cc: @.@.>; Subject: Re: [al-one/hass-xiaomi-miot] Setup failed for custom integration'xiaomi_miot': Unable to import component: No module named 'imp' (Issue #1526)
run command:
pip install construct --upgrade
can solve the problem.
— Reply to this email directly, view it on GitHub, or unsubscribe. You are receiving this because you authored the thread.Message ID: @.***>
Same. Stopped working after simple restart - HAOS update was few days ago to 2024.2.1, crazy as I had few restarts after update :D
I too am seeing this error. Integration fails to load after updating hassos. Regretting that update now.
run command:
pip install construct --upgrade
can solve the problem.
Where should I run it?
Seems to be fixed with todays HAOS Core update: 2024.2.2
btw how someone using HAOS can run pip if it’s not installed ? Is there some kind of backdoor to install additional packages ?
I’ve updated to 2024.2.2 as well and the integration loaded successfully now.
Confirmed, 2024.2.2 solve the problem.
Same issue...
Same issue.
Seems to be fixed with todays HAOS Core update: 2024.2.2
btw how someone using HAOS can run pip if it’s not installed ? Is there some kind of backdoor to install additional packages ?
you can see here: https://www.home-assistant.io/faq/pip3/
run command:
pip install construct --upgrade
can solve the problem. see #construct/construct@a2d5c24
Where should I run it?
in the console.
Guys I have found how to solve this problem. At least it worked for me.
Here are the steps :
First we need to get into the docker container of homeassistant, trying to write commands from terminal directly is not going to work.
- Install "Advanced SSH & Web Terminal" addon for home assistant to be able to reach the terminal.
- execute "docker ps" command to be able to see running containers.
- Find the container id with image : ghcr.io/home-assistant/raspberrypi5-64-homeassistant:2024.2.2, your image may be different cause I'm running my ha on raspberry pi 5 but basically we need to find the id of the container for home assistant docker container
- execute "docker exec -it <container_id> /bin/bash" replace container_id with the id that you have found in the previous step.
- You're in the container now. You can try to run "pip install construct --upgrade" the latest version uses importlib instead of imp.
- But in my case the problem was that contruct package was still using an old version, so I had to remove the pycache folder for construct
- navigate to the construct package directory by : cd /usr/local/lib/python3.12/site-packages/construct/
- execute "rm -rf pycache" this will remove the pycache folder, don't worry it will be regenerated after you restart the home assistant
reboot the server and you're done. ;)
Thanks!
---Original--- From: "Emre @.> Date: Mon, Feb 19, 2024 01:52 AM To: @.>; Cc: @.@.>; Subject: Re: [al-one/hass-xiaomi-miot] Setup failed for custom integration'xiaomi_miot': Unable to import component: No module named 'imp' (Issue #1526)
Guys I have found how to solve this problem. At least it worked for me.
Here are the steps :
First we need to get into the docker container of homeasisstnant, trying to write commands from terminal directly is not going to work.
Install "Advanced SSH & Web Terminal" addon for home assistant to be able to react the terminal.
execute "docker ps" command to be able to see running containers.
Find the container id with image : ghcr.io/home-assistant/raspberrypi5-64-homeassistant:2024.2.2, your image may be different cause I'm running my ha on raspberry pi 5 but basically we need to find the id of the container for home assistant docker container
execute "docker exec -it <container_id> /bin/bash" replace container_id with the id that you have found in the previous step.
You're in the container now. You can try to run "pip install construct --upgrade" the latest version uses importlib instead of imp.
But in my case the problem was that contruct package was still using an old version, so I had to remove the pycache folder for construct
navigate to the construct package directory by : cd /usr/local/lib/python3.12/site-packages/construct/
execute "rm -rf pycache" this will remove the pycache folder, don't worry it will be regenerated after you restart the home assistant
reboot the server and you're done. ;)
— Reply to this email directly, view it on GitHub, or unsubscribe. You are receiving this because you authored the thread.Message ID: @.***>
In version 2024.2.2 it works until the first reboot