Pyinstaller app doesn't display .png images

39 views
Skip to first unread message

David J Beck

unread,
Nov 7, 2018, 2:05:53 PM11/7/18
to PyInstaller
I am having a problem with an app I'm trying to bundle with Pyinstaller (OS 10.13 and 10.14, Qt 5.11, PyQt5, Python 3.7). I build a -onefolder app and it runs properly except the .png splash screen and all the .png button icons are not visible; they are in the places they should be in the dist directory, and the .txt files that I also include in the app are available (so it is not that things are in the wrong place). I can run the app itself in Python from the command line, so it is something specific about the app once it goes through Pyinstaller.

Any suggestions for things to try would be welcome

Martin Zibricky

unread,
Nov 7, 2018, 4:03:29 PM11/7/18
to pyins...@googlegroups.com
Hi,

there are several options:
- proper path to images when running in frozen mode - to load the images in your app look at this recipe [1]
- issue with qt_plugins - Qt bundles image format support as additional .so libs - for some reason the plugin
  to read png is not bundled. Maybe the Qt library was compiled in any non-standard way or the png .so plugin
  is mssing some dependent .dylib files etc.


Regards
Martin Zibricky

On Wed, Nov 7, 2018 at 8:05 PM David J Beck <db...@ualberta.ca> wrote:
I am having a problem with an app I'm trying to bundle with Pyinstaller (OS 10.13 and 10.14, Qt 5.11, PyQt5, Python 3.7). I build a -onefolder app and it runs properly except the .png splash screen and all the .png button icons are not visible; they are in the places they should be in the dist directory, and the .txt files that I also include in the app are available (so it is not that things are in the wrong place). I can run the app itself in Python from the command line, so it is something specific about the app once it goes through Pyinstaller.

Any suggestions for things to try would be welcome

--
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 post to this group, send email to pyins...@googlegroups.com.
Visit this group at https://groups.google.com/group/pyinstaller.
For more options, visit https://groups.google.com/d/optout.

David Beck

unread,
Nov 8, 2018, 11:14:59 AM11/8/18
to pyins...@googlegroups.com
Thanks for that.

> On Nov 7, 2018, at 2:03 PM, Martin Zibricky <mzibr....@gmail.com> wrote:
>
> Hi,
>
> there are several options:
> - proper path to images when running in frozen mode - to load the images in your app look at this recipe [1]

I have this recipe in the .spec file, and the app finds the .txt files in the same location, so I don’t think it is this.

> - issue with qt_plugins - Qt bundles image format support as additional .so libs - for some reason the plugin
> to read png is not bundled. Maybe the Qt library was compiled in any non-standard way or the png .so plugin
> is mssing some dependent .dylib files etc.

That’s a good lead, but it appears that .png doesn’t need a special plug-in for Qt, it is built in. As far as I can tell, the png library Qt uses is libpng and is included in /Qt5.11.0/5.11.0/Src/qtbase/src/3rdparty/libpng, but Pyinstaller doesn’t seem to import this part of the Qt installation, unless it bundles it into some other file or component of the app.

David

>
> [1] https://github.com/pyinstaller/pyinstaller/wiki/Recipe-Collect-Data-Files
>
> Regards
> Martin Zibricky
>
> On Wed, Nov 7, 2018 at 8:05 PM David J Beck <db...@ualberta.ca> wrote:
> I am having a problem with an app I'm trying to bundle with Pyinstaller (OS 10.13 and 10.14, Qt 5.11, PyQt5, Python 3.7). I build a -onefolder app and it runs properly except the .png splash screen and all the .png button icons are not visible; they are in the places they should be in the dist directory, and the .txt files that I also include in the app are available (so it is not that things are in the wrong place). I can run the app itself in Python from the command line, so it is something specific about the app once it goes through Pyinstaller.
>
> Any suggestions for things to try would be welcome
>
> --
> 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 post to this group, send email to pyins...@googlegroups.com.
> Visit this group at https://groups.google.com/group/pyinstaller.
> For more options, visit https://groups.google.com/d/optout.
>
> --
> You received this message because you are subscribed to a topic in the Google Groups "PyInstaller" group.
> To unsubscribe from this topic, visit https://groups.google.com/d/topic/pyinstaller/HbDgqmzjp_Y/unsubscribe.
> To unsubscribe from this group and all its topics, send an email to pyinstaller...@googlegroups.com.

David Beck

unread,
Nov 8, 2018, 1:23:39 PM11/8/18
to pyins...@googlegroups.com
Martin’s suggestions got me thinking (and Googling) about the problem in a different way and I turned up this on StackOverflow


The solution here, updated to PyQt5, works, though it doesn’t seem necessary to alter the .spec file as suggested here (the post is older, so newer versions of pyinstaller don’t need it). 

David
Reply all
Reply to author
Forward
0 new messages