hassio-addons/addon-appdaemon3

Impossible to use Pillow

CrazYoshi opened this issue · 10 comments

Problem/Motivation

I would like to use Pillow library in Hassio AppDaemon addon 4.0.3 but I'm not able to make it works.
I correctly added Pillow in my python_packages addon configuration

Expected behavior

AppDaemon start and load Pillow python package in order to use it in my MQTT app.

Actual behavior

`2019-09-18 14:51:46.848696 INFO AppDaemon Version 3.0.5 starting
2019-09-18 14:51:46.849731 INFO Configuration read from: /config/appdaemon/appdaemon.yaml
2019-09-18 14:51:46.854672 INFO AppDaemon: Starting Apps
2019-09-18 14:51:46.864382 INFO AppDaemon: Loading Plugin HASS using class HassPlugin from module hassplugin
2019-09-18 14:51:47.389537 INFO AppDaemon: HASS: HASS Plugin Initializing
2019-09-18 14:51:47.390641 INFO AppDaemon: HASS: HASS Plugin initialization complete
2019-09-18 14:51:47.391383 INFO AppDaemon: Loading Plugin MQTT using class MqttPlugin from module mqttplugin
2019-09-18 14:51:47.409693 INFO AppDaemon: MQTT: MQTT Plugin Initializing
2019-09-18 14:51:47.410638 INFO AppDaemon: MQTT: Using 'mqtt client status' as Will Topic
2019-09-18 14:51:47.411503 INFO AppDaemon: MQTT: Using 'mqtt client status' as Birth Topic
2019-09-18 14:51:47.412366 INFO AppDaemon: MQTT: Using 'appdaemon_mqtt_client' as Client ID
2019-09-18 14:51:47.414851 INFO Starting Dashboards
2019-09-18 14:51:47.442681 INFO API is disabled
2019-09-18 14:51:47.477778 INFO AppDaemon: HASS: Connected to Home Assistant 0.98.5
2019-09-18 14:51:47.631615 INFO AppDaemon: Got initial state from namespace default
2019-09-18 14:51:49.898925 INFO AppDaemon: MQTT: Connected to Broker at URL 192.168.1.6:1883
2019-09-18 14:51:50.500191 INFO AppDaemon: Got initial state from namespace mqtt
2019-09-18 14:51:50.500992 INFO AppDaemon: MQTT: MQTT Plugin initialization complete
2019-09-18 14:51:51.703038 INFO AppDaemon: Reading config
2019-09-18 14:51:51.717754 INFO AppDaemon: /config/appdaemon/apps/apps.yaml added or modified
2019-09-18 14:51:51.719099 INFO AppDaemon: /config/appdaemon/apps/apps.yaml added or modified
2019-09-18 14:51:51.719546 INFO AppDaemon: App 'telegram_bot' added
2019-09-18 14:51:51.719928 INFO AppDaemon: App 'heating_bot' added
2019-09-18 14:51:51.720293 INFO AppDaemon: App 'ir_remote' added
2019-09-18 14:51:51.720641 INFO AppDaemon: App 'mqtt_handler' added
2019-09-18 14:51:51.721229 INFO AppDaemon: Adding /config/appdaemon/apps to module import path
2019-09-18 14:51:51.723176 INFO AppDaemon: Loading App Module: /config/appdaemon/apps/mqtt_handler.py
2019-09-18 14:51:51.765175 WARNING AppDaemon: ------------------------------------------------------------
2019-09-18 14:51:51.765832 WARNING AppDaemon: Unexpected error loading module: /config/appdaemon/apps/mqtt_handler.py:
2019-09-18 14:51:51.766395 WARNING AppDaemon: ------------------------------------------------------------
2019-09-18 14:51:51.773964 WARNING AppDaemon: Traceback (most recent call last):
File "/usr/lib/python3.7/site-packages/appdaemon/appdaemon.py", line 2026, in check_app_updates
self.read_app(mod["name"], mod["reload"])
File "/usr/lib/python3.7/site-packages/appdaemon/appdaemon.py", line 1809, in read_app
self.modules[module_name] = importlib.import_module(module_name)
File "/usr/lib/python3.7/importlib/init.py", line 127, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File "", line 1006, in _gcd_import
File "", line 983, in _find_and_load
File "", line 967, in _find_and_load_unlocked
File "", line 677, in _load_unlocked
File "", line 728, in exec_module
File "", line 219, in _call_with_frames_removed
File "/config/appdaemon/apps/mqtt_handler.py", line 3, in
from PIL import Image, ImageDraw
File "/usr/lib/python3.7/site-packages/PIL/Image.py", line 95, in
from . import _imaging as core
ImportError: Error loading shared library libjpeg.so.8: No such file or directory (needed by /usr/lib/python3.7/site-packages/PIL/_imaging.cpython-37m-aarch64-linux-gnu.so)

2019-09-18 14:51:51.774566 WARNING AppDaemon: ------------------------------------------------------------
2019-09-18 14:51:51.775028 WARNING AppDaemon: Removing associated apps:
2019-09-18 14:51:51.775554 WARNING AppDaemon: mqtt_handler`

