Installing kivy on Raspbian bullseye lite

347 views
Skip to first unread message

Lucas

unread,
Nov 2, 2022, 4:22:31 PM11/2/22
to Kivy users support
I am trying to install kivy on Raspbian bullseye lite. I am following the instructions here: https://kivy.org/doc/stable/installation/installation-rpi.html#raspberry-pi-4-headless-installation-on-raspbian-buster

(since I couldn't find any instructions for bullseye I am following the steps for buster). I am running into the following issues:

1. sudo apt install gstreamer1.0-{omx,alsa}
-> gestreamer1.0-omx doesn't seem to exist for bullseye, so I installed everything else and ignored the error hoping it would work anyway

2. When I follow all the steps everything seems to install fine. However when I run a kivy app (the app should be fine since it runs under X11), I get the following error. Any idea how to get kivy to use sdl2? 

[TRACE  ] [Window      ] Unable to use sdl2
 --- Logging error ---
 Traceback (most recent call last):
   File "/home/pi/.local/lib/python3.9/site-packages/kivy/core/__init__.py", line 71, in core_select_lib
     cls = cls()
   File "/home/pi/.local/lib/python3.9/site-packages/kivy/core/window/window_sdl2.py", line 165, in __init__
     super(WindowSDL, self).__init__()
   File "/home/pi/.local/lib/python3.9/site-packages/kivy/core/window/__init__.py", line 1071, in __init__
     self.create_window()
   File "/home/pi/.local/lib/python3.9/site-packages/kivy/core/window/window_sdl2.py", line 306, in create_window
     self.system_size = _size = self._win.setup_window(
   File "kivy/core/window/_window_sdl2.pyx", line 114, in kivy.core.window._window_sdl2._WindowSDL2Storage.setup_window
   File "kivy/core/window/_window_sdl2.pyx", line 76, in kivy.core.window._window_sdl2._WindowSDL2Storage.die
 RuntimeError: b'No available video device'

 During handling of the above exception, another exception occurred:

 Traceback (most recent call last):
   File "/usr/lib/python3.9/logging/__init__.py", line 1079, in emit
     msg = self.format(record)
   File "/usr/lib/python3.9/logging/__init__.py", line 923, in format
     return fmt.format(record)
   File "/home/pi/.local/lib/python3.9/site-packages/kivy/logger.py", line 291, in format
     record = copy.deepcopy(record)
   File "/usr/lib/python3.9/copy.py", line 172, in deepcopy
     y = _reconstruct(x, memo, *rv)
   File "/usr/lib/python3.9/copy.py", line 270, in _reconstruct
     state = deepcopy(state, memo)
   File "/usr/lib/python3.9/copy.py", line 146, in deepcopy
     y = copier(x, memo)
   File "/usr/lib/python3.9/copy.py", line 230, in _deepcopy_dict
     y[deepcopy(key, memo)] = deepcopy(value, memo)
   File "/usr/lib/python3.9/copy.py", line 146, in deepcopy
     y = copier(x, memo)
   File "/usr/lib/python3.9/copy.py", line 210, in _deepcopy_tuple
     y = [deepcopy(a, memo) for a in x]
   File "/usr/lib/python3.9/copy.py", line 210, in <listcomp>
     y = [deepcopy(a, memo) for a in x]
   File "/usr/lib/python3.9/copy.py", line 161, in deepcopy
     rv = reductor(4)
 TypeError: cannot pickle 'traceback' object
 Call stack:
   File "/home/pi/microwave/main.py", line 72, in <module>
     class Context:
   File "/home/pi/microwave/main.py", line 86, in Context
     Comm = Communication()                                                                          # communication library from DisplayCommunication.py file
   File "/home/pi/microwave/DisplayCommunication.py", line 66, in __init__
     super(Communication, self).__init__(**kwargs)
   File "/home/pi/.local/lib/python3.9/site-packages/kivy/uix/widget.py", line 341, in __init__
     EventLoop.ensure_window()
   File "/home/pi/.local/lib/python3.9/site-packages/kivy/base.py", line 136, in ensure_window
     import kivy.core.window  # NOQA
   File "<frozen importlib._bootstrap>", line 1007, in _find_and_load
   File "<frozen importlib._bootstrap>", line 986, in _find_and_load_unlocked
   File "<frozen importlib._bootstrap>", line 680, in _load_unlocked
   File "<frozen importlib._bootstrap_external>", line 790, in exec_module
   File "<frozen importlib._bootstrap>", line 228, in _call_with_frames_removed
   File "/home/pi/.local/lib/python3.9/site-packages/kivy/core/window/__init__.py", line 2460, in <module>
     Window = core_select_lib('window', window_impl, True)
   File "/home/pi/.local/lib/python3.9/site-packages/kivy/core/__init__.py", line 95, in core_select_lib
     Logger.trace('', exc_info=e)
 Message: ''
 Arguments: ()
[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 - RuntimeError: b'No available video device'
  File "/home/pi/.local/lib/python3.9/site-packages/kivy/core/__init__.py", line 71, in core_select_lib
    cls = cls()
  File "/home/pi/.local/lib/python3.9/site-packages/kivy/core/window/window_sdl2.py", line 165, in __init__
    super(WindowSDL, self).__init__()
  File "/home/pi/.local/lib/python3.9/site-packages/kivy/core/window/__init__.py", line 1071, in __init__
    self.create_window()
  File "/home/pi/.local/lib/python3.9/site-packages/kivy/core/window/window_sdl2.py", line 306, in create_window
    self.system_size = _size = self._win.setup_window(
  File "kivy/core/window/_window_sdl2.pyx", line 114, in kivy.core.window._window_sdl2._WindowSDL2Storage.setup_window
  File "kivy/core/window/_window_sdl2.pyx", line 76, in kivy.core.window._window_sdl2._WindowSDL2Storage.die

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

mjk...@gmail.com

unread,
Mar 5, 2023, 10:01:27 AM3/5/23
to Kivy users support
I got this to work on 64-bit Bullseye lite - and on a Raspberry pi 4.  There is a long list of things I do to get an OS ready for my machines, so I cannot be perfectly sure what I did to make this work.  The last thing I did to get rid of the "unable to get a window, abort" is to compile Kivy on the machine using this command:

python -m pip install "kivy[base] @ https://github.com/kivy/kivy/archive/master.zip"

and I was using a virtual environment at the time.  

working with this today was the first time I have tried to use 64-bit OS and I found many of the installation problems I have had with libraries previously went away with the 64-bit OS.  I was not expecting that.

A nice difference is that I no longer need to use the python based cursor module to get the mouse pointer.

PS here are the pre-requisite versions and commands I used.  My older instructions had different versions, so I just poked around to find what the newer/newest versions are.  I probably just got lucky this all worked out

#create a file with each of these 4 code snippets and execute them (repeat for each) (not sudo)
# install_sdl2
wget https://libsdl.org/release/SDL2-2.26.3.tar.gz
tar -zxvf SDL2-2.26.3.tar.gz
pushd SDL2-2.26.3
./configure --enable-video-kmsdrm --disable-video-opengl --disable-video-x11 --disable-video-rpi
make -j$(nproc)
sudo make install
popd

# install_sdl
wget https://libsdl.org/projects/SDL_image/release/SDL2_image-2.6.3.tar.gz
tar -zxvf SDL2_image-2.6.3.tar.gz
pushd SDL2_image-2.6.3
./configure
make -j$(nproc)
sudo make install
popd


# install_sdl2_mixer
wget https://libsdl.org/projects/SDL_mixer/release/SDL2_mixer-2.6.3.tar.gz
tar -zxvf SDL2_mixer-2.6.3.tar.gz
pushd SDL2_mixer-2.6.3
./configure
make -j$(nproc)
sudo make install
popd



# install_sdl2_ttf
wget https://libsdl.org/projects/SDL_ttf/release/SDL2_ttf-2.20.2.tar.gz
tar -zxvf SDL2_ttf-2.20.2.tar.gz
pushd SDL2_ttf-2.20.2
./configure
make -j$(nproc)
sudo make install
popd

finally, this is in the .bashrc or equivalent
export LD_LIBRARY_PATH="/usr/local/lib"





Reply all
Reply to author
Forward
0 new messages