rosbagpython-3.x

Try to generate pyinstaller with rosbag


I try to generate a binary file from my main.py. My program just import rosbag package :

from rosbag import Bag

I use the pyinstaller command to generate a binary file:

pyinstaller --name="MyApplication" --windowed --onefile --paths ./venv/lib/python3.8/site-packages/ main.py

Here is the prints during the process:

174 INFO: PyInstaller: 5.13.1
174 INFO: Python: 3.8.10
181 INFO: Platform: Linux-5.15.0-82-generic-x86_64-with-glibc2.29
181 INFO: wrote /home/xavier/dev/3003/data_analyser/MyApplication.spec
183 INFO: Extending PYTHONPATH with paths
['/home/xavier/dev/3003/data_analyser',
 '/home/xavier/dev/3003/data_analyser/venv/lib/python3.8/site-packages']
24 WARNING: discover_hook_directories: Failed to process hook entry point 'hook-dirs = pydrive2.__pyinstaller:get_hook_dirs': pkg_resources.ContextualVersionConflict: (httplib2 0.14.0 (/home/xavier/.local/lib/python3.8/site-packages), Requirement.parse('httplib2<1dev,>=0.15.0'), {'google-api-python-client'})
473 INFO: checking Analysis
473 INFO: Building Analysis because Analysis-00.toc is non existent
473 INFO: Initializing module dependency graph...
474 INFO: Caching module graph hooks...
478 INFO: Analyzing base_library.zip ...
1112 INFO: Loading module hook 'hook-heapq.py' from '/home/xavier/.local/lib/python3.8/site-packages/PyInstaller/hooks'...
1167 INFO: Loading module hook 'hook-encodings.py' from '/home/xavier/.local/lib/python3.8/site-packages/PyInstaller/hooks'...
1805 INFO: Loading module hook 'hook-pickle.py' from '/home/xavier/.local/lib/python3.8/site-packages/PyInstaller/hooks'...
2325 INFO: Caching module dependency graph...
2386 INFO: running Analysis Analysis-00.toc
2400 INFO: Analyzing /home/xavier/dev/3003/data_analyser/main.py
2618 INFO: Loading module hook 'hook-Cryptodome.py' from '/home/xavier/.local/lib/python3.8/site-packages/_pyinstaller_hooks_contrib/hooks/stdhooks'...
2864 INFO: Loading module hook 'hook-pycparser.py' from '/home/xavier/.local/lib/python3.8/site-packages/_pyinstaller_hooks_contrib/hooks/stdhooks'...
3170 INFO: Processing pre-safe import module hook distutils from '/home/xavier/.local/lib/python3.8/site-packages/PyInstaller/hooks/pre_safe_import_module/hook-distutils.py'.
3171 INFO: Processing pre-find module path hook distutils from '/home/xavier/.local/lib/python3.8/site-packages/PyInstaller/hooks/pre_find_module_path/hook-distutils.py'.
3203 INFO: Loading module hook 'hook-distutils.py' from '/home/xavier/.local/lib/python3.8/site-packages/PyInstaller/hooks'...
3225 INFO: Loading module hook 'hook-distutils.util.py' from '/home/xavier/.local/lib/python3.8/site-packages/PyInstaller/hooks'...
3241 INFO: Loading module hook 'hook-sysconfig.py' from '/home/xavier/.local/lib/python3.8/site-packages/PyInstaller/hooks'...
3385 INFO: Loading module hook 'hook-setuptools.py' from '/home/xavier/.local/lib/python3.8/site-packages/PyInstaller/hooks'...
3831 INFO: Loading module hook 'hook-importlib_metadata.py' from '/home/xavier/.local/lib/python3.8/site-packages/PyInstaller/hooks'...
3846 INFO: Loading module hook 'hook-platform.py' from '/home/xavier/.local/lib/python3.8/site-packages/PyInstaller/hooks'...
4122 INFO: Loading module hook 'hook-packaging.py' from '/home/xavier/.local/lib/python3.8/site-packages/PyInstaller/hooks'...
4362 INFO: Processing pre-safe import module hook six.moves from '/home/xavier/.local/lib/python3.8/site-packages/PyInstaller/hooks/pre_safe_import_module/hook-six.moves.py'.
4701 INFO: Loading module hook 'hook-pkg_resources.py' from '/home/xavier/.local/lib/python3.8/site-packages/PyInstaller/hooks'...
5305 INFO: Loading module hook 'hook-xml.py' from '/home/xavier/.local/lib/python3.8/site-packages/PyInstaller/hooks'...
5514 INFO: Loading module hook 'hook-xml.dom.domreg.py' from '/home/xavier/.local/lib/python3.8/site-packages/PyInstaller/hooks'...
5883 INFO: Processing pre-safe import module hook urllib3.packages.six.moves from '/home/xavier/.local/lib/python3.8/site-packages/PyInstaller/hooks/pre_safe_import_module/hook-urllib3.packages.six.moves.py'.
6513 INFO: Loading module hook 'hook-cryptography.py' from '/home/xavier/.local/lib/python3.8/site-packages/_pyinstaller_hooks_contrib/hooks/stdhooks'...
7479 INFO: Loading module hook 'hook-bcrypt.py' from '/home/xavier/.local/lib/python3.8/site-packages/_pyinstaller_hooks_contrib/hooks/stdhooks'...
7651 INFO: Loading module hook 'hook-certifi.py' from '/home/xavier/.local/lib/python3.8/site-packages/_pyinstaller_hooks_contrib/hooks/stdhooks'...
8042 INFO: Loading module hook 'hook-httplib2.py' from '/home/xavier/.local/lib/python3.8/site-packages/_pyinstaller_hooks_contrib/hooks/stdhooks'...
8274 INFO: Loading module hook 'hook-multiprocessing.util.py' from '/home/xavier/.local/lib/python3.8/site-packages/PyInstaller/hooks'...
8601 INFO: Loading module hook 'hook-difflib.py' from '/home/xavier/.local/lib/python3.8/site-packages/PyInstaller/hooks'...
8783 INFO: Loading module hook 'hook-xml.etree.cElementTree.py' from '/home/xavier/.local/lib/python3.8/site-packages/PyInstaller/hooks'...
9113 INFO: Loading module hook 'hook-keyring.py' from '/home/xavier/.local/lib/python3.8/site-packages/PyInstaller/hooks'...
25 INFO: Loading KWallet
27 INFO: Loading SecretService
29 INFO: Loading Windows
29 INFO: Loading chainer
29 INFO: Loading macOS
9750 INFO: Loading module hook 'hook-psutil.py' from '/home/xavier/.local/lib/python3.8/site-packages/_pyinstaller_hooks_contrib/hooks/stdhooks'...
9941 INFO: Loading module hook 'hook-numpy.py' from '/home/xavier/.local/lib/python3.8/site-packages/PyInstaller/hooks'...
12114 INFO: Loading module hook 'hook-jinja2.py' from '/home/xavier/.local/lib/python3.8/site-packages/_pyinstaller_hooks_contrib/hooks/stdhooks'...
13192 INFO: Loading module hook 'hook-IPython.py' from '/home/xavier/.local/lib/python3.8/site-packages/_pyinstaller_hooks_contrib/hooks/stdhooks'...
14493 INFO: Loading module hook 'hook-pygments.py' from '/home/xavier/.local/lib/python3.8/site-packages/PyInstaller/hooks'...
15789 INFO: Loading module hook 'hook-wcwidth.py' from '/home/xavier/.local/lib/python3.8/site-packages/PyInstaller/hooks'...
16411 INFO: Loading module hook 'hook-jedi.py' from '/home/xavier/.local/lib/python3.8/site-packages/_pyinstaller_hooks_contrib/hooks/stdhooks'...
16617 INFO: Loading module hook 'hook-parso.py' from '/home/xavier/.local/lib/python3.8/site-packages/_pyinstaller_hooks_contrib/hooks/stdhooks'...
17719 INFO: Loading module hook 'hook-platformdirs.py' from '/home/xavier/.local/lib/python3.8/site-packages/_pyinstaller_hooks_contrib/hooks/stdhooks'...
18255 INFO: Loading module hook 'hook-sqlite3.py' from '/home/xavier/.local/lib/python3.8/site-packages/PyInstaller/hooks'...
20342 INFO: Processing pre-safe import module hook win32com from '/home/xavier/.local/lib/python3.8/site-packages/_pyinstaller_hooks_contrib/hooks/pre_safe_import_module/hook-win32com.py'.
21119 INFO: Processing module hooks...
21121 INFO: Loading module hook 'hook-_tkinter.py' from '/home/xavier/.local/lib/python3.8/site-packages/PyInstaller/hooks'...
21121 INFO: checking Tree
21121 INFO: Building Tree because Tree-00.toc is non existent
21121 INFO: Building Tree Tree-00.toc
21123 INFO: checking Tree
21123 INFO: Building Tree because Tree-01.toc is non existent
21123 INFO: Building Tree Tree-01.toc
21124 WARNING: Tcl modules directory /usr/share/tcltk/tcl8.6/../tcl8 does not exist.
21168 INFO: Loading module hook 'hook-PIL.py' from '/home/xavier/.local/lib/python3.8/site-packages/PyInstaller/hooks'...
21225 INFO: Loading module hook 'hook-PIL.Image.py' from '/home/xavier/.local/lib/python3.8/site-packages/PyInstaller/hooks'...
21570 INFO: Loading module hook 'hook-PIL.ImageFilter.py' from '/home/xavier/.local/lib/python3.8/site-packages/PyInstaller/hooks'...
22198 WARNING: Hidden import "pkg_resources._vendor.appdirs" not found!
22228 WARNING: Hidden import "pkg_resources._vendor.packaging.__about__" not found!
22228 WARNING: Hidden import "pkg_resources._vendor.packaging._compat" not found!
22266 WARNING: Hidden import "pkg_resources._vendor.pyparsing" not found!
22266 WARNING: Hidden import "pkg_resources._vendor.six" not found!
22266 WARNING: Hidden import "pkg_resources.py2_warn" not found!
22429 INFO: Loading module hook 'hook-PIL.SpiderImagePlugin.py' from '/home/xavier/.local/lib/python3.8/site-packages/PyInstaller/hooks'...
22455 INFO: Loading module hook 'hook-setuptools.msvc.py' from '/home/xavier/.local/lib/python3.8/site-packages/PyInstaller/hooks'...
22459 WARNING: Hidden import "setuptools._vendor.packaging.__about__" not found!
22459 WARNING: Hidden import "setuptools._vendor.packaging._compat" not found!
22460 WARNING: Hidden import "setuptools._vendor.pyparsing" not found!
22460 WARNING: Hidden import "setuptools._vendor.six" not found!
22551 INFO: Processing pre-safe import module hook gi from '/home/xavier/.local/lib/python3.8/site-packages/PyInstaller/hooks/pre_safe_import_module/hook-gi.py'.
22608 INFO: Loading module hook 'hook-gi.py' from '/home/xavier/.local/lib/python3.8/site-packages/PyInstaller/hooks'...
22711 INFO: Processing pre-safe import module hook gi.repository.GLib from '/home/xavier/.local/lib/python3.8/site-packages/PyInstaller/hooks/pre_safe_import_module/hook-gi.repository.GLib.py'.
22780 INFO: Loading module hook 'hook-gi.repository.GLib.py' from '/home/xavier/.local/lib/python3.8/site-packages/PyInstaller/hooks'...
23179 INFO: Loading module hook 'hook-PyQt5.QtCore.py' from '/home/xavier/.local/lib/python3.8/site-packages/PyInstaller/hooks'...
23298 INFO: Loading module hook 'hook-PyQt5.py' from '/home/xavier/.local/lib/python3.8/site-packages/PyInstaller/hooks'...
23343 INFO: Looking for ctypes DLLs
23430 INFO: Analyzing run-time hooks ...
23440 INFO: Including run-time hook '/home/xavier/.local/lib/python3.8/site-packages/PyInstaller/hooks/rthooks/pyi_rth_multiprocessing.py'
23441 INFO: Including run-time hook '/home/xavier/.local/lib/python3.8/site-packages/PyInstaller/hooks/rthooks/pyi_rth_pkgutil.py'
23442 INFO: Including run-time hook '/home/xavier/.local/lib/python3.8/site-packages/PyInstaller/hooks/rthooks/pyi_rth_pyqt5.py'
23443 INFO: Including run-time hook '/home/xavier/.local/lib/python3.8/site-packages/PyInstaller/hooks/rthooks/pyi_rth_glib.py'
23443 INFO: Including run-time hook '/home/xavier/.local/lib/python3.8/site-packages/PyInstaller/hooks/rthooks/pyi_rth_gi.py'
23444 INFO: Including run-time hook '/home/xavier/.local/lib/python3.8/site-packages/_pyinstaller_hooks_contrib/hooks/rthooks/pyi_rth_traitlets.py'
23444 INFO: Including run-time hook '/home/xavier/.local/lib/python3.8/site-packages/PyInstaller/hooks/rthooks/pyi_rth_setuptools.py'
23444 INFO: Including run-time hook '/home/xavier/.local/lib/python3.8/site-packages/PyInstaller/hooks/rthooks/pyi_rth__tkinter.py'
23445 INFO: Including run-time hook '/home/xavier/.local/lib/python3.8/site-packages/PyInstaller/hooks/rthooks/pyi_rth_pkgres.py'
23447 INFO: Including run-time hook '/home/xavier/.local/lib/python3.8/site-packages/PyInstaller/hooks/rthooks/pyi_rth_inspect.py'
23502 INFO: Compiling collected GLib schema files in '/home/xavier/dev/3003/data_analyser/build/MyApplication/_pyi_gschema_compilation'...
23572 INFO: Looking for dynamic libraries
2004 WARNING: Cannot find libicuuc.so.56 (needed by /home/xavier/.local/lib/python3.8/site-packages/PyQt5/Qt/lib/libicui18n.so.56)
2004 WARNING: Cannot find libicudata.so.56 (needed by /home/xavier/.local/lib/python3.8/site-packages/PyQt5/Qt/lib/libicui18n.so.56)
2021 WARNING: Cannot find libicudata.so.56 (needed by /home/xavier/.local/lib/python3.8/site-packages/PyQt5/Qt/lib/libicuuc.so.56)
2197 WARNING: Cannot find libfreetype-9b226f05.so.6.18.3 (needed by /home/xavier/.local/lib/python3.8/site-packages/PIL/../Pillow.libs/libharfbuzz-2a5452dc.so.0.40401.0)
2230 WARNING: Cannot find libpng16-f3cb5a53.so.16.37.0 (needed by /home/xavier/.local/lib/python3.8/site-packages/PIL/../Pillow.libs/libfreetype-9b226f05.so.6.18.3)
2256 WARNING: Cannot find libwebp-a2d91712.so.7.1.3 (needed by /home/xavier/.local/lib/python3.8/site-packages/PIL/../Pillow.libs/libwebpmux-625e1d4a.so.3.0.8)
2261 WARNING: Cannot find libwebp-a2d91712.so.7.1.3 (needed by /home/xavier/.local/lib/python3.8/site-packages/PIL/../Pillow.libs/libwebpdemux-df590b8f.so.2.0.9)
2285 WARNING: Cannot find libXau-154567c4.so.6.0.0 (needed by /home/xavier/.local/lib/python3.8/site-packages/PIL/../Pillow.libs/libxcb-4971137c.so.1.1.0)
2294 WARNING: Cannot find liblzma-96284f0d.so.5.2.5 (needed by /home/xavier/.local/lib/python3.8/site-packages/PIL/../Pillow.libs/libtiff-f706b4a5.so.5.8.0)
2294 WARNING: Cannot find libjpeg-a4c3d5e9.so.62.3.0 (needed by /home/xavier/.local/lib/python3.8/site-packages/PIL/../Pillow.libs/libtiff-f706b4a5.so.5.8.0)
2543 WARNING: Cannot find libgfortran-040039e1.so.5.0.0 (needed by /home/xavier/dev/3003/data_analyser/venv/lib/python3.8/site-packages/numpy/core/../../numpy.libs/libopenblas64_p-r0-15028c96.3.21.so)
2560 WARNING: Cannot find libquadmath-96973f99.so.0.0.0 (needed by /home/xavier/dev/3003/data_analyser/venv/lib/python3.8/site-packages/numpy/core/../../numpy.libs/libgfortran-040039e1.so.5.0.0)
26252 INFO: Looking for eggs
26276 INFO: Using Python library /lib/x86_64-linux-gnu/libpython3.8.so.1.0
26288 INFO: Warnings written to /home/xavier/dev/3003/data_analyser/build/MyApplication/warn-MyApplication.txt
26358 INFO: Graph cross-reference written to /home/xavier/dev/3003/data_analyser/build/MyApplication/xref-MyApplication.html
26406 INFO: checking PYZ
26406 INFO: Building PYZ because PYZ-00.toc is non existent
26406 INFO: Building PYZ (ZlibArchive) /home/xavier/dev/3003/data_analyser/build/MyApplication/PYZ-00.pyz
27650 INFO: Building PYZ (ZlibArchive) /home/xavier/dev/3003/data_analyser/build/MyApplication/PYZ-00.pyz completed successfully.
27724 INFO: checking PKG
27724 INFO: Building PKG because PKG-00.toc is non existent
27724 INFO: Building PKG (CArchive) MyApplication.pkg
42416 INFO: Building PKG (CArchive) MyApplication.pkg completed successfully.
42439 INFO: Bootloader /home/xavier/.local/lib/python3.8/site-packages/PyInstaller/bootloader/Linux-64bit-intel/run
42439 INFO: checking EXE
42439 INFO: Building EXE because EXE-00.toc is non existent
42439 INFO: Building EXE from EXE-00.toc
42439 INFO: Copying bootloader EXE to /home/xavier/dev/3003/data_analyser/dist/MyApplication
42439 INFO: Appending PKG archive to custom ELF section in EXE
42504 INFO: Building EXE from EXE-00.toc completed successfully.

It seems there is warning but I don't know if it is a problem. When I run the program I get an error:

./dist/MyApplication 
Traceback (most recent call last):
  File "PyInstaller/hooks/rthooks/pyi_rth_pkgres.py", line 200, in <module>
  File "PyInstaller/hooks/rthooks/pyi_rth_pkgres.py", line 36, in _pyi_rthook
  File "PyInstaller/loader/pyimod02_importers.py", line 385, in exec_module
  File "pkg_resources/__init__.py", line 79, in <module>
  File "pkg_resources/extern/__init__.py", line 52, in create_module
  File "pkg_resources/extern/__init__.py", line 44, in load_module
ImportError: The 'jaraco' package is required; normally this is bundled with this package so if you get this warning, consult the packager of your distribution.
[15229] Failed to execute script 'pyi_rth_pkgres' due to unhandled exception!

Solution

  • This looks like a pyinstaller setuptools compatibility bug: https://github.com/pyinstaller/pyinstaller/issues/6564

    You will need to make sure that you have compatible versions of pyinstaller and setuptools in your environment.