『瀚思彼岸』» 智能家居技术论坛

标题: 安卓手机安装HomeAssistant后运行报错cannot import name '_imaging' f... [打印本页]

作者: csphhing    时间: 2021-6-21 23:54
标题: 安卓手机安装HomeAssistant后运行报错cannot import name '_imaging' f...
硬件:荣耀7X (BND-AL10 EMUI9.1.0   安卓版本 9)
手机未root
软件环境:
手机安装 Termux  0.114
termux下安装 homeassistant
大略安装步骤
启动termux→更新软件→安装openssh→设置密码后Xshell连接→apt 安装python(3.9.5)→pip 安装virtualenv→建立并进入虚拟环境→pip 安装homeassistant→安装成功后 hass→ 报错提示需要Pillow8.1.2→pip在线安装失败→下载whl文件离线安装成功→hass→还是报错
报错如下
  1. (homeassistant) ~ $ hass
  2. 2021-06-21 23:14:46 WARNING (Recorder) [homeassistant.components.recorder.util] The system could not validate that the sqlite3 database at //data/data/com.termux/files/home/.homeassistant/home-assistant_v2.db was shutdown cleanly
  3. 2021-06-21 23:14:46 WARNING (Recorder) [homeassistant.components.recorder.util] Ended unfinished session (id=2 from 2021-06-21 15:11:06.330333)
  4. 2021-06-21 23:14:47 ERROR (MainThread) [homeassistant.setup] Setup failed for image: Unable to import component: cannot import name '_imaging' from 'PIL' (/data/data/com.termux/files/home/homeassistant/lib/python3.9/site-packages/PIL/__init__.py)
  5. 2021-06-21 23:14:47 ERROR (MainThread) [homeassistant.setup] Unable to set up dependencies of person. Setup failed for dependencies: image
  6. 2021-06-21 23:14:47 ERROR (MainThread) [homeassistant.setup] Setup failed for person: Could not set up all dependencies.
  7. 2021-06-21 23:14:47 ERROR (MainThread) [homeassistant.setup] Unable to set up dependencies of onboarding. Setup failed for dependencies: person
  8. 2021-06-21 23:14:47 ERROR (MainThread) [homeassistant.setup] Setup failed for onboarding: Could not set up all dependencies.
  9. 2021-06-21 23:14:47 ERROR (MainThread) [homeassistant.setup] Unable to set up dependencies of frontend. Setup failed for dependencies: onboarding
  10. 2021-06-21 23:14:47 ERROR (MainThread) [homeassistant.setup] Setup failed for frontend: Could not set up all dependencies.
  11. 2021-06-21 23:14:49 ERROR (MainThread) [homeassistant.setup] Unable to set up dependencies of my. Setup failed for dependencies: frontend
  12. 2021-06-21 23:14:49 ERROR (MainThread) [homeassistant.setup] Setup failed for my: Could not set up all dependencies.
  13. 2021-06-21 23:14:49 ERROR (MainThread) [homeassistant.setup] Unable to set up dependencies of logbook. Setup failed for dependencies: frontend
  14. 2021-06-21 23:14:49 ERROR (MainThread) [homeassistant.setup] Setup failed for logbook: Could not set up all dependencies.
  15. 2021-06-21 23:14:49 ERROR (MainThread) [homeassistant.setup] Unable to set up dependencies of map. Setup failed for dependencies: frontend
  16. 2021-06-21 23:14:49 ERROR (MainThread) [homeassistant.setup] Setup failed for map: Could not set up all dependencies.
  17. 2021-06-21 23:14:49 ERROR (MainThread) [homeassistant.setup] Unable to set up dependencies of mobile_app. Setup failed for dependencies: person
  18. 2021-06-21 23:14:49 ERROR (MainThread) [homeassistant.setup] Setup failed for mobile_app: Could not set up all dependencies.
  19. 2021-06-21 23:15:55 ERROR (MainThread) [homeassistant.setup] Setup failed for dhcp: unknown error
  20. Traceback (most recent call last):
  21.   File "/data/data/com.termux/files/home/homeassistant/lib/python3.9/site-packages/homeassistant/setup.py", line 200, in _async_setup_component
  22.     component = integration.get_component()
  23.   File "/data/data/com.termux/files/home/homeassistant/lib/python3.9/site-packages/homeassistant/loader.py", line 490, in get_component
  24.     cache[self.domain] = importlib.import_module(self.pkg_path)
  25.   File "/data/data/com.termux/files/usr/lib/python3.9/importlib/__init__.py", line 127, in import_module
  26.     return _bootstrap._gcd_import(name[level:], package, level)
  27.   File "<frozen importlib._bootstrap>", line 1030, in _gcd_import
  28.   File "<frozen importlib._bootstrap>", line 1007, in _find_and_load
  29.   File "<frozen importlib._bootstrap>", line 986, in _find_and_load_unlocked
  30.   File "<frozen importlib._bootstrap>", line 680, in _load_unlocked
  31.   File "<frozen importlib._bootstrap_external>", line 855, in exec_module
  32.   File "<frozen importlib._bootstrap>", line 228, in _call_with_frames_removed
  33.   File "/data/data/com.termux/files/home/homeassistant/lib/python3.9/site-packages/homeassistant/components/dhcp/__init__.py", line 17, in <module>
  34.     from scapy.arch.common import compile_filter
  35.   File "/data/data/com.termux/files/home/homeassistant/lib/python3.9/site-packages/scapy/arch/__init__.py", line 135, in <module>
  36.     _set_conf_sockets()  # Apply config
  37.   File "/data/data/com.termux/files/home/homeassistant/lib/python3.9/site-packages/scapy/config.py", line 618, in _set_conf_sockets
  38.     conf.ifaces.reload()
  39.   File "/data/data/com.termux/files/home/homeassistant/lib/python3.9/site-packages/scapy/interfaces.py", line 238, in reload
  40.     self._reload_provs()
  41.   File "/data/data/com.termux/files/home/homeassistant/lib/python3.9/site-packages/scapy/interfaces.py", line 234, in _reload_provs
  42.     self._load(prov.reload(), prov)
  43.   File "/data/data/com.termux/files/home/homeassistant/lib/python3.9/site-packages/scapy/interfaces.py", line 53, in reload
  44.     return self.load()
  45.   File "/data/data/com.termux/files/home/homeassistant/lib/python3.9/site-packages/scapy/arch/linux.py", line 420, in load
  46.     get_if_raw_hwaddr(i, siocgifhwaddr=SIOCGIFHWADDR)[1]
  47.   File "/data/data/com.termux/files/home/homeassistant/lib/python3.9/site-packages/scapy/arch/common.py", line 87, in get_if_raw_hwaddr
  48.     get_if(iff, siocgifhwaddr)
  49.   File "/data/data/com.termux/files/home/homeassistant/lib/python3.9/site-packages/scapy/arch/common.py", line 65, in get_if
  50.     return ioctl(sck, cmd, struct.pack("16s16x", iff.encode("utf8")))
  51. PermissionError: [Errno 13] Permission denied
  52. 2021-06-21 23:16:04 WARNING (MainThread) [homeassistant.bootstrap] Waiting on integrations to complete setup: zeroconf
  53. 2021-06-21 23:16:52 ERROR (MainThread) [homeassistant.setup] Unable to set up dependencies of default_config. Setup failed for dependencies: dhcp, frontend, logbook, map, mobile_app, my, person
  54. 2021-06-21 23:16:52 ERROR (MainThread) [homeassistant.setup] Setup failed for default_config: Could not set up all dependencies.
  55. 2021-06-21 23:16:52 WARNING (MainThread) [homeassistant.bootstrap] Detected that frontend did not load. Activating safe mode
  56. 2021-06-21 23:16:53 ERROR (MainThread) [homeassistant.setup] Setup failed for image: Unable to import component: cannot import name '_imaging' from 'PIL' (/data/data/com.termux/files/home/homeassistant/lib/python3.9/site-packages/PIL/__init__.py)
  57. 2021-06-21 23:16:53 ERROR (MainThread) [homeassistant.setup] Unable to set up dependencies of person. Setup failed for dependencies: image
  58. 2021-06-21 23:16:53 ERROR (MainThread) [homeassistant.setup] Setup failed for person: Could not set up all dependencies.
  59. 2021-06-21 23:16:53 ERROR (MainThread) [homeassistant.setup] Unable to set up dependencies of onboarding. Setup failed for dependencies: person
  60. 2021-06-21 23:16:53 ERROR (MainThread) [homeassistant.setup] Setup failed for onboarding: Could not set up all dependencies.
  61. 2021-06-21 23:16:53 ERROR (MainThread) [homeassistant.setup] Unable to set up dependencies of frontend. Setup failed for dependencies: onboarding
  62. 2021-06-21 23:16:53 ERROR (MainThread) [homeassistant.setup] Setup failed for frontend: Could not set up all dependencies.
  63. 2021-06-21 23:16:53 ERROR (MainThread) [homeassistant.setup] Unable to set up dependencies of safe_mode. Setup failed for dependencies: frontend
  64. 2021-06-21 23:16:53 ERROR (MainThread) [homeassistant.setup] Setup failed for safe_mode: Could not set up all dependencies.
  65. ^C(homeassistant) ~ $ ^C
  66. (homeassistant) ~ $ from PIL import _imaging
  67. No command from found, did you mean:
  68. Command frob in package frobtads
  69. (homeassistant) ~ $ hass
  70. 2021-06-21 23:30:03 WARNING (Recorder) [homeassistant.components.recorder.util] The system could not validate that the sqlite3 database at //data/data/com.termux/files/home/.homeassistant/home-assistant_v2.db was shutdown cleanly
  71. 2021-06-21 23:30:03 WARNING (Recorder) [homeassistant.components.recorder.util] Ended unfinished session (id=3 from 2021-06-21 15:14:46.378579)
  72. 2021-06-21 23:30:04 ERROR (MainThread) [homeassistant.setup] Setup failed for image: Unable to import component: cannot import name '_imaging' from 'PIL' (/data/data/com.termux/files/home/homeassistant/lib/python3.9/site-packages/PIL/__init__.py)
  73. 2021-06-21 23:30:04 ERROR (MainThread) [homeassistant.setup] Unable to set up dependencies of person. Setup failed for dependencies: image
  74. 2021-06-21 23:30:04 ERROR (MainThread) [homeassistant.setup] Setup failed for person: Could not set up all dependencies.
  75. 2021-06-21 23:30:04 ERROR (MainThread) [homeassistant.setup] Unable to set up dependencies of onboarding. Setup failed for dependencies: person
  76. 2021-06-21 23:30:04 ERROR (MainThread) [homeassistant.setup] Setup failed for onboarding: Could not set up all dependencies.
  77. 2021-06-21 23:30:04 ERROR (MainThread) [homeassistant.setup] Unable to set up dependencies of frontend. Setup failed for dependencies: onboarding
  78. 2021-06-21 23:30:04 ERROR (MainThread) [homeassistant.setup] Setup failed for frontend: Could not set up all dependencies.
  79. 2021-06-21 23:30:07 ERROR (MainThread) [homeassistant.setup] Setup failed for dhcp: unknown error
  80. Traceback (most recent call last):
  81.   File "/data/data/com.termux/files/home/homeassistant/lib/python3.9/site-packages/homeassistant/setup.py", line 200, in _async_setup_component
  82.     component = integration.get_component()
  83.   File "/data/data/com.termux/files/home/homeassistant/lib/python3.9/site-packages/homeassistant/loader.py", line 490, in get_component
  84.     cache[self.domain] = importlib.import_module(self.pkg_path)
  85.   File "/data/data/com.termux/files/usr/lib/python3.9/importlib/__init__.py", line 127, in import_module
  86.     return _bootstrap._gcd_import(name[level:], package, level)
  87.   File "<frozen importlib._bootstrap>", line 1030, in _gcd_import
  88.   File "<frozen importlib._bootstrap>", line 1007, in _find_and_load
  89.   File "<frozen importlib._bootstrap>", line 986, in _find_and_load_unlocked
  90.   File "<frozen importlib._bootstrap>", line 680, in _load_unlocked
  91.   File "<frozen importlib._bootstrap_external>", line 855, in exec_module
  92.   File "<frozen importlib._bootstrap>", line 228, in _call_with_frames_removed
  93.   File "/data/data/com.termux/files/home/homeassistant/lib/python3.9/site-packages/homeassistant/components/dhcp/__init__.py", line 17, in <module>
  94.     from scapy.arch.common import compile_filter
  95.   File "/data/data/com.termux/files/home/homeassistant/lib/python3.9/site-packages/scapy/arch/__init__.py", line 135, in <module>
  96.     _set_conf_sockets()  # Apply config
  97.   File "/data/data/com.termux/files/home/homeassistant/lib/python3.9/site-packages/scapy/config.py", line 618, in _set_conf_sockets
  98.     conf.ifaces.reload()
  99.   File "/data/data/com.termux/files/home/homeassistant/lib/python3.9/site-packages/scapy/interfaces.py", line 238, in reload
  100.     self._reload_provs()
  101.   File "/data/data/com.termux/files/home/homeassistant/lib/python3.9/site-packages/scapy/interfaces.py", line 234, in _reload_provs
  102.     self._load(prov.reload(), prov)
  103.   File "/data/data/com.termux/files/home/homeassistant/lib/python3.9/site-packages/scapy/interfaces.py", line 53, in reload
  104.     return self.load()
  105.   File "/data/data/com.termux/files/home/homeassistant/lib/python3.9/site-packages/scapy/arch/linux.py", line 420, in load
  106.     get_if_raw_hwaddr(i, siocgifhwaddr=SIOCGIFHWADDR)[1]
  107.   File "/data/data/com.termux/files/home/homeassistant/lib/python3.9/site-packages/scapy/arch/common.py", line 87, in get_if_raw_hwaddr
  108.     get_if(iff, siocgifhwaddr)
  109.   File "/data/data/com.termux/files/home/homeassistant/lib/python3.9/site-packages/scapy/arch/common.py", line 65, in get_if
  110.     return ioctl(sck, cmd, struct.pack("16s16x", iff.encode("utf8")))
  111. PermissionError: [Errno 13] Permission denied
  112. 2021-06-21 23:30:07 ERROR (MainThread) [homeassistant.setup] Unable to set up dependencies of logbook. Setup failed for dependencies: frontend
  113. 2021-06-21 23:30:07 ERROR (MainThread) [homeassistant.setup] Setup failed for logbook: Could not set up all dependencies.
  114. 2021-06-21 23:30:07 ERROR (MainThread) [homeassistant.setup] Unable to set up dependencies of my. Setup failed for dependencies: frontend
  115. 2021-06-21 23:30:07 ERROR (MainThread) [homeassistant.setup] Setup failed for my: Could not set up all dependencies.
  116. 2021-06-21 23:30:07 ERROR (MainThread) [homeassistant.setup] Unable to set up dependencies of map. Setup failed for dependencies: frontend
  117. 2021-06-21 23:30:07 ERROR (MainThread) [homeassistant.setup] Setup failed for map: Could not set up all dependencies.
  118. 2021-06-21 23:30:08 ERROR (MainThread) [homeassistant.setup] Unable to set up dependencies of mobile_app. Setup failed for dependencies: person
  119. 2021-06-21 23:30:08 ERROR (MainThread) [homeassistant.setup] Setup failed for mobile_app: Could not set up all dependencies.
  120. 2021-06-21 23:30:08 ERROR (MainThread) [homeassistant.setup] Unable to set up dependencies of default_config. Setup failed for dependencies: dhcp, frontend, logbook, map, mobile_app, my, person
  121. 2021-06-21 23:30:08 ERROR (MainThread) [homeassistant.setup] Setup failed for default_config: Could not set up all dependencies.
  122. 2021-06-21 23:30:08 WARNING (MainThread) [homeassistant.bootstrap] Detected that frontend did not load. Activating safe mode
  123. 2021-06-21 23:30:09 ERROR (MainThread) [homeassistant.setup] Setup failed for image: Unable to import component: cannot import name '_imaging' from 'PIL' (/data/data/com.termux/files/home/homeassistant/lib/python3.9/site-packages/PIL/__init__.py)
  124. 2021-06-21 23:30:09 ERROR (MainThread) [homeassistant.setup] Unable to set up dependencies of person. Setup failed for dependencies: image
  125. 2021-06-21 23:30:09 ERROR (MainThread) [homeassistant.setup] Setup failed for person: Could not set up all dependencies.
  126. 2021-06-21 23:30:09 ERROR (MainThread) [homeassistant.setup] Unable to set up dependencies of onboarding. Setup failed for dependencies: person
  127. 2021-06-21 23:30:09 ERROR (MainThread) [homeassistant.setup] Setup failed for onboarding: Could not set up all dependencies.
  128. 2021-06-21 23:30:09 ERROR (MainThread) [homeassistant.setup] Unable to set up dependencies of frontend. Setup failed for dependencies: onboarding
  129. 2021-06-21 23:30:09 ERROR (MainThread) [homeassistant.setup] Setup failed for frontend: Could not set up all dependencies.
  130. 2021-06-21 23:30:09 ERROR (MainThread) [homeassistant.setup] Unable to set up dependencies of safe_mode. Setup failed for dependencies: frontend
  131. 2021-06-21 23:30:09 ERROR (MainThread) [homeassistant.setup] Setup failed for safe_mode: Could not set up all dependencies.
  132. ^C(homeassistant) ~ $ ^C
复制代码
我的理解是由于第一个报错导致后面的都无法进行下去
  1. (homeassistant) ~ $ hass
  2. 2021-06-21 23:14:46 WARNING (Recorder) [homeassistant.components.recorder.util] The system could not validate that the sqlite3 database at //data/data/com.termux/files/home/.homeassistant/home-assistant_v2.db was shutdown cleanly
  3. 2021-06-21 23:14:46 WARNING (Recorder) [homeassistant.components.recorder.util] Ended unfinished session (id=2 from 2021-06-21 15:11:06.330333)
  4. 2021-06-21 23:14:47 ERROR (MainThread) [homeassistant.setup] Setup failed for image: Unable to import component: cannot import name '_imaging' from 'PIL' (/data/data/com.termux/files/home/homeassistant/lib/python3.9/site-packages/PIL/__init__.py)
复制代码
cannot import name '_imaging' from 'PIL'
搜索很久都没有找到解决方案,希望大神能够解答。拜谢!!

作者: csphhing    时间: 2021-6-22 21:55
本帖最后由 csphhing 于 2021-6-25 00:34 编辑

东摸西索算是解决了报错,手机应用管理,清除termux软件存储内容后,
启动termux→更新软件→安装openssh→设置密码后Xshell连接→apt 安装python(3.9.5)→pip 安装homeassistant→安装成功后 hass→ 报错提示需要Pillow8.1.2→pip在线安装失败→还是报错
如下(部分)  
  1. ~ $ pip install pillow==8.1.2
  2. Looking in indexes: https://mirrors.ustc.edu.cn/pypi/web/simple
  3. Collecting pillow==8.1.2
  4.   Downloading https://mirrors.bfsu.edu.cn/pypi/web/packages/60/f0/dd2eb7911f948bf529f58f0c7931f6f6466f711bd6f1d81a69dc4edd4e2a/Pillow-8.1.2.tar.gz (45.2 MB)
  5.      |████████████████████████████████| 45.2 MB 3.1 MB/s
  6. Using legacy 'setup.py install' for pillow, since package 'wheel' is not installed.
  7. Installing collected packages: pillow
  8.     Running setup.py install for pillow ... error
  9.     ERROR: Command errored out with exit status 1:
  10.      command: /data/data/com.termux/files/usr/bin/python3 -u -c 'import io, os, sys, setuptools, tokenize; sys.argv[0] = '"'"'/data/data/com.termux/files/usr/tmp/pip-install-x_m1lg8s/pillow_b121068ed5574a77a604e927e0a5e23a/setup.py'"'"'; __file__='"'"'/data/data/com.termux/files/usr/tmp/pip-install-x_m1lg8s/pillow_b121068ed5574a77a604e927e0a5e23a/setup.py'"'"';f = getattr(tokenize, '"'"'open'"'"', open)(__file__) if os.path.exists(__file__) else io.StringIO('"'"'from setuptools import setup; setup()'"'"');code = f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' install --record /data/data/com.termux/files/usr/tmp/pip-record-_7tolwbg/install-record.txt --single-version-externally-managed --compile --install-headers /data/data/com.termux/files/usr/include/python3.9/pillow
  11.          cwd: /data/data/com.termux/files/usr/tmp/pip-install-x_m1lg8s/pillow_b121068ed5574a77a604e927e0a5e23a/