Steps to reproduce

My plugin configuration
{ "disable_auto_token": true, "system_packages": [], "python_packages": [ "transmissionrpc", "Pillow" ] }

Proposed changes

Could you please give me some hint about resolving this issue?

👋 Thanks for opening your first issue here! If you're reporting a 🐛 bug, please make sure you include steps to reproduce it. Also, logs, error messages and information about your hardware might be usefull.

I just performed a fresh install which loads fine with your config, as per the logs the exception is at /config/appdaemon/apps/mqtt_handler.py
Maybe remove the mqtt_handler app and see if loads to locate your issue?

Looking further through the logs, looks like you need the package that contains libjpeg.so.8, which I would assume is libjpeg-turbo ?

So try "system_packages": [ "libjpeg-turbo" ],

edit - Or maybe just libjpeg, as I can't duplicate I can't tell you.

In my app i'm using:
from PIL import Image, ImageDraw
If I comment out the app AppDaemon doesn't give any exception but there is no app that is currently using Pillow.
So it seems that something goes wrong when Pillow library is imported.
How can I solve this issue?

Please see my last comment File "/usr/lib/python3.7/site-packages/PIL/Image.py", line 95, in from . import _imaging as core ImportError: Error loading shared library libjpeg.so.8: No such file or directory (needed by /usr/lib/python3.7/site-packages/PIL/_imaging.cpython-37m-aarch64-linux-gnu.so)

Please see my last comment File "/usr/lib/python3.7/site-packages/PIL/Image.py", line 95, in from . import _imaging as core ImportError: Error loading shared library libjpeg.so.8: No such file or directory (needed by /usr/lib/python3.7/site-packages/PIL/_imaging.cpython-37m-aarch64-linux-gnu.so)

Hi,
I already found this post and I also try to set the following configuration without success:
{ "log_level": "info", "disable_auto_token": false, "system_packages": [ "libcurl", "zlib-dev", "libjpeg-turbo-dev", "libwebp", "tk", "openjpeg", "python3-dev", "curl-dev", "gcc", "g++" ], "python_packages": [ "pip==19.0.3", "pycurl", "Pillow" ] }

Using this one I receive a fatal error and AppDeamon stop working.
I'm currently running AppDaemon plugin on Hassio on a Orange Pi 3 based on Armbian.

This is the log using libjpeg-turbo:

[cont-init.d] 00-banner.sh: exited 0.
[cont-init.d] 01-log-level.sh: executing...
[cont-init.d] 01-log-level.sh: exited 0.
[cont-init.d] appdaemon.sh: executing...
[00:51:15] WARNING: You are using an non-recommended Home Assistant URL!
[00:51:15] WARNING: Setting the "ha_url" option in your AppDaemon config to
[00:51:15] WARNING: "http://hassio/homeassistant" is recommended!
fetch http://dl-cdn.alpinelinux.org/alpine/v3.10/main/aarch64/APKINDEX.tar.gz
fetch http://dl-cdn.alpinelinux.org/alpine/v3.10/community/aarch64/APKINDEX.tar.gz
fetch http://dl-cdn.alpinelinux.org/alpine/edge/main/aarch64/APKINDEX.tar.gz
fetch http://dl-cdn.alpinelinux.org/alpine/edge/community/aarch64/APKINDEX.tar.gz
fetch http://dl-cdn.alpinelinux.org/alpine/edge/testing/aarch64/APKINDEX.tar.gz
v3.10.2-58-g4942958220 [http://dl-cdn.alpinelinux.org/alpine/v3.10/main]
v3.10.2-42-g95d37f7648 [http://dl-cdn.alpinelinux.org/alpine/v3.10/community]
v20190809-2823-g6aec617409 [http://dl-cdn.alpinelinux.org/alpine/edge/main]
v20190809-2825-gc453f9863d [http://dl-cdn.alpinelinux.org/alpine/edge/community]
v20190809-2825-gc453f9863d [http://dl-cdn.alpinelinux.org/alpine/edge/testing]
OK: 24725 distinct packages available
(1/1) Installing libjpeg-turbo (2.0.2-r0)
OK: 77 MiB in 34 packages
Looking in links: https://wheels.hass.io/alpine-3.10/aarch64/
Collecting transmissionrpc
Downloading https://wheels.hass.io/alpine-3.10/aarch64/transmissionrpc-0.11-py3-none-any.whl
Requirement already satisfied: six>=1.1.0 in /usr/lib/python3.7/site-packages (from transmissionrpc) (1.12.0)
Installing collected packages: transmissionrpc
Successfully installed transmissionrpc-0.11
You are using pip version 19.0.3, however version 19.2.3 is available.
You should consider upgrading via the 'pip install --upgrade pip' command.
Looking in links: https://wheels.hass.io/alpine-3.10/aarch64/
Collecting Pillow
Downloading https://wheels.hass.io/alpine-3.10/aarch64/Pillow-6.1.0-cp37-none-any.whl (1.2MB)
Installing collected packages: Pillow
Successfully installed Pillow-6.1.0
You are using pip version 19.0.3, however version 19.2.3 is available.
You should consider upgrading via the 'pip install --upgrade pip' command.
[cont-init.d] appdaemon.sh: exited 0.
[cont-init.d] done.
[services.d] starting services
[services.d] done.
[00:51:34] INFO: Starting AppDaemon...
2019-09-19 00:51:36.465085 INFO AppDaemon Version 3.0.5 starting
2019-09-19 00:51:36.465724 INFO Configuration read from: /config/appdaemon/appdaemon.yaml
2019-09-19 00:51:36.468765 INFO AppDaemon: Starting Apps
2019-09-19 00:51:36.477553 INFO AppDaemon: Loading Plugin HASS using class HassPlugin from module hassplugin
2019-09-19 00:51:36.933698 INFO AppDaemon: HASS: HASS Plugin Initializing
2019-09-19 00:51:36.934774 INFO AppDaemon: HASS: HASS Plugin initialization complete
2019-09-19 00:51:36.935511 INFO AppDaemon: Loading Plugin MQTT using class MqttPlugin from module mqttplugin
2019-09-19 00:51:36.949323 INFO AppDaemon: MQTT: MQTT Plugin Initializing
2019-09-19 00:51:36.949892 INFO AppDaemon: MQTT: Using 'mqtt client status' as Will Topic
2019-09-19 00:51:36.950321 INFO AppDaemon: MQTT: Using 'mqtt client status' as Birth Topic
2019-09-19 00:51:36.950723 INFO AppDaemon: MQTT: Using 'appdaemon_mqtt_client' as Client ID
2019-09-19 00:51:36.952539 INFO Starting Dashboards
2019-09-19 00:51:36.972154 INFO API is disabled
2019-09-19 00:51:37.008075 INFO AppDaemon: HASS: Connected to Home Assistant 0.98.5
2019-09-19 00:51:37.017250 INFO AppDaemon: MQTT: Connected to Broker at URL 192.168.1.6:1883
2019-09-19 00:51:37.074476 INFO AppDaemon: Got initial state from namespace mqtt
2019-09-19 00:51:37.075210 INFO AppDaemon: MQTT: MQTT Plugin initialization complete
2019-09-19 00:51:37.202222 INFO AppDaemon: Got initial state from namespace default
2019-09-19 00:51:39.194151 INFO AppDaemon: Reading config
2019-09-19 00:51:39.207688 INFO AppDaemon: /config/appdaemon/apps/apps.yaml added or modified
2019-09-19 00:51:39.208225 INFO AppDaemon: /config/appdaemon/apps/apps.yaml added or modified
2019-09-19 00:51:39.208717 INFO AppDaemon: App 'telegram_bot' added
2019-09-19 00:51:39.209109 INFO AppDaemon: App 'heating_bot' added
2019-09-19 00:51:39.209459 INFO AppDaemon: App 'ir_remote' added
2019-09-19 00:51:39.209795 INFO AppDaemon: App 'mqtt_handler' added
2019-09-19 00:51:39.210367 INFO AppDaemon: Adding /config/appdaemon/apps to module import path
2019-09-19 00:51:39.212203 INFO AppDaemon: Loading App Module: /config/appdaemon/apps/mqtt_handler.py
2019-09-19 00:51:39.247620 WARNING AppDaemon: ------------------------------------------------------------
2019-09-19 00:51:39.248188 WARNING AppDaemon: Unexpected error loading module: /config/appdaemon/apps/mqtt_handler.py:
2019-09-19 00:51:39.248703 WARNING AppDaemon: ------------------------------------------------------------
2019-09-19 00:51:39.260766 WARNING AppDaemon: Traceback (most recent call last):
File "/usr/lib/python3.7/site-packages/appdaemon/appdaemon.py", line 2026, in check_app_updates
self.read_app(mod["name"], mod["reload"])
File "/usr/lib/python3.7/site-packages/appdaemon/appdaemon.py", line 1809, in read_app
self.modules[module_name] = importlib.import_module(module_name)
File "/usr/lib/python3.7/importlib/init.py", line 127, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File "", line 1006, in _gcd_import
File "", line 983, in _find_and_load
File "", line 967, in _find_and_load_unlocked
File "", line 677, in _load_unlocked
File "", line 728, in exec_module
File "", line 219, in _call_with_frames_removed
File "/config/appdaemon/apps/mqtt_handler.py", line 3, in
from PIL import Image, ImageDraw
File "/usr/lib/python3.7/site-packages/PIL/Image.py", line 95, in
from . import _imaging as core
ImportError: Error loading shared library libtiff.so.5: No such file or directory (needed by /usr/lib/python3.7/site-packages/PIL/_imaging.cpython-37m-aarch64-linux-gnu.so)

2019-09-19 00:51:39.261627 WARNING AppDaemon: ------------------------------------------------------------
2019-09-19 00:51:39.262389 WARNING AppDaemon: Removing associated apps:
2019-09-19 00:51:39.263293 WARNING AppDaemon: mqtt_handler
2019-09-19 00:51:39.265485 INFO AppDaemon: Loading App Module: /config/appdaemon/apps/telegram_bot.py
2019-09-19 00:51:39.302400 INFO AppDaemon: Loading App Module: /config/appdaemon/apps/heating_bot.py
2019-09-19 00:51:39.306044 INFO AppDaemon: Loading App Module: /config/appdaemon/apps/ir_remote.py
2019-09-19 00:51:39.309493 INFO AppDaemon: Initializing app telegram_bot using class TelegramBotEventListener from module telegram_bot
2019-09-19 00:51:39.312277 INFO AppDaemon: Initializing app heating_bot using class HeatingBotEventListener from module heating_bot
2019-09-19 00:51:39.315439 INFO AppDaemon: Initializing app ir_remote using class IrRemoteEventListener from module ir_remote
2019-09-19 00:51:39.319337 INFO AppDaemon: App initialization complete

So you are now missing the library that contains libtiff.so.5. Goto https://pkgs.alpinelinux.org/contents select 3.10 and search for the contents, for example https://pkgs.alpinelinux.org/contents?file=libtiff.so.5&path=&name=&branch=v3.10

I'm going to close this as it isn't an addon issue, suggest using Discord if you need to troubleshoot.

I already contact support on Discord both about AppDaemon, AppDaemon plugin and Hassio and everybody say this is not an issue on their side. So, who is in charge of this? I cannot install packages on Hassio and cause they are automatically manage by the plugin.
How can you say it is not an issue on plugin side?

Simply put, as you aren't importing the correct system packages, if you were to post the "app"/python file you are using, we could probably tell you the exact config to use.

I should also add, you can install packages, you have already been given examples on what to do and how to find them.

This thread has been automatically locked because it has not had recent activity. Please open a new issue for related bugs and link to relevant comments in this thread.