sdl2 'Unable to get a Window, abort' Raspberry pi 4 CM4 - reTerminal from seeedstudio

50 views
Skip to first unread message

mjk...@gmail.com

unread,
Mar 23, 2023, 2:48:28 PM3/23/23
to Kivy users support
Hello,

I have had success with Kivy running from the console on Raspberry pi 3B, 3B+ and 4.  Most recently I had set up Raspberry Pi with the 64-bit Raspberry Pi OS and I found almost everything worked better -like a dream. The mouse finally works without the Python module and several data science libraries installed very easily after changing to 64-bit.

However, I ran into a snag when building a new Raspberry Pi reTerminal which uses a CM4.  This has worked on the 32-bit OS and also worked for Python 3.11 and Python 3.9.  I just have to be careful to install the prerequisites and set the environment variables accordingly.
likethis:
KIVY_RPI_VERSION=4
KIVY_SDL2_PATH=/usr/local/lib
KIVY_GL_BACKEND=sdl2
KIVY_NO_ARGS=1
KIVY_TEXT=sdl2
KIVY_WINDOW=sdl2


However, after Numerous tries with various install methods and different Python versions, including the built in 3.9.2, I cannot get past the loading of the Window and get errors like this:

[DEBUG  ] [Cache       ] register <kv.resourcefind> with limit=None, timeout=60
[DEBUG  ] [Cache       ] register <kv.lang> with limit=None, timeout=None
[DEBUG  ] [Cache       ] register <kv.image> with limit=None, timeout=60
[DEBUG  ] [Cache       ] register <kv.atlas> with limit=None, timeout=None
[INFO   ] [Image       ] Providers: img_tex, img_dds, img_sdl2, img_pil (img_ffpyplayer ignored)
[DEBUG  ] [Cache       ] register <kv.texture> with limit=1000, timeout=60
[DEBUG  ] [Cache       ] register <kv.shader> with limit=1000, timeout=3600
[DEBUG  ] [Cache       ] register <kv.graphics.texture> with limit=None, timeout=None
[INFO   ] [Text        ] Provider: sdl2
[DEBUG  ] [App         ] Loading kv </home/pi/archive_install/my.kv>
[DEBUG  ] [App         ] kv </home/pi/archive_install/my.kv> not found
[INFO   ] [Window      ] Provider: sdl2
[DEBUG  ] [Window      ] Provider <x11> ignored by config
[CRITICAL] [Window      ] Unable to find any valuable Window provider. Please enable debug logging (e.g. add -d if running from the command line, or change the log level in the config) and re-run your app to identify potential causes
sdl2 - UnboundLocalError: local variable 'dpi' referenced before assignment
  File "/home/pi/py39/lib/python3.9/site-packages/kivy/core/__init__.py", line 71, in core_select_lib
    cls = cls()
  File "/home/pi/py39/lib/python3.9/site-packages/kivy/core/window/window_sdl2.py", line 165, in __init__
    super(WindowSDL, self).__init__()
  File "/home/pi/py39/lib/python3.9/site-packages/kivy/core/window/__init__.py", line 1102, in __init__
    self.create_window()
  File "/home/pi/py39/lib/python3.9/site-packages/kivy/core/window/window_sdl2.py", line 322, in create_window
    self._update_density_and_dpi()
  File "/home/pi/py39/lib/python3.9/site-packages/kivy/core/window/window_sdl2.py", line 422, in _update_density_and_dpi    if self.dpi != dpi:

[CRITICAL] [App         ] Unable to get a Window, abort.

--------------------

in window_sdl2.py there is a statement that is detecting self._is_desktop and this seems to be evaluating to True from the windows Core but I am not running the code from the desktop.  It must be getting fooled by the 64-bit architecture or some related change.

On different tries, I have had different flavors of error but never get past the Window provider.

Any ideas for further troubleshooting?

thanks!

mjk...@gmail.com

unread,
Mar 23, 2023, 10:26:21 PM3/23/23
to Kivy users support
I changed config.desktop to 0 and this stopped that crash and error from coming up.  I don't recall that I have done anything with that setting before.

now, the application loads and the touchscreen events work, I can see my debug lines run according to the places I touch on the screen.

However, no imaging is drawn on the screen.  This is a curious situation I've never seen before.  All that I see on the screen is the console text.

Any ideas how to troubleshoot this problem?

mjk...@gmail.com

unread,
Mar 24, 2023, 10:46:57 AM3/24/23
to Kivy users support
I have now also tried to run this from the Desktop and the result is the same.  The program runs without a crash (as long as I set the config "desktop = 0" but absolutely nothing is drawn on the desktop or console - there is no window I just see either the original console text or the regular desktop background.  The touch events will fire and my program executes based on the touch events.

I have compiled sdl2 (4 different projects) on this device as instructed in the installation guides.  as I have done many times before on other variations of Raspberry pi OS on other Raspberry pi models.  The new thing here is that I loaded a 64-bit OS image.  However, the 64-bit OS has worked for classic Raspberry pi 3B+ units with HDMI monitors.   It is only this CM4 with a touchscreen, and then only on 64-bit that I get this issue.

I could download and compile a development version of Kivy but I don't know what I would do with it unless guided by some advice.

thanks,
Mark

Elliot Garbus

unread,
Mar 24, 2023, 11:09:54 AM3/24/23
to kivy-...@googlegroups.com

You may have better luck getting an answer on the kivy discord.  There are a few of the Kivy devs on discord.

https://chat.kivy.org

--
You received this message because you are subscribed to the Google Groups "Kivy users support" group.
To unsubscribe from this group and stop receiving emails from it, send an email to kivy-users+...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/kivy-users/5f7c83b6-9755-417a-93af-e8be2f47040dn%40googlegroups.com.

 

Reply all
Reply to author
Forward
Message has been deleted
0 new messages