复制代码

解决如下:
  1. ~ $ apt install libjpeg-turbo
  2. Reading package lists... Done
  3. Building dependency tree... Done
  4. Reading state information... Done
  5. The following NEW packages will be installed:
  6.   libjpeg-turbo
  7. 0 upgraded, 1 newly installed, 0 to remove and 0 not upgraded.
  8. Need to get 279 kB of archives.
  9. After this operation, 1421 kB of additional disk space will be used.
  10. Get:1 https://packages.termux.org/apt/termux-main stable/main aarch64 libjpeg-turbo aarch64 2.1.0 [279 kB]
  11. Fetched 279 kB in 3s (109 kB/s)        
  12. Selecting previously unselected package libjpeg-turbo.
  13. (Reading database ... 12958 files and directories currently installed.)
  14. Preparing to unpack .../libjpeg-turbo_2.1.0_aarch64.deb ...
  15. Unpacking libjpeg-turbo (2.1.0) ...
  16. Setting up libjpeg-turbo (2.1.0) ...
复制代码
  1. ~ $ pip install pillow==8.1.2
  2. Looking in indexes: https://mirrors.ustc.edu.cn/pypi/web/simple
  3. Collecting pillow==8.1.2
  4.   Downloading https://mirrors.bfsu.edu.cn/pypi/web/packages/60/f0/dd2eb7911f948bf529f58f0c7931f6f6466f711bd6f1d81a69dc4edd4e2a/Pillow-8.1.2.tar.gz (45.2 MB)
  5.      |████████████████████████████████| 45.2 MB 1.5 MB/s
  6. Using legacy 'setup.py install' for pillow, since package 'wheel' is not installed.
  7. Installing collected packages: pillow
  8.     Running setup.py install for pillow ... done
  9. Successfully installed pillow-8.1.2
复制代码





作者: homemaster    时间: 2021-6-22 22:23
我安装完后,注册成功,但设置位置时一直报错,不知道为啥,题主遇到了没?
2021-06-22 21:59:41 ERROR (MainThread) [homeassistant.components.websocket_api.http.connection] [500572089312] Error handling message: Invalid time zone passed in. Valid options can be found here: http://en.wikipedia.org/wiki/List_of_tz_database_time_zones for dictionary value @ data['time_zone']. Got 'America/Denver'
2021-06-22 21:59:52 ERROR (MainThread) [homeassistant.components.websocket_api.http.connection] [500572089312] Error handling message: Invalid time zone passed in. Valid options can be found here: http://en.wikipedia.org/wiki/List_of_tz_database_time_zones for dictionary value @ data['time_zone']. Got 'Asia/Shanghai'

作者: csphhing    时间: 2021-6-23 09:55
homemaster 发表于 2021-6-22 22:23
我安装完后,注册成功,但设置位置时一直报错,不知道为啥,题主遇到了没?
2021-06-22 21:59:41 ERROR (Ma ...

我也有这个报错,问题不在网页上看,要看后台报错代码:Unable to set up dependencies of default_config
但我也不知道怎么解决。
作者: ericccc    时间: 2021-6-29 09:36
在6月初升級到6.2板就出現這個問題了,到官方論壇反映也沒得到回覆...希望重版友們可以一起去官方討論區反映
https://community.home-assistant ... sistant-core/307942




欢迎光临 『瀚思彼岸』» 智能家居技术论坛 (https://bbs.hassbian.com/) Powered by Discuz! X3.5