Pyinstaller exe shows blank screen

168 views
Skip to first unread message

Aftab Sarwar

unread,
May 9, 2024, 11:04:03 AM5/9/24
to PyInstaller
I have a Kivy app that works fine from Pycharm IDE or when run from command line. However, after converting it to an exe with PyInstaller, the app only shows a blank screen and stays there. I'm using Python 3.12, Kivy 2.3 and Pyinstaller 6.6.0. 
crs_blank_screen.png
Note: The app/window does not close itself, it just stays there but I cannot see any widget on it.
I have tried to downgrade the Pyinstaller to 6.0.0 and 4.0.0 with no success.
I have also tried to downgrade Kivy to 2.0.0 with no success.
I see no message on console after "Start application main loop".
Please help as I have already spent much time on it.

Elliot Garbus

unread,
May 9, 2024, 11:30:58 AM5/9/24
to PyInstaller
Share your pyinstaller spec file.
My guess is that the program can not find the kv files.  DId you add them to the datas section?
There is a kivy logfile located at:  "C:\Users\your_username\.kivy\logs", read the log file for clues to the issue.

Here is a working spec file - you may find this helpful.  This project has a dir structure that complicates things a little.

In the most recent version of pyinstaller there was a change to the content directory location, either use full file path addressing or set the contents directory to '.'
See the exe section:
contents_directory='.',

If you sent the contents directory to '.', you do not need to use __file__, the launcher will set the current working directory.  If you do not change the content_directory, you must reference files relative to __file__.
Message has been deleted

Aftab Sarwar

unread,
May 9, 2024, 11:42:52 AM5/9/24
to PyInstaller
Actually I do not add any files to the exe, I simple run the pyinstaller -F program.py
Then place all the files in the dist directory. This has worked for me for very long. I make sure that all the kv files are there in the dist directory. 

Here is my data from the log file:

[INFO   ] Logger: Record log in C:\Users\aftab\.kivy\logs\kivy_24-05-09_99.txt
[INFO   ] deps: Successfully imported "kivy_deps.gstreamer" 0.3.3
[INFO   ] deps: Successfully imported "kivy_deps.angle" 0.4.0
[INFO   ] deps: Successfully imported "kivy_deps.glew" 0.3.1
[INFO   ] deps: Successfully imported "kivy_deps.sdl2" 0.7.0
[INFO   ] Kivy: v2.3.0
[INFO   ] Kivy: Installed at "D:\COBRA_CRS_Redesign\crs\kivy_venvir\Lib\site-packages\kivy\__init__.py"
[INFO   ] Python: v3.12.0 (tags/v3.12.0:0fb18b0, Oct  2 2023, 13:03:39) [MSC v.1935 64 bit (AMD64)]
[INFO   ] Python: Interpreter at "D:\COBRA_CRS_Redesign\crs\kivy_venvir\Scripts\python.exe"
[INFO   ] Logger: Purge log fired. Processing...
[INFO   ] Logger: Purge finished!
[INFO   ] Factory: 195 symbols loaded
[INFO   ] Image: Providers: img_tex, img_dds, img_sdl2 (img_pil, img_ffpyplayer ignored)
[INFO   ] Window: Provider: sdl2
[INFO   ] GL: Using the "OpenGL" graphics system
[INFO   ] GL: Backend used <sdl2>
[INFO   ] GL: OpenGL version <b'4.6.0 - Build 31.0.101.4032'>
[INFO   ] GL: OpenGL vendor <b'Intel'>
[INFO   ] GL: OpenGL renderer <b'Intel(R) Iris(R) Xe Graphics'>
[INFO   ] GL: OpenGL parsed version: 4, 6
[INFO   ] GL: Shading version <b'4.60 - Build 31.0.101.4032'>
[INFO   ] GL: Texture max size <16384>
[INFO   ] GL: Texture max units <32>
[INFO   ] Window: auto add sdl2 input provider
[INFO   ] Window: virtual keyboard not allowed, single mode, not docked
[INFO   ] Text: Provider: sdl2
[DEBUG  ] Starting new HTTPS connection (1): api.portal.ddd.com:443
[DEBUG  ] https://api.portal.ddd.com:443 "GET /users/me HTTP/1.1" 200 1090
[INFO   ] GL: NPOT texture support is available
[DEBUG  ] Starting new HTTPS connection (1): admin.iddd.com:443
[DEBUG  ] Starting new HTTPS connection (1): cdd.com:443
[WARNING] Deprecated property "<NumericProperty name=padding_x>" of object "<kivy.uix.button.Button object at 0x0000021E0910FA80>" was accessed, it will be removed in a future version
[DEBUG  ] https://cobrdd.com:443 "GET /static/software/SPY/crs_files.zip HTTP/1.1" 301 None
[DEBUG  ] Starting new HTTPS connection (1): www.coddstems.com:443
[DEBUG  ] https://www.ddd.com:443 "GET /static/software/SPY/crs_files.zip HTTP/1.1" 200 4059522
[DEBUG  ] https://admin.ddd.com:443 "GET /crs_api.php HTTP/1.1" 404 None
[INFO   ] Base: Start application main loop

