This is happening because PyInstaller doesn’t automatically include system-installed libraries when bundling your Python script. You can explicitly add it using --hidden-import option, so your run command would be:
run: pyinstaller -F --hidden-import=gi script.py
Or you could use custom hook