I'm trying to package my kivy project with Pyinstaller but it crashes and spits this out
[CRITICAL ] [Window ] Unable to find any valuable Window provider at all!
sdl2 - Exception: SDL2: Unable to load image
File "site-packages\kivy\core\__init__.py", line 67, in core_select_lib
File "site-packages\kivy\core\window\window_sdl2.py", line 138, in __init__
File "site-packages\kivy\core\window\__init__.py", line 722, in __init__
File "site-packages\kivy\core\window\window_sdl2.py", line 255, in
create_window
File "site-packages\kivy\core\window\__init__.py", line 897, in create_window
File "kivy\graphics\instructions.pyx", line 756, in
kivy.graphics.instructions.RenderContext.__init__ (kivy\graphics\instructions.c:10729)
File "site-packages\kivy\core\image\__init__.py", line 512, in __init__
File "site-packages\kivy\core\image\__init__.py", line 700, in _set_filename
File "site-packages\kivy\core\image\__init__.py", line 430, in load
File "site-packages\kivy\core\image\__init__.py", line 198, in __init__
File "site-packages\kivy\core\image\img_sdl2.py", line 42, in load
[INFO ] [Audio ] Providers: audio_sdl2 (audio_ffpyplayer ignored)
[CRITICAL ] [App ] Unable to get a Window, abort.
Exception ignored in: 'kivy.properties.dpi2px'
Traceback (most recent call last):
File "site-packages\kivy\utils.py", line 513, in __get__
File "site-packages\kivy\metrics.py", line 175, in dpi
File "site-packages\kivy\base.py", line 126, in ensure_window
SystemExit: 1
[CRITICAL ] [App ] Unable to get a Window, abort.
Exception ignored in: 'kivy.properties.dpi2px'
Traceback (most recent call last):
File "site-packages\kivy\utils.py", line 513, in __get__
File "site-packages\kivy\metrics.py", line 175, in dpi
File "site-packages\kivy\base.py", line 126, in ensure_window
SystemExit: 1
[CRITICAL ] [App ] Unable to get a Window, abort.
I did not create my own spec file I chose to do it via the command line by passing the required arguments any suggestions?
This is the spec file generated by pyinstaller
# -*- mode: python -*-
block_cipher = None
a = Analysis(['apv.py'],
pathex=['C:\\Python34\\Lib\\site-packages\\kivy', 'C:\\Python34', 'C:\\Python34\\Lib', 'C:\\Python34\\Lib\\site-packages', 'C:\\Users\\suroh\\Desktop\\my-python-modules', 'C:\\Python34\\Lib\\site-packages\\kivy\\deps', 'C:\\Python34\\Lib\\site-packages\\kivy\\graphic', 'C:\\Python34\\DLLs', 'C:\\Python34\\libs', 'C:\\Python34\\Scripts', 'C:\\Python34\\share\\sdl2\\bin', 'C:\\Python34\\share\\glew\\bin', 'C:\\Python34\\share', 'C:\\Python34\\Tools', 'C:\\Python34\\Lib\\ctypes', 'C:\\Python34\\Lib\\distutils', 'C:\\Users\\suroh\\Desktop\\Python Projects\\testp\\Beta 01'],
binaries=None,
datas=None,
hiddenimports=[],
hookspath=[],
runtime_hooks=[],
excludes=['pygame'],
win_no_prefer_redirects=False,
win_private_assemblies=False,
cipher=block_cipher)
pyz = PYZ(a.pure, a.zipped_data,
cipher=block_cipher)
exe = EXE(pyz,
a.scripts,
exclude_binaries=True,
name='apv',
debug=False,
strip=False,
upx=True,
console=False , icon='LauncherIcon.ico')
coll = COLLECT(exe,
a.binaries,
a.zipfiles,
a.datas,
strip=False,
upx=True,
name='apv')
If you didn't create spec file, you still need to package the dependencies which are here in the Collect()
.
As it is mentioned in the pyinstaller's docs:
You can give additional files on the pyinstaller command line.
Which means that you could do --add-data
or you can dump the spec somewhere and edit it manually with --specpath
. Here is what Collect()
basically does to package the stuff.
Edit: Yup, you're definitely missing the deps. Look at kivy's spec.
If you would go for --add-data
, you should check kivy.deps
folder and __init__()
s in them, because those will tell you what path you are looking for. But editing the spec manually is less time consuming.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With