Unable to get a Window, abort. Kivy error when running an executable compiled from cython and cl
Asked Answered
D

2

2

I'm currently learning Kivy 1.8.0 (on Windows 7, Python 3.3.3) by trying the Pong Game exercise. After writing all the code, I wanted to test to compile the code to a .exe. But as PyInstaller is only available for Python2.X and not Python3.X, I've searched for another solutions. I've looked over the internet and finally tried to compile my code using Cython and cl (Visual Studio 10.0). The compilation works fine but when I run the .exe output, it gives me this in the "debug" window:

[INFO              ] Kivy v1.8.0
[INFO              ] [Logger      ] Record log in C:\Users\PLD\.kivy\logs\kivy_1
4-07-21_1.txt
[INFO              ] [Factory     ] 157 symbols loaded
[DEBUG             ] [Cache       ] register <kv.lang> with limit=None, timeout=
Nones
[DEBUG             ] [Cache       ] register <kv.image> with limit=None, timeout
=60s
[DEBUG             ] [Cache       ] register <kv.atlas> with limit=None, timeout
=Nones
[INFO              ] [Image       ] Providers: img_tex, img_dds, img_gif (img_py
game, img_pil ignored)
[DEBUG             ] [Cache       ] register <kv.texture> with limit=1000, timeo
ut=60s
[DEBUG             ] [Cache       ] register <kv.shader> with limit=1000, timeou
t=3600s
[DEBUG             ] [App         ] Loading kv <.\pong.kv>
[DEBUG             ] [Window      ] Ignored <egl_rpi> (import error)
[DEBUG             ] [Window      ] Ignored <pygame> (import error)
[WARNING           ] [WinPygame   ] SDL wrapper failed to import!
[DEBUG             ] [Window      ] Ignored <sdl> (import error)
[DEBUG             ] [Window      ] Ignored <x11> (import error)
[CRITICAL          ] [Window      ] Unable to find any valuable Window provider
at all!
[CRITICAL          ] [App         ] Unable to get a Window, abort.

And exits. I don't know what wrong, knowing that when I run the original .py file, I don't have any error. Here's the commands I used and its output:

C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\bin>vcvars32.bat
Setting environment for using Microsoft Visual Studio 2010 x86 tools.

C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\bin>cd C:/Kivy-1.8.0-py3.
3-win32

C:\Kivy-1.8.0-py3.3-win32>kivy.bat
botstrapping Kivy @ C:\Kivy-1.8.0-py3.3-win32\
Setting Environment Variables:
#################################
GST_REGISTRY
C:\Kivy-1.8.0-py3.3-win32\gstreamer\registry.bin
---------------
GST_PLUGIN_PATH:
C:\Kivy-1.8.0-py3.3-win32\gstreamer\lib\gstreamer-1.0
---------------
PATH:
C:\Kivy-1.8.0-py3.3-win32\;C:\Kivy-1.8.0-py3.3-win32\Python33;C:\Kivy-1.8.0-py3.
3-win32\tools;C:\Kivy-1.8.0-py3.3-win32\Python33\Scripts;C:\Kivy-1.8.0-py3.3-win
32\gstreamer\bin;C:\Kivy-1.8.0-py3.3-win32\MinGW\bin;C:\Program Files (x86)\Micr
osoft F#\v4.0\;C:\Program Files (x86)\Microsoft Visual Studio 10.0\VSTSDB\Deploy
;C:\Program Files (x86)\Microsoft Visual Studio 10.0\Common7\IDE\;C:\Program Fil
es (x86)\Microsoft Visual Studio 10.0\VC\BIN;C:\Program Files (x86)\Microsoft Vi
sual Studio 10.0\Common7\Tools;C:\Windows\Microsoft.NET\Framework\v4.0.30319;C:\
Windows\Microsoft.NET\Framework\v3.5;C:\Program Files (x86)\Microsoft Visual Stu
dio 10.0\VC\VCPackages;C:\Program Files (x86)\HTML Help Workshop;C:\Program File
s (x86)\Microsoft Visual Studio 10.0\Team Tools\Performance Tools;C:\Program Fil
es (x86)\Microsoft SDKs\Windows\v7.0A\bin\NETFX 4.0 Tools;C:\Program Files (x86)
\Microsoft SDKs\Windows\v7.0A\bin;C:\Kivy-1.8.0-py3.3-win32;C:\Kivy-1.8.0-py3.3-
win32\Python33;C:\Kivy-1.8.0-py3.3-win32\gstreamer\bin;C:\Kivy-1.8.0-py3.3-win32
\MinGW\bin;C:\Kivy-1.8.0-py3.3-win32;C:\Kivy-1.8.0-py3.3-win32\Python33;C:\Kivy-
1.8.0-py3.3-win32\gstreamer\bin;C:\Kivy-1.8.0-py3.3-win32\kivy;C:\Kivy-1.8.0-py3
.3-win32;C:\Kivy-1.8.0-py3.3-win32\Python33;C:\Kivy-1.8.0-py3.3-win32\gstreamer\
bin;C:\Kivy-1.8.0-py3.3-win32\MinGW\bin;C:\Kivy-1.8.0-py3.3-win32;C:\Kivy-1.8.0-
py3.3-win32\Python33;C:\Kivy-1.8.0-py3.3-win32\gstreamer\bin;C:\Kivy-1.8.0-py3.3
-win32\kivy;C:\Kivy-1.8.0-py3.3-win32;C:\Kivy-1.8.0-py3.3-win32\Python33;C:\Kivy
-1.8.0-py3.3-win32\gstreamer\bin;C:\Kivy-1.8.0-py3.3-win32\MinGW\bin;C:\Kivy-1.8
.0-py3.3-win32;C:\Kivy-1.8.0-py3.3-win32\Python33;C:\Kivy-1.8.0-py3.3-win32\gstr
eamer\bin;C:\Kivy-1.8.0-py3.3-win32\kivy;C:\Windows\System32;C:\Program Files\Mi
crosoft SQL Server\110\Tools\Binn\;C:\Program Files\Microsoft SQL Server\110\Too
ls\Binn\;C:\Program Files\Microsoft SQL Server\110\Tools\Binn\;C:\Program Files\
Satsuki Decoder Pack\Filtres
----------------------------------
PYTHONPATH:
C:\Kivy-1.8.0-py3.3-win32\kivy;
----------------------------------
##################################
done bootstraping kivy...have fun!\n

