Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Execute App from console without Desktop Environment (Pi OS Lite Bullseye 64 bits) #7922

Closed
drmelectronic opened this issue Jul 22, 2022 · 4 comments

Comments

@drmelectronic
Copy link

Software Versions

  • Python: 3.9.2
  • OS: Pi Os Lite Bullseye with no Desktop Environment
  • Kivy: 2.1.0
  • Kivy installation method: pip

Describe the bug
If I try to run an kivy example from console I have a error message: Couldn't connect to X server

Expected behavior
Years ago with kivy 1.11, python2.7 and raspbian stretch i was able to run my app from console. I could even make it run at startup as service, or with supervisor.

To Reproduce
From a fresh copy of Pi Os Lite Bullseye 64 bits (without Desktop Environment) install dependencies, I don't know if all are required, I just followed the instructions with a little change on libgstreamer-plugins-base1.0-0:arm64 and gstreamer1.0-alsa.

sudo apt update
sudo apt install python3-setuptools git-core python3-dev
sudo apt install pkg-config libgl1-mesa-dev libgles2-mesa-dev libgstreamer1.0-dev libgstreamer-plugins-base1.0-0:arm64 gstreamer1.0-alsa libmtdev-dev xclip xsel libjpeg-dev
sudo apt install libfreetype6-dev libgl1-mesa-dev libgles2-mesa-dev libdrm-dev libgbm-dev libudev-dev libasound2-dev liblzma-dev libjpeg-dev libtiff-dev libwebp-dev git build-essential gir1.2-ibus-1.0 libdbus-1-dev libegl1-mesa-dev libibus-1.0-5 libibus-1.0-dev libice-dev libsm-dev libsndio-dev libwayland-bin libwayland-dev libxi-dev libxinerama-dev libxkbcommon-dev libxrandr-dev libxss-dev libxt-dev libxv-dev x11proto-randr-dev x11proto-scrnsaver-dev x11proto-video-dev x11proto-xinerama-dev
sudo apt install libsdl2-dev python3-sdl2
sudo apt install xinit
sudo apt install python3-pip git
python3 -m pip install Kivy kivy_examples

If execute the kivy example from console on raspberry screen or ssh session, I have this error:

ticketera@ticketera:~ $ python ~/.local/share/kivy-examples/3Drendering/main.py -d
[INFO   ] [Logger      ] Record log in /home/ticketera/.kivy/logs/kivy_22-07-21_15.txt
[INFO   ] [Kivy        ] v2.1.0
[INFO   ] [Kivy        ] Installed at "/home/ticketera/.local/lib/python3.9/site-packages/kivy/__init__.py"
[INFO   ] [Python      ] v3.9.2 (default, Feb 28 2021, 17:03:44) 
[GCC 10.2.1 20210110]
[INFO   ] [Python      ] Interpreter at "/usr/bin/python"
[INFO   ] [Logger      ] Purge log fired. Processing...
[INFO   ] [Logger      ] Purge finished!
[INFO   ] [Factory     ] 189 symbols loaded
[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  ] [Window      ] Ignored <egl_rpi> (import error)
[INFO   ] [Window      ] Provider: sdl2(['window_egl_rpi'] ignored)
[INFO   ] [Window      ] Provider: x11(['window_egl_rpi', 'window_sdl2'] ignored)
Couldn't connect to X server

But If I run the xserver first with (only from console in raspberry screen)

startx

This command opened a small terminal with a white background and a mouse cursor, from this terminal I was able run kivy example.

IMG_20220722_112942

the log of the execution is:

