New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Freezing a PyGI app - Part 4 #3257

Closed
dalejfer opened this Issue Jan 27, 2018 · 3 comments

Comments

Projects
None yet
2 participants
@dalejfer

dalejfer commented Jan 27, 2018

PyInstaller 3.3 runs successfully to completion for my simple PyGI app, but the .exe complaints of missing typelibs, when they are added it just crashes. Using an older version of PyInstaller works fine with the same app.

My initial set up was Python 3.4, 64 bits on Windows 10, PyGI version 3.24.1 rev 1 from the all-in-one installer available at sourceforge, and PyInstaller 3.3.1 installed via pip.
In the PyGI installer I only selected GTK+ 3.18.9 from the available libraries (besides the default GI and dependencies) and Glade from the aditional software options.

In my specfile, I only added css and glade directories in the datas section.

PyInstaller run successfully but when I tried to execute the .exe it wouldn't do anything.

Googling I found this issue: #1966 , so I tried using pyinstaller with a even simpler app, in this case the Button example from the PyGobject Tutorial. The outcome was the same.
Making a console installer and running it from powershell printed out the following traceback:

Traceback (most recent call last):
  File "site-packages\gi\importer.py", line 138, in load_module
  File "site-packages\gi\module.py", line 275, in get_introspection_module
  File "site-packages\gi\module.py", line 122, in __init__
gi.RepositoryError: Typelib file for namespace 'GdkPixbuf', version '2.0' not found

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "gui.py", line 3, in <module>
  File "site-packages\gi\importer.py", line 140, in load_module
ImportError: Typelib file for namespace 'GdkPixbuf', version '2.0' not found
[5336] Failed to execute script gui

This was looking a lot like the original issue, so following the comments I manually added the GdkPixbuf typelib (GdkPixbuf-2.0.typelib) into the gi_typelibs directory of my installer.
Now there was another traceback:

Traceback (most recent call last):
  File "site-packages\gi\importer.py", line 138, in load_module
  File "site-packages\gi\module.py", line 275, in get_introspection_module
  File "site-packages\gi\module.py", line 122, in __init__
gi.RepositoryError: Typelib file for namespace 'GModule', version '2.0' not found

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "gui.py", line 3, in <module>
  File "site-packages\gi\importer.py", line 140, in load_module
ImportError: Typelib file for namespace 'GModule', version '2.0' not found
[10380] Failed to execute script gui

So I manually copied the GModule typelib (GModule-2.0.typelib).

After doing this the executable simply crashed with no traceback. And windows showed the typical "gui.exe has stopped working" message.

Here I'd like to mention that per the patch developed in the mentioned issue, the gi_typelibs directory was created automatically in my installer's dist/gui directory. Also, the GdkPixbuff and GModule typelibs (that were not copied) were in my /gnome/lib/girepository-1.0 directory among all the other typelibs that were indeed copied.

I added some prints to the script before and after the call to the main class, like this.

print("before main class call")
win = ButtonWindow()
print("after main class call")

The first print worked fine, but it crashed after that, just like before.

Next thing, I tried using the latest PyInstaller version from github (v 3.4.dev0+ab8fd9753). The result was the same.

After that I tried using an older version of PyGI (v 3.18.2 rev 12). The result was the same.

I tried making the installer several times, using fresh installs of Python 3.4 and PyGI. Also added the hook to copy all typelib files. But it was all the same.

Finally I tried using an older version of PyInstaller. I used version 3.2 (the same as in the mentioned issue) and I added the hook to copy all the typelib files from the PyGI package. This worked perfectly.

I hope this is enough to reproduce the bug (if there is one and I'm not missing something) and help to solve it.
If you need anything else, tell me and I'll do my best to help.

Output when creating the installer.
Output of py-archive_viewer on gui.exe
Output of py-archive_viewer on out00-PYZ.pyz
For completion, PyGobject Button tutorial script and the simple spec file.

@virtuald

This comment has been minimized.

Contributor

virtuald commented Jan 28, 2018

I've not used PyGI AIO recently as it had gotten out of date at some point, but I've had success using the latest versions of GTK et al that are installed via msys2 -- and with some work, pyinstaller works fine with msys2.

I've got scripts and stuff setup to do that at https://github.com/exaile/python-gtk3-gst-sdk , perhaps give those a shot and let me know?

@dalejfer

This comment has been minimized.

dalejfer commented Feb 3, 2018

I'll try to give it a go this weekend. I'll let you know.

@virtuald

This comment has been minimized.

Contributor

virtuald commented Mar 9, 2018

#3387 will most likely fix this issue, have only tried it on msys2 however.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment