pyinstaller not integrating a cairo.Context properly

Question:

I’m trying to prepare an executable for delivery using pyinstaller.

I’ve installed and run pyinstaller as follows:

sudo pip install pyinstaller

everything looks good after the install, so I proceed to run the tool on my application

sudo pyinstaller App.py --onefile

this produces an executable in the ./dist folder as expected. When I move this file to the normal runtime folder where the app works correctly when run from python source (e.g. sudo ./App.py a b c), the app launches and is clearly working in most ever way (it is reading data and writing files, etc., however the graphics for some of the dynamic drawing isn’t getting rendered.

On the console where it was launched from, the following error is shown, many times:

TypeError: Couldn't find foreign struct converter for 'cairo.Context'

However, this package has been installed, along with a similar package, prior to running the pyinstaller:

sudo apt install python3-gi-cairo
Reading package lists... Done
Building dependency tree       
Reading state information... Done
python3-gi-cairo is already the newest version (3.36.0-1).
0 upgraded, 0 newly installed, 0 to remove and 6 not upgraded.

Also, pyinstaller produces these following lines while building the executable:

26841 INFO: Analyzing hidden import 'python-gi-cairo'
26841 ERROR: Hidden import 'python-gi-cairo' not found

Why isn’t pyinstaller seeing the python-gi-cairo package?

Any ideas for what I can try next?

Asked By: Walt

||

Answers:

This is a duplicate question, to this one, and could be closed or removed.
missing dependency after running pyinstaller

The answer to the question, is also answered in the above referenced link.

Answered By: Walt
Categories: questions Tags: , ,
Answers are sorted by their score. The answer accepted by the question owner as the best is marked with
at the top-right corner.