GStreamer on Docker

I’m trying to convert my venv to docker and the last thing I’m having issues with is getting gstreamer to work. I’ve added -v /usr/lib/python3/dist-packages/gi:/usr/local/lib/python3.8/site-packages/gi to my command and symlinked _gi.cpython-37m-arm-linux-gnueabihf.so to _gi.cpython-38m-arm-linux-gnueabihf.so but I still get the error:

2020-12-07 12:51:03 ERROR (MainThread) [homeassistant.config] Platform error: media_player
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/config.py", line 823, in async_process_component_config
    platform = p_integration.get_platform(domain)
  File "/usr/src/homeassistant/homeassistant/loader.py", line 424, in get_platform
    cache[full_name] = self._import_platform(platform_name)
  File "/usr/src/homeassistant/homeassistant/loader.py", line 429, in _import_platform
    return importlib.import_module(f"{self.pkg_path}.{platform_name}")
  File "/usr/local/lib/python3.8/importlib/__init__.py", line 127, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
  File "<frozen importlib._bootstrap>", line 1014, in _gcd_import
  File "<frozen importlib._bootstrap>", line 991, in _find_and_load
  File "<frozen importlib._bootstrap>", line 975, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 671, in _load_unlocked
  File "<frozen importlib._bootstrap_external>", line 783, in exec_module
  File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed
  File "/usr/src/homeassistant/homeassistant/components/gstreamer/media_player.py", line 4, in <module>
    from gsp import GstreamerPlayer
  File "/usr/local/lib/python3.8/site-packages/gsp/__init__.py", line 11, in <module>
    import gi  # pylint: disable=import-error
  File "/usr/local/lib/python3.8/site-packages/gi/__init__.py", line 42, in <module>
    from . import _gi
ImportError: cannot import name '_gi' from partially initialized module 'gi' (most likely due to a circular import) (/usr/local/lib/python3.8/site-packages/gi/__init__.py)

Has anyone been able to get it to work in docker?

I figured it out. It’s not _gi.cpython-38m-arm-linux-gnueabihf.so, it’s _gi.cpython-38-arm-linux-gnueabihf.so

1 Like

Is there a way to not depend on the Python version? Now I had to use 3.9 with the last image.

And even copying the *.so, I get
ImportError: Error relocating /usr/local/lib/python3.9/site-packages/gi/_gi.cpython-39-arm-linux-gnueabihf.so: __memcpy_chk: symbol not found
on a raspberry pi.