9

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.

Akash Tyagi
  • 119
  • 1
  • 1
  • 11
  • 1
    solved it just run a command "pip install git+https://github.com/kivy/kivy.git@master" in terminal and it worked for me – Akash Tyagi Aug 06 '17 at 08:58
  • 1
    I needed URL scheme as well, so this works for me: `pip install git+https://github.com/kivy/kivy.git@master` – bryn Apr 28 '18 at 14:13

5 Answers5

5

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
Mehdi Nellen
  • 8,486
  • 4
  • 33
  • 48
  • 2
    Didn't work for me on Ubuntu 19.04 - Running my previously-working Kivy program gives a *Critical* Error: `Unable to find any valuable Window provider.` – Kingsley Apr 09 '20 at 23:42
2
pip install git+https://github.com/kivy/kivy.git@master

Its works for me like a charm.

eyllanesc
  • 235,170
  • 19
  • 170
  • 241
2

On an Ubuntu 19.04 I basically had this same error (error message was a little different)

...
[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
egl_rpi - ImportError: cannot import name 'bcm' from 'kivy.lib.vidcore_lite' (/usr/lib/python3/dist-packages/kivy/lib/vidcore_lite/__init__.py)
  File "/usr/lib/python3/dist-packages/kivy/core/__init__.py", line 63, 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

The error persisted, even after trying suggestions in these answers. Even using the "stable" packages from the Kivy website did not help, this was a bit disappointing I must admit.

What worked for me was to install the Kivy package via pip3, but this also needs a few dependencies:

# remove the old packages
sudo apt-get remove --purge *kivy*

# install some dependencies for the package build
sudo apt-get install libav-dev libsdl2-dev libavformat-dev libavdevice-dev

# Install the kivy modules with `pip3` (assuming pip3 is installed already)
sudo pip3 install ffpyplayer
sudo pip3 install kivy
sudo pip3 install kivy-examples

There may be a few more dependencies to needed install via pip3 that I happened to have installed already.

Kingsley
  • 14,398
  • 5
  • 31
  • 53
2

I encountered something similar while running my first python3-kivy(v1.11.1) app on Ubuntu 18.04.1.

Below is my error log:

[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 egl_rpi - ImportError: cannot import name 'bcm'
File "/usr/lib/python3/dist-packages/kivy/core/__init__.py", line 63, 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 - ImportError: libSDL2_image-2.0.so.0: cannot open shared object file: No such file or directory
File "/usr/lib/python3/dist-packages/kivy/core/__init__.py", line 63, in core_select_lib
fromlist=[modulename], level=0)
File "/usr/lib/python3/dist-packages/kivy/core/window/window_sdl2.py", line 27, in <module>
from kivy.core.window._window_sdl2 import _WindowSDL2Storage

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

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

Resolution that worked for me:

Try to install python3-sdl2. sudo apt-get install python3-sdl2 and rerun your app.

Extra: Setting up python3-kivy was NOT straight forward. So I am putting out my complete installation steps, before I could run my first app. Hope it helps someone:

# Install the dependencies
sudo apt-get install python3-setuptools libsdl2-dev libavformat-dev libavdevice-dev python3-sdl2

# Install python3-kivy via ppa. Pip install didn't work for me.
sudo add-apt-repository ppa:kivy-team/kivy
sudo apt-get update
sudo apt-get install python3-kivy

# Install ffpyplayer
python3 -m pip install ffpyplayer

# Run the app
python3 main.py
-2

Try installing pygame

pip install pygame