elli...@cox.net

unread,
May 9, 2024, 11:44:47 AM5/9/24
to pyins...@googlegroups.com
The location of files relative to the exe changed in PyInstaller 6.0
You could try going back to version 5 and see if that makes  a difference.

WIth kivy I have always used one-directory builds with a specfile.  I then use innosetup to build a Windows Installer.


From: pyins...@googlegroups.com <pyins...@googlegroups.com> on behalf of Aftab Sarwar <aftab.s...@gmail.com>
Sent: Thursday, May 9, 2024 8:37 AM
To: PyInstaller <pyins...@googlegroups.com>
Subject: [PyInstaller] Re: Pyinstaller exe shows blank screen
 
[DEBUG  ] Starting new HTTPS connection (1): api.portal.cobrafiringsystems.com:443

[DEBUG  ] https://api.portal.ddd.com:443 "GET /users/me HTTP/1.1" 200 1090
[INFO   ] GL: NPOT texture support is available
[DEBUG  ] Starting new HTTPS connection (1): admin.ignitefiringsystems.com:443
[DEBUG  ] Starting new HTTPS connection (1): cobrafiringsystems.com:443

[WARNING] Deprecated property "<NumericProperty name=padding_x>" of object "<kivy.uix.button.Button object at 0x0000021E0910FA80>" was accessed, it will be removed in a future version
[DEBUG  ] https://cobrafiringsystems.com:443 "GET /static/software/SPY/crs_files.zip HTTP/1.1" 301 None
[DEBUG  ] Starting new HTTPS connection (1): www.cobrafiringsystems.com:443

[DEBUG  ] https://www.ddd.com:443 "GET /static/software/SPY/crs_files.zip HTTP/1.1" 200 4059522
[DEBUG  ] https://admin.ddd.com:443 "GET /crs_api.php HTTP/1.1" 404 None
[INFO   ] Base: Start application main loop

On Thursday, May 9, 2024 at 8:30:58 PM UTC+5 Elliot Garbus wrote:

--
You received this message because you are subscribed to the Google Groups "PyInstaller" group.
To unsubscribe from this group and stop receiving emails from it, send an email to pyinstaller...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/pyinstaller/dde0214e-70de-4e58-a31a-145066c18f87n%40googlegroups.com.

Aftab Sarwar

unread,
May 9, 2024, 11:47:52 AM5/9/24
to PyInstaller
What is the new relative path in Pyinstaller 6.x.x? Could you please tell me?

Aftab Sarwar

unread,
May 9, 2024, 11:54:52 AM5/9/24
to PyInstaller
You are right, this issue is about the relative path to the kv files. I added exception to a few files and it showed error for another file (previous ones were not shown in error message). Either I need to change the relative path or use your method of using spec file. thanks for the help, I'll update with the result of my changes.
Thanks a lot.

elli...@cox.net

unread,
May 9, 2024, 12:01:43 PM5/9/24
to PyInstaller
According to the docs, this change only impacted one-directory builds.  In version 5 and prior the exe and all the files were located in the same directory.  In version 6 in a one-directory build all the files are placed in sub-directory from where the .exe is located.

I'm surprised you are able to build a one-file build with kivy, by copying the kv files post build.  When pyinstaller is creating the exe it is zipping all of the files.   You may want to use --add -data to the command line,  https://pyinstaller.org/en/stable/usage.html#cmdoption-add-data

or move to using a specfile.


Sent: Thursday, May 9, 2024 8:47 AM
To: PyInstaller <pyins...@googlegroups.com>
Subject: Re: [PyInstaller] Re: Pyinstaller exe shows blank screen
 
Reply all
Reply to author
Forward
0 new messages