Kodi plugin python Pillow dependency

I am running the latest version of Kodi from unstable(21.2). I want to use a skin that has a dependency on python pillow(Arctic Fuse 2). Which from what I can see here should be in its path. But the skin(and its dependencies) still give errors when trying to import PIL.

2025-04-13 23:26:28.444 T:4858    error <general>:   File "/home/kodi/.kodi/addons/plugin.video.themoviedb.helper/resources/tmdbhelper/lib/monitor/images.py", line 33, in wrapper

2025-04-13 23:26:28.444 T:4858    error <general>:
2025-04-13 23:26:28.444 T:4858    error <general>:
2025-04-13 23:26:28.444 T:4858    error <general>: from PIL import ImageFilter
2025-04-13 23:26:28.444 T:4858    error <general>:

2025-04-13 23:26:28.444 T:4858    error <general>:
2025-04-13 23:26:28.444 T:4858    error <general>: ModuleNotFoundError
2025-04-13 23:26:28.444 T:4858    error <general>: :
2025-04-13 23:26:28.444 T:4858    error <general>: No module named 'PIL'
2025-04-13 23:26:28.444 T:4858    error <general>:

2025-04-13 23:26:28.478 T:4742     info <general>: script.skinvariables - update_xml:  0.032 sec
2025-04-13 23:26:28.557 T:4860    error <general>: EXCEPTION Thrown (PythonToCppException) : -->Python callback/script returned the following error<--
                                                    - NOTE: IGNORING THIS CAN LEAD TO MEMORY LEAKS!
                                                   Error Type: <class 'ModuleNotFoundError'>
                                                   Error Contents: No module named 'PIL'
                                                   Traceback (most recent call last):
                                                     File "/home/kodi/.kodi/addons/script.texturemaker/script.py", line 5, in <module>
                                                       from resources.lib.script import Script
                                                     File "/home/kodi/.kodi/addons/script.texturemaker/resources/lib/script.py", line 11, in <module>
                                                       from PIL import Image, ImageChops
                                                   ModuleNotFoundError: No module named 'PIL'
                                                   -->End of Python script error report<--

This thread mentions the same issue, albeit for a different skin/plugin. But the fix mentioned in the last comment doesn’t seem to work for me. Do I need to set something in my config to make pillow available to all Kodi plugins?

i don’t get that issue :thinking:

i ran into some missing dependencies, so i packaged them… then everything worked fine

i’ll make a PR in the next few days and you can test

nice skin btw… i haven’t changed in years, maybe this is a good time to switch things up

Did you run it via a Nix package or via Kodi? Cause I was running it via reglar Kodi add on management. So that might have been it.

most kodi skins follow the horrifying practice of modifying their source code at runtime - so you won’t see them packaged for any os

i packaged the missing dependencies and then installed the skin via kodi

what nix expression did you use for kodi?

I installed kodi-wayland as a regular system package.

{ config, pkgs, lib, ... }:

{
  options.homelab.kodi = lib.mkEnableOption "Enable autostart Kodi";
  config = lib.mkIf config.homelab.kodi {
    environment.systemPackages = [
      (
        pkgs.unstable.kodi-wayland.withPackages (kodiPkgs: with kodiPkgs; [
          jellyfin
        ])
      )
    ];
    users.users.kodi = {
      extraGroups = [ "media" ];
      isNormalUser = true;
    };
    services.cage = {
      enable = true;
      user = "kodi";
      program = "${pkgs.unstable.kodi-wayland}/bin/kodi-standalone";
      extraArguments = [ "-s" ];
    };
    hardware.bluetooth.enable = true;
    networking.firewall.allowedTCPPorts = [ 7070 ];
    networking.firewall.allowedUDPPorts = [ 7070 ];
  };
}

can you test this and let me know if it works for you?

when I try to enable them according to the documentation in the wiki the addons don’t show up in my adddons in kodi. And I see the following error in the logs

  40   │ 2025-04-16 16:28:39.280 T:4046    error <general>: GetDirectory - Error getting /nix/store/5g33i5yaq6yfxrfnz0z548yhsh256g2c-kodi-21.2/lib/kodi/addons
  41   │ 2025-04-16 16:28:39.280 T:4046    error <general>: GetDirectory - Error getting special://xbmcbin/addons

This is my configuration:

  environment.systemPackages = with pkgs; [
    (pkgs.kodi-wayland.withPackages (kodiPkgs: with kodiPkgs; [
      jurialmunkey
      robotocjksc
      texturemaker
    ]))
  ];

When I look in the nix store the kodi dir exists, but the addons directory that kodi is trying to access does not.

Edit: I think the plugins, or at least some dependencies do get loaded behind the screens. Cause the skin seems to work with the plugins installed this way, but not without them in withPackages.

so you’re up and running? excellent

yeah, it looks like the pillow dependency isn’t being added unless you use withPackages
maybe the original intention was that if you were using python based plugins you’ll need withPackages anyways, but it was too long ago and i can’t remember


are you satisfied with the solution we have now?

ah that makes sense. This solution works great, thank you so much

1 Like