NiklasReiche / ad-spotify-mood-lights-sync

AppDaemon app that synchronizes rgb lights to the mood of the currently playing spotify song in Home Assistant.
MIT License
35 stars 5 forks source link

Home Assistant OS: ImportError: Error loading shared library libjpeg.so.8 #1

Closed NoxNoctium closed 3 years ago

NoxNoctium commented 3 years ago

On latest Home Assistant OS the following error is logged during app initialization: ImportError: Error loading shared library libjpeg.so.8

Environment:

Addon config:

python_packages:
  - spotipy
  - numpy
  - pillow
init_commands: []

Full log:

[s6-init] making user provided files available at /var/run/s6/etc...exited 0.
[s6-init] ensuring user provided files have correct perms...exited 0.
[fix-attrs.d] applying ownership & permissions fixes...
[fix-attrs.d] done.
[cont-init.d] executing container initialization scripts...
[cont-init.d] 00-banner.sh: executing... 
-----------------------------------------------------------
 Add-on: AppDaemon 4
 Python Apps and Dashboard using AppDaemon 4.x for Home Assistant
-----------------------------------------------------------
 Add-on version: 0.4.3
 You are running the latest version of this add-on.
 System: Home Assistant OS 5.11  (amd64 / qemux86-64)
 Home Assistant Core: 2021.2.2
 Home Assistant Supervisor: 2021.02.8
-----------------------------------------------------------
 Please, share the above information when looking for help
 or support in, e.g., GitHub, forums or the Discord chat.
