0

I am learning Kivy and following this article https://realpython.com/mobile-app-kivy-python/ I am getting this error. It would be helpful if the explanation is lucid. Os: macOS Big Sur, I am using a Virtual machine to practice.

$which python
/Users/xcodeclub/my_kivy_project/bin/python

$which pip
/Users/xcodeclub/my_kivy_project/bin/pip
(my_kivy_project) xcodeclub@XCodeClub11 my_kivy_project % ls
bin     include     lib     main.py     pyvenv.cfg
(my_kivy_project) xcodeclub@XCodeClub11 my_kivy_project % python3 main.py 
[INFO   ] [Logger      ] Record log in /Users/xcodeclub/.kivy/logs/kivy_21-05-31_12.txt
[INFO   ] [Kivy        ] v2.0.0
[INFO   ] [Kivy        ] Installed at "/Users/xcodeclub/my_kivy_project/lib/python3.9/site-packages/kivy/__init__.py"
[INFO   ] [Python      ] v3.9.5 (default, May  4 2021, 03:36:27) 
[Clang 12.0.0 (clang-1200.0.32.29)]
[INFO   ] [Python      ] Interpreter at "/Users/xcodeclub/my_kivy_project/bin/python3"
[INFO   ] [Factory     ] 186 symbols loaded
[INFO   ] [Image       ] Providers: img_tex, img_imageio, img_dds, img_sdl2 (img_pil, img_ffpyplayer ignored)
[INFO   ] [Text        ] Provider: sdl2
[INFO   ] [Window      ] Provider: sdl2
[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'Failed creating OpenGL pixel format'
  File "/Users/xcodeclub/my_kivy_project/lib/python3.9/site-packages/kivy/core/__init__.py", line 70, in core_select_lib
    cls = cls()
  File "/Users/xcodeclub/my_kivy_project/lib/python3.9/site-packages/kivy/core/window/window_sdl2.py", line 152, in __init__
    super(WindowSDL, self).__init__()
  File "/Users/xcodeclub/my_kivy_project/lib/python3.9/site-packages/kivy/core/window/__init__.py", line 982, in __init__
    self.create_window()
  File "/Users/xcodeclub/my_kivy_project/lib/python3.9/site-packages/kivy/core/window/window_sdl2.py", line 286, in create_window
    self.system_size = _size = self._win.setup_window(
  File "_window_sdl2.pyx", line 234, in kivy.core.window._window_sdl2._WindowSDL2Storage.setup_window
  File "_window_sdl2.pyx", line 74, in kivy.core.window._window_sdl2._WindowSDL2Storage.die

[CRITICAL] [App         ] Unable to get a Window, abort.
(my_kivy_project) xcodeclub@XCodeClub11 my_kivy_project % 
Tried these:

pip install --upgrade pip wheel setuptools
pip install docutils pygments pypiwin32 kivy.deps.sdl2 kivy.deps.glew

Error:
ERROR: Could not find a version that satisfies the requirement kivy.deps.sdl2 (from versions: none)
ERROR: No matching distribution found for kivy.deps.sdl2

Paulson Raja L
  • 379
  • 2
  • 11

2 Answers2

0

Looking at your terminal commands, I suppose your virtual machine's OS is Linux. I encountered the same issue with my Linux Mint while attempting to install glew, sdl2, ... before I realized the dependencies I tried to install weren't available / necessary for linux. You can take a look at the official kivy install guide, paragraph "Installing Kivy’s dependencies" here.

Ole Pannier
  • 3,208
  • 9
  • 22
  • 33
Yves THX
  • 1
  • 1
0

I have had the same headach in the past. Unfortunately kivy doesn't work in a MacOS VM because Kivy needs minimum 2.0 gl, which is not available in any OSX VM ( I tested several VMs in Windows and Linux with the same results), because in a VM it doesn't have access to hardware acceleration. This is a well known issue, read this on Kivy Github. So your test app has to be ran on a REAL Mac.

FYI - In ALL MacOS Virtual Machines I used (VMWare, VirtualBox and QEMU) kivy fails running even the simplest Hello World app, whatever was the way you used to install kivy and all its dependencies (pip, brew, MacPorts, framework, conda, ... what else...). Running 'kivy main.py' (or python main.py) the result is always the same:

[CRITICAL] [Window] Unable to find any valuable Window provider at all!
sdl2 - RuntimeError: Failed creating OpenGL pixel format
radiolondra
  • 293
  • 4
  • 15