Error running python script 'No protocol specified, couldn't connect to X server'

Hello,

I am trying to run a test python GUI utilizing Kivy with python3 test.py and get the following:

...
[INFO] Window] Provider: sdl2
No protocol specified
[INFO] Window] Provider: x11(['window_sdl2'] ignored)
No protocol specified
Couldn't connect to X server

What does this mean?

Thanks

Hey @bengur,

Unfortunately it looks like Kivy uses the X11 graphical stack. Whereas Torizon supports Wayland/Weston. Weston on Torizon Article This is largely based on the SoC* (IMX8) lack of support for X11.

I have found some implementations of Kivy on IMX8, but this looks like it requires a yocto build solution and wouldn’t be considered fully supported.

Is this a hard requirement or are you fielding other solutions? Maybe if you can give a bit before information on what your end goal is (via this community post, or a private message) we can help figure out a solution direction.

-Eric

I see, thanks for the reply.

It’s not a hard requirement, we were looking at open source GUI libraries and wanted to build our app with Kivy.

The end goal is just to get a custom app with a gui running on the controller. I know Toradex has support specifically for QT but we’re hoping to avoid licensing for this stage of the project. Do you know if Tkinter works with IMX8?

Hey @bengur,

There are quite a few options, here is our write up on GUI frameworks with some comparison notes.

I tried doing a quick search on Tkinter, but I couldn’t find any quick information. I’ll search a bit much to find out. But wanted to give you that link in the meantime.

-Eric

I have developed smalls samples using Tkinter and at least one of our community members actively uses it. Check the following thread: Containers not running in TorizonCore with evaluation containers for iMX8M-Plus - #23 by leon.tx

Hi @leon.tx,

Thanks for the example code, do I just clone the repo to a debian container on the controller and run docker compose up inside the cloned dir?

I’m currently on a torizon 5 image I built from the base without evaluation containers with torizoncore-builder and deployed over ssh.

I found a flag in the Kivy setup.py for using Wayland, it might actually be supported.

However when I try to do an editable install after cloning the kivy repo I get the following error:

Build path changed to: /tmp/pip-install-lsj2nip_/ffpyplayer_d66fb6ebd072429684d722c41efdf5ae
      Using compiler "unix"
      Using compiler args: ['-O3', '-fno-strict-aliasing', '-Wno-error']
      Using linker args: []
      Compiling /tmp/pip-install-lsj2nip_/ffpyplayer_d66fb6ebd072429684d722c41efdf5ae/ffpyplayer/pic.pyx because it changed.
      [1/1] Cythonizing /tmp/pip-install-lsj2nip_/ffpyplayer_d66fb6ebd072429684d722c41efdf5ae/ffpyplayer/pic.pyx
      building 'ffpyplayer.pic' extension
      creating build/temp.linux-aarch64-cpython-39
      creating build/temp.linux-aarch64-cpython-39/tmp
      creating build/temp.linux-aarch64-cpython-39/tmp/pip-install-lsj2nip_
      creating build/temp.linux-aarch64-cpython-39/tmp/pip-install-lsj2nip_/ffpyplayer_d66fb6ebd072429684d722c41efdf5ae
      creating build/temp.linux-aarch64-cpython-39/tmp/pip-install-lsj2nip_/ffpyplayer_d66fb6ebd072429684d722c41efdf5ae/ffpyplayer
      creating build/temp.linux-aarch64-cpython-39/tmp/pip-install-lsj2nip_/ffpyplayer_d66fb6ebd072429684d722c41efdf5ae/ffpyplayer/clib
      aarch64-linux-gnu-gcc -pthread -Wno-unused-result -Wsign-compare -DNDEBUG -g -fwrapv -O2 -Wall -g -ffile-prefix-map=/build/python3.9-PN012d/python3.9-3.9.2=. -fstack-protector-strong -Wformat -Werror=format-security -g -fwrapv -O2 -fPIC -I/tmp/pip-install-lsj2nip_/ffpyplayer_d66fb6ebd072429684d722c41efdf5ae/ffpyplayer -I/tmp/pip-install-lsj2nip_/ffpyplayer_d66fb6ebd072429684d722c41efdf5ae/ffpyplayer/includes -I/usr/include/python3.9 -c /tmp/pip-install-lsj2nip_/ffpyplayer_d66fb6ebd072429684d722c41efdf5ae/ffpyplayer/clib/misc.c -o build/temp.linux-aarch64-cpython-39/tmp/pip-install-lsj2nip_/ffpyplayer_d66fb6ebd072429684d722c41efdf5ae/ffpyplayer/clib/misc.o -O3 -fno-strict-aliasing -Wno-error
      In file included from /tmp/pip-install-lsj2nip_/ffpyplayer_d66fb6ebd072429684d722c41efdf5ae/ffpyplayer/clib/misc.h:5,
                       from /tmp/pip-install-lsj2nip_/ffpyplayer_d66fb6ebd072429684d722c41efdf5ae/ffpyplayer/clib/misc.c:2:
      /tmp/pip-install-lsj2nip_/ffpyplayer_d66fb6ebd072429684d722c41efdf5ae/ffpyplayer/clib/../includes/ffconfig.h:5:10: fatal error: SDL_version.h: No such file or directory
          5 | #include "SDL_version.h"
            |          ^~~~~~~~~~~~~~~
      compilation terminated.
      error: command '/usr/bin/aarch64-linux-gnu-gcc' failed with exit code 1
      [end of output]
  
  note: This error originates from a subprocess, and is likely not a problem with pip.
  ERROR: Failed building wheel for ffpyplayer

When I looked into installing SDL2 I’m missing a few dependancies that conflict with imx-gpu-viv-wayland. Any ideas?

Can you specify which dependencies? Please post logs from apt-get if possible.

Here’s what I get when I try installing sdl2 and the listed unmet dependancies:

root@verdin-imx8mp-15033899:/home/torizon/kivy# apt-get install libsdl2-dev
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
Some packages could not be installed. This may mean that you have
requested an impossible situation or if you are using the unstable
distribution that some required packages have not yet been created
or been moved out of Incoming.
The following information may help to resolve the situation:

The following packages have unmet dependencies:
 libglu1-mesa-dev : Depends: libgl1-mesa-dev or
                             libgl-dev
 libsdl2-dev : Depends: libegl1-mesa-dev
               Depends: libgl1-mesa-dev
               Depends: libgles-dev
E: Unable to correct problems, you have held broken packages.
root@verdin-imx8mp-15033899:/home/torizon/kivy# apt-get install libegl1-mesa-dev libgl1-mesa-dev libgles-dev
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
Some packages could not be installed. This may mean that you have
requested an impossible situation or if you are using the unstable
distribution that some required packages have not yet been created
or been moved out of Incoming.
The following information may help to resolve the situation:

The following packages have unmet dependencies:
 imx-gpu-viv-wayland : Conflicts: libegl1
                       Conflicts: libgbm1
                       Conflicts: libgl1
                       Conflicts: libgles1
                       Conflicts: libgles2
E: Error, pkgProblemResolver::Resolve generated breaks, this may be caused by held packages.

Is 1mx-gpu-viv-wayland supposed to replace these libraries for Torizon?