ticketera@ticketera:~ $ python3 ~/.local/share/kivy-examples/3Drendering/main.py -d
[INFO   ] Logger: Record log in /home/ticketera/.kivy/logs/kivy_22-07-22_5.txt
[INFO   ] Kivy: v2.1.0
[INFO   ] Kivy: Installed at "/home/ticketera/.local/lib/python3.9/site-packages/kivy/__init__.py"
[INFO   ] Python: v3.9.2 (default, Feb 28 2021, 17:03:44) 
[GCC 10.2.1 20210110]
[INFO   ] Python: Interpreter at "/usr/bin/python3"
[INFO   ] Logger: Purge log fired. Processing...
[INFO   ] Logger: Purge finished!
[INFO   ] Factory: 189 symbols loaded
[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  ] Window: Ignored <egl_rpi> (import error)
[INFO   ] Window: Provider: sdl2(['window_egl_rpi'] ignored)
[INFO   ] GL: Using the "OpenGL" graphics system
[INFO   ] GL: Backend used <sdl2>
[INFO   ] GL: OpenGL version <b'2.1 Mesa 20.3.5'>
[INFO   ] GL: OpenGL vendor <b'Broadcom'>
[INFO   ] GL: OpenGL renderer <b'VC4 V3D 2.1'>
[INFO   ] GL: OpenGL parsed version: 2, 1
[INFO   ] GL: Shading version <b'1.20'>
[INFO   ] GL: Texture max size <2048>
[INFO   ] GL: Texture max units <16>
[DEBUG  ] Shader: Fragment compiled successfully
[DEBUG  ] Shader: Vertex compiled successfully
[DEBUG  ] ImageSDL2: Load </home/ticketera/.local/lib/python3.9/site-packages/kivy/data/glsl/default.png>
[INFO   ] Window: auto add sdl2 input provider
[INFO   ] Window: virtual keyboard not allowed, single mode, not docked
[DEBUG  ] App: Loading kv </home/ticketera/.local/share/kivy-examples/3Drendering/renderer.kv>
[DEBUG  ] App: kv </home/ticketera/.local/share/kivy-examples/3Drendering/renderer.kv> not found
[INFO   ] Shader: Read </home/ticketera/.local/share/kivy-examples/3Drendering/simple.glsl>
[DEBUG  ] Shader: Vertex compiled successfully
[DEBUG  ] Shader: Fragment compiled successfully
[DEBUG  ] Base: Create provider from mouse
[DEBUG  ] Base: Create provider from probesysfs
[DEBUG  ] ProbeSysfs: using probesysfs!
[DEBUG  ] ProbeSysfs: found device: generic ft5x06 (79) at /dev/input/event5
[INFO   ] ProbeSysfs: device match: /dev/input/event5
[INFO   ] MTD: Read event from </dev/input/event5>
[INFO   ] Base: Start application main loop
[INFO   ] MTD: </dev/input/event5> range position X is 0 - 799
[INFO   ] MTD: </dev/input/event5> range position Y is 0 - 479
[INFO   ] MTD: </dev/input/event5> range touch major is 0 - 0
[INFO   ] MTD: </dev/input/event5> range touch minor is 0 - 0
[INFO   ] MTD: </dev/input/event5> range pressure is 0 - 255
[INFO   ] MTD: </dev/input/event5> axes invertion: X is 0, Y is 0
[INFO   ] MTD: </dev/input/event5> rotation set to 0
[INFO   ] Base: Leaving application in progress...

Additional context
I was also able to run my app on Pi OS Bullseye WITH Desktop environment.
The installation was simple, the compatibility with new Pi OS is great, compile not was necessary, but the functionality of running it from console is gone.
Thanks for your help.

@marmolajpu
Copy link

Hello! Did you find a solution to this problem?

@richardklingler
Copy link

Does also apply to non-RPi4 boards....console apps are not working anymore....

@drmelectronic
Copy link
Author

Hello! Did you find a solution to this problem?

No, I went back to RPi3 with Jessie and Kivy 1.11, I wil try it in a long time

@misl6
Copy link
Member

misl6 commented May 1, 2023

Fixed via #8223 and aarch64 builds with self-built SDL2 (via KMSDRM)

@misl6 misl6 closed this as completed May 1, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants