Search code examples
python-3.xwindowskivypyinstallerkivymd

How to create kivy applications for desktop in Windows?


Good afternoon people.

Once again trying to package kivy for DESKTOP on WINDOWS 10 and to no avail!

I had a lot of errors that I managed to solve without disturbing the order in the groups but this one is phoda with ph.

1 - I create the exe using Auto_py_to_exe and before there is any comment that I should use pyinstaller, I tell you, the same thing happens!

2 - My pyinstaller script is as follows:

pyinstaller --noconfirm --onefile --console --name "TeuCu" --add-data "C: /Users/Elias/Desktop/kv_inventario/inventario/main.kv ;." --add-data "C: / Users / Elias / Desktop / kv_inventario / inventario / images; images /" "C: /Users/Elias/Desktop/kv_inventario/inventario/main.py"

3 - The error is exactly like this, when running the application after it is created it returns this error:

[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 - Exception: SDL2: Unable to load image 
File "kivy\core\__init__.py", line 70, in core_select_lib
   File "kivy\core\window\window_sdl2.py", line 152, in __init__
   File "kivy\core\window\__init__.py", line 982, in __init__
   File "kivy\core\window\window_sdl2.py", line 311, in create_window
   File "kivy\core\window\__init__.py", line 1268, in create_window
   File "kivy\graphics\instructions.pyx", line 783, in kivy.graphics.instructions.RenderContext.__init__
   File "kivy\core\image\__init__.py", line 561, in __init__
   File "kivy\core\image\__init__.py", line 754, in _set_filename
   File "kivy\core\image\__init__.py", line 460, in load
   File "kivy\core\image\__init__.py", line 223, in __init__
   File "kivy\core\image\img_sdl2.py", line 47, in load

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

My solution that could possibly work would be this tip that I found in kivy issues: Kivy issues

This took me to the post below and translating it asks to uninstall the pillow and reinstall with the wheel

python3 -m pip3 uninstall pillow
python3 -m pip3 install --use-wheel pillow

But it didn't.

I would like your help. Who managed to generate an application for Windows with kivy

I'm using Windows 10 to package.


Solution

  • This error is common - Here are some helpful links:

    Kivy not working (Error: Unable to find any valuable Window provider.)

    Python app not working after using pyinstaller but doesn't give any errors

    https://github.com/kivy/kivy/issues/6342

    https://github.com/pal1000/save-legacy-intel-graphics

    Kivy does not detect OpenGL 2.0 Windows- Pyinstaller Error "failed to execute script " When App Clicked

    Unable to get a window, abort

    https://pyinstaller.readthedocs.io/en/stable/when-things-go-wrong.html

    https://github.com/kivy/kivy/issues/6276

    If none of these work, I also made a video on packaging a kivy app to a single exe for Windows: https://www.youtube.com/watch?v=k9Hx0q5Sopg

    Please let me know if you succeed. Cheers!