Skip to content

ImageFilter imports numpy, causes issues on Arch Linux #59

@dkoch84

Description

@dkoch84

Hello, see the following log:

2021-07-28 17:05:28.893 T:140612710434368   ERROR: EXCEPTION Thrown (PythonToCppException) : -->Python callback/script returned the following error<--
                                             - NOTE: IGNORING THIS CAN LEAD TO MEMORY LEAKS!
                                            Error Type: <type 'exceptions.RuntimeError'>
                                            Error Contents: implement_array_function method already has a docstring
                                            Traceback (most recent call last):
                                              File "/home/daniel/.kodi/addons/script.embuary.helper/plugin.py", line 16, in <module>
                                                from resources.lib.plugin_content import *
                                              File "/home/daniel/.kodi/addons/script.embuary.helper/resources/lib/plugin_content.py", line 11, in <module>
                                                from resources.lib.image import *
                                              File "/home/daniel/.kodi/addons/script.embuary.helper/resources/lib/image.py", line 12, in <module>
                                                from PIL import ImageFilter,Image,ImageOps
                                              File "/usr/lib/python2.7/site-packages/PIL/ImageFilter.py", line 23, in <module>
                                                import numpy
                                              File "/usr/lib/python2.7/site-packages/numpy/__init__.py", line 142, in <module>
                                                from . import core
                                              File "/usr/lib/python2.7/site-packages/numpy/core/__init__.py", line 40, in <module>
                                                from . import multiarray
                                              File "/usr/lib/python2.7/site-packages/numpy/core/multiarray.py", line 13, in <module>
                                                from . import overrides
                                              File "/usr/lib/python2.7/site-packages/numpy/core/overrides.py", line 46, in <module>
                                                """)
                                            RuntimeError: implement_array_function method already has a docstring
                                            -->End of Python script error report<--

This reply from a numpy maintainer could very well be important: numpy/numpy#18848

"I'm sorry you are getting bounced around from repo to repo, but there's no bug in numpy that we re-introduced recently. numpy has never supported being run in Python sub-interpreters. Probably what changed is something in one of the Kodi plugins, like TMDbHelper, causing an import of numpy (probably through Pillow). If Kodi has moved to using sub-interpreters, all of the plugins will have to studiously avoid importing numpy entirely."

For my own purposes, I worked around the issue by simply removing the refrerence to ImageFilter, lines 12 and 76. I do not use this enough to know whether or not that breaks anything else, so I don't want to submit a PR, but I will if you think it appropriate. Essentially, l've lost the gaussian blur here.

                img = img.filter(ImageFilter.GaussianBlur(self.radius))

Thanks for the awesome addon(s) by the way, much appreciated.

Kindly,
Daniel

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions