x11 - ImportError: No module named 'kivy.core.window.window_x11'

Akash Tyagi picture Akash Tyagi · Aug 6, 2017 · Viewed 9.2k times · Source

when i try to run any kivy program with python 3.5 in my kali linux os. Then i get the below error.

program:-

from kivy.app import App
from kivy.lang import Builder
from kivy.uix.relativelayout import RelativeLayout

Builder.load_string('''
<hey>:
    RelativeLayout:
        Button:
            text:"Hey"
''')

class hey(RelativeLayout):
    pass

class helloApp(App):
    def build(self):
        return hey()

if __name__=="__main__":
    helloApp().run()

error:-

[INFO   ] [OSC         ] using <multiprocessing> for socket
[INFO   ] [Window      ] Provider: sdl2(['window_egl_rpi'] ignored)
[CRITICAL] [Window      ] Unable to find any valuable Window provider at all!
egl_rpi - ImportError: cannot import name 'bcm'
  File "/usr/lib/python3/dist-packages/kivy/core/__init__.py", line 59, in core_select_lib
    fromlist=[modulename], level=0)
  File "/usr/lib/python3/dist-packages/kivy/core/window/window_egl_rpi.py", line 12, in <module>
    from kivy.lib.vidcore_lite import bcm, egl

sdl2 - TypeError: expected bytes, str found
  File "/usr/lib/python3/dist-packages/kivy/core/__init__.py", line 67, in core_select_lib
    cls = cls()
  File "/usr/lib/python3/dist-packages/kivy/core/window/window_sdl2.py", line 138, in __init__
    super(WindowSDL, self).__init__()
  File "/usr/lib/python3/dist-packages/kivy/core/window/__init__.py", line 722, in __init__
    self.create_window()
  File "/usr/lib/python3/dist-packages/kivy/core/window/window_sdl2.py", line 237, in create_window
    self.fullscreen, resizable, state)
  File "kivy/core/window/_window_sdl2.pyx", line 94, in kivy.core.window._window_sdl2._WindowSDL2Storage.setup_window (kivy/core/window/_window_sdl2.c:2204)

x11 - ImportError: No module named 'kivy.core.window.window_x11'
  File "/usr/lib/python3/dist-packages/kivy/core/__init__.py", line 59, in core_select_lib
    fromlist=[modulename], level=0)

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

It used to be work fine when i installed kivy in previous kali linux os but due to some reasons i installed kali again and kivy again but this time i am not able to make it work.

Answer

Mehdi Nellen picture Mehdi Nellen · Jan 16, 2018

In my case it was an outdated version of kivy. I see you are also running python3. After removing kivy I did the following which solved my problem:

 sudo add-apt-repository ppa:kivy-team/kivy
 sudo apt-get update
 sudo apt-get install python3-kivy