-----------------------------------------------------------------------
- Running a shell, you can browse kivyexamples and launch apps with: -
- python app.py -
-----------------------------------------------------------------------

Microsoft Windows [version 6.1.7601]
Copyright (c) 2009 Microsoft Corporation. Tous droits réservés.

C:\Kivy-1.8.0-py3.3-win32>cd ../pcod/Python/Python33-Kivy/PingPongGame

C:\pcod\Python\Python33-Kivy\PingPongGame>cython main.py -o main.c --embed

C:\pcod\Python\Python33-Kivy\PingPongGame>python.exe -m cython main.py -o main.c
 --embed

C:\pcod\Python\Python33-Kivy\PingPongGame>cl.exe /nologo /Ox /MD /W3 /GS- /DNDEB
UG -Ic:\Kivy-1.8.0-py3.3-win32\Python33\include -Ic:\Kivy-1.8.0-py3.3-win32\PC m
ain.c /link /OUT:"main.exe" /SUBSYSTEM:CONSOLE /MACHINE:X86 /LIBPATH:c:\Kivy-1.8
.0-py3.3-win32\Python33\libs /LIBPATH:c:\Kivy-1.8.0-py3.3-win32\Python33\PCbuild

main.c
   Creating library main.lib and object main.exp

C:\pcod\Python\Python33-Kivy\PingPongGame>main.exe
[INFO              ] Kivy v1.8.0
[INFO              ] [Logger      ] Record log in C:\Users\PLD\.kivy\logs\kivy_1
4-07-21_2.txt
[INFO              ] [Factory     ] 157 symbols loaded
[DEBUG             ] [Cache       ] register <kv.lang> with limit=None, timeout=
Nones
[DEBUG             ] [Cache       ] register <kv.image> with limit=None, timeout
=60s
[DEBUG             ] [Cache       ] register <kv.atlas> with limit=None, timeout
=Nones
[INFO              ] [Image       ] Providers: img_tex, img_dds, img_gif (img_py
game, img_pil ignored)
[DEBUG             ] [Cache       ] register <kv.texture> with limit=1000, timeo
ut=60s
[DEBUG             ] [Cache       ] register <kv.shader> with limit=1000, timeou
t=3600s
[DEBUG             ] [App         ] Loading kv <.\pong.kv>
[DEBUG             ] [Window      ] Ignored <egl_rpi> (import error)
[DEBUG             ] [Window      ] Ignored <pygame> (import error)
[WARNING           ] [WinPygame   ] SDL wrapper failed to import!
[DEBUG             ] [Window      ] Ignored <sdl> (import error)
[DEBUG             ] [Window      ] Ignored <x11> (import error)
[CRITICAL          ] [Window      ] Unable to find any valuable Window provider
at all!
[CRITICAL          ] [App         ] Unable to get a Window, abort.

I believe that the issue comes from the cl.exe command, but I don't know exactly where :(. Please, help !

Thanks. Regards, PLD.

Dianndianna answered 21/7, 2014 at 12:50 Comment(1)
If you want to create exe's, you need to use Python 2.7, or contribute by making pyinstaller work for Py3 or make cx_Freeze work with Kivy.Proofread
D
1

Well, after reading some articles and stuff, I came to the conclusion that Kivy is not yet ready for Python3. Using the Python2 version of Kivy and PyInstaller2 seems to be the easiest solution.

Dianndianna answered 23/7, 2014 at 18:33 Comment(1)
This is not true anymore. Try pip3 install pygame and try running your script again. Verified working on Ubuntu 18.04 and OSX. OSX did not require pygame.Overfeed
W
2

That error means pygame was not included in your compile.

Watermelon answered 21/7, 2014 at 17:16 Comment(1)
Hmm, will check how to include it.Dianndianna
D
1

Well, after reading some articles and stuff, I came to the conclusion that Kivy is not yet ready for Python3. Using the Python2 version of Kivy and PyInstaller2 seems to be the easiest solution.

Dianndianna answered 23/7, 2014 at 18:33 Comment(1)
This is not true anymore. Try pip3 install pygame and try running your script again. Verified working on Ubuntu 18.04 and OSX. OSX did not require pygame.Overfeed

© 2022 - 2024 — McMap. All rights reserved.