-----------------------------------------------------------
[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... 
Looking in links: https://wheels.home-assistant.io/alpine-3.13/amd64/
Collecting spotipy
  Downloading spotipy-2.16.1-py3-none-any.whl (24 kB)
Requirement already satisfied: six>=1.10.0 in /usr/lib/python3.8/site-packages (from spotipy) (1.15.0)
Requirement already satisfied: requests>=2.20.0 in /usr/lib/python3.8/site-packages (from spotipy) (2.25.1)
Requirement already satisfied: chardet<5,>=3.0.2 in /usr/lib/python3.8/site-packages (from requests>=2.20.0->spotipy) (3.0.4)
Requirement already satisfied: idna<3.2,>=2.5 in /usr/lib/python3.8/site-packages (from requests>=2.20.0->spotipy) (3.1)
Requirement already satisfied: urllib3<1.27,>=1.21.1 in /usr/lib/python3.8/site-packages (from requests>=2.20.0->spotipy) (1.26.2)
Installing collected packages: spotipy
Successfully installed spotipy-2.16.1
Looking in links: https://wheels.home-assistant.io/alpine-3.13/amd64/
Collecting numpy
  Downloading https://wheels.home-assistant.io/alpine-3.13/amd64/numpy-1.20.1-cp38-none-any.whl (7.3 MB)
Installing collected packages: numpy
Successfully installed numpy-1.20.1
Looking in links: https://wheels.home-assistant.io/alpine-3.13/amd64/
Collecting pillow
  Downloading https://wheels.home-assistant.io/alpine-3.13/amd64/Pillow-8.1.0-cp38-none-any.whl (551 kB)
Installing collected packages: pillow
Successfully installed pillow-8.1.0
[cont-init.d] appdaemon.sh: exited 0.
[cont-init.d] done.
[services.d] starting services
[services.d] done.
[00:36:12] INFO: Starting AppDaemon...
2021-02-10 00:36:13.525402 INFO AppDaemon: AppDaemon Version 4.0.5 starting
2021-02-10 00:36:13.525727 INFO AppDaemon: Python version is 3.8.7
2021-02-10 00:36:13.525931 INFO AppDaemon: Configuration read from: /config/appdaemon/appdaemon.yaml
2021-02-10 00:36:13.526114 INFO AppDaemon: Added log: AppDaemon
2021-02-10 00:36:13.526319 INFO AppDaemon: Added log: Error
2021-02-10 00:36:13.526541 INFO AppDaemon: Added log: Access
2021-02-10 00:36:13.526938 INFO AppDaemon: Added log: Diag
2021-02-10 00:36:13.554569 INFO AppDaemon: Loading Plugin HASS using class HassPlugin from module hassplugin
2021-02-10 00:36:13.678427 INFO HASS: HASS Plugin Initializing
2021-02-10 00:36:13.678794 INFO HASS: HASS Plugin initialization complete
2021-02-10 00:36:13.679420 INFO AppDaemon: Initializing HTTP
2021-02-10 00:36:13.679892 INFO AppDaemon: Using 'ws' for event stream
2021-02-10 00:36:13.683521 INFO AppDaemon: Starting API
2021-02-10 00:36:13.686339 INFO AppDaemon: Starting Admin Interface
2021-02-10 00:36:13.686853 INFO AppDaemon: Starting Dashboards
2021-02-10 00:36:13.720910 INFO HASS: Connected to Home Assistant 2021.2.2
2021-02-10 00:36:13.808097 INFO AppDaemon: App 'spotify_mood_lights_sync' added
2021-02-10 00:36:13.809234 INFO AppDaemon: Found 1 total apps
2021-02-10 00:36:13.809781 INFO AppDaemon: Starting Apps with 1 workers and 1 pins
2021-02-10 00:36:13.810653 INFO AppDaemon: Running on port 5050
2021-02-10 00:36:13.823377 INFO HASS: Evaluating startup conditions
2021-02-10 00:36:13.834840 INFO HASS: Startup condition met: hass state=RUNNING
2021-02-10 00:36:13.835131 INFO HASS: All startup conditions met
2021-02-10 00:36:13.895732 INFO AppDaemon: Got initial state from namespace default
2021-02-10 00:36:15.816855 INFO AppDaemon: Scheduler running in realtime
2021-02-10 00:36:15.831261 INFO AppDaemon: Adding /config/appdaemon/apps to module import path
2021-02-10 00:36:15.831783 INFO AppDaemon: Adding /config/appdaemon/apps/ad-spotify-mood-lights-sync to module import path
2021-02-10 00:36:15.832198 INFO AppDaemon: Adding /config/appdaemon/apps/ad-automoli to module import path
2021-02-10 00:36:15.835712 INFO AppDaemon: Loading App Module: /config/appdaemon/apps/ad-spotify-mood-lights-sync/spotify_mood_lights_sync.py
2021-02-10 00:36:15.850066 WARNING AppDaemon: No app description found for: /config/appdaemon/apps/ad-automoli/automoli.py - ignoring
2021-02-10 00:36:15.851434 INFO AppDaemon: Initializing app spotify_mood_lights_sync using class SpotifyMoodLightsSync from module spotify_mood_lights_sync
2021-02-10 00:36:15.866819 WARNING spotify_mood_lights_sync: ------------------------------------------------------------
2021-02-10 00:36:15.867197 WARNING spotify_mood_lights_sync: Unexpected error running initialize() for spotify_mood_lights_sync
2021-02-10 00:36:15.867377 WARNING spotify_mood_lights_sync: ------------------------------------------------------------
2021-02-10 00:36:15.873684 WARNING spotify_mood_lights_sync: Traceback (most recent call last):
  File "/usr/lib/python3.8/site-packages/appdaemon/app_management.py", line 150, in initialize_app
    await utils.run_in_executor(self, init)
  File "/usr/lib/python3.8/site-packages/appdaemon/utils.py", line 290, in run_in_executor
    response = future.result()
  File "/usr/lib/python3.8/concurrent/futures/thread.py", line 57, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/config/appdaemon/apps/ad-spotify-mood-lights-sync/spotify_mood_lights_sync.py", line 56, in initialize
    from PIL import Image
  File "/usr/lib/python3.8/site-packages/PIL/Image.py", line 94, in <module>
    from . import _imaging as core
ImportError: Error loading shared library libjpeg.so.8: No such file or directory (needed by /usr/lib/python3.8/site-packages/PIL/_imaging.cpython-38-x86_64-linux-gnu.so)
2021-02-10 00:36:15.874037 WARNING spotify_mood_lights_sync: ------------------------------------------------------------
2021-02-10 00:36:15.875642 INFO AppDaemon: App initialization complete
unlobito commented 3 years ago

Heyo, I ran into the same issue. It seems you'll need to add jpeg and tiff to system_packages as well. I did this by adding the following lines to my AppDaemon config in addition to the python_packages config you've posted:

system_packages:
  - jpeg
  - tiff

You may also need to download https://github.com/NiklasReiche/ad-spotify-mood-lights-sync/blob/master/examples/default_profile.png to /config/www/spotify-lights-sync/test.png

Hope this helps!

NoxNoctium commented 3 years ago

Heyo, I ran into the same issue. It seems you'll need to add jpeg and tiff to system_packages as well. I did this by adding the following lines to my AppDaemon config in addition to the python_packages config you've posted:

system_packages:
  - jpeg
  - tiff

Hi, adding jpeg and tiff to system_packages indeed fixed it, thanks!

You may also need to download https://github.com/NiklasReiche/ad-spotify-mood-lights-sync/blob/master/examples/default_profile.png to /config/www/spotify-lights-sync/test.png

It seems the default_profile.png is downloaded/copied into any specified directory automatically.

I'll leave this issue open as a heads-up for now.

NiklasReiche commented 3 years ago

Hey, thanks for the heads-up.

I am currently running Home Assistant core and AppDaemon directly in a Python environment, so I can't easily test the dependencies. I will add a note on using jpeg and tiff to the readme for now.

Regarding the default_profile.png image file, you shouldn't need to download anything. The file is created once on startup and placed at the location specified in the config. The image itself is never used by the app. It's just an easy way to visualize and debug a custom color profile, in case you don't want to use the default one. If you don't need this functionality you can also simply remove the color_map_image option from your config. In that case jpeg and tiff might also not be necessary, since pillow never gets imported.

NoxNoctium commented 3 years ago

If you don't need this functionality you can also simply remove the color_map_image option from your config. In that case jpeg and tiff might also not be necessary, since pillow never gets imported.

Hi, just tried the "minimal" configuration, you are right, jpeg, tiff and pillow are not needed in this case. As this is now documented I'll close the issue. Thanks!