BrillouinMicroscopy / BMicro

Python GUI for post-measurement Brillouin microscopy analysis.
GNU General Public License v3.0
4 stars 0 forks source link

App crashes on export, batch export does nothing #197

Closed raimund-schluessler closed 2 years ago

raimund-schluessler commented 2 years ago

It works when running locally, but the pyinstaller builds fail.

The error message is:

Unhandled exception in BMicro version 0.3.0.post2:
Traceback (most recent call last):
  File "bmicro\gui\main.py", line 191, in export_file
    ExportController().export()
  File "bmlab\controllers.py", line 1084, in export
  File "bmlab\export\brillouin_export.py", line 113, in export
  File "matplotlib\pyplot.py", line 979, in savefig
  File "matplotlib\figure.py", line 3046, in savefig
  File "matplotlib\backends\backend_qtagg.py", line 85, in print_figure
  File "matplotlib\backend_bases.py", line 2259, in print_figure
  File "matplotlib\backend_bases.py", line 2184, in _get_output_canvas
  File "matplotlib\backend_bases.py", line 144, in get_registered_canvas_class
  File "importlib\__init__.py", line 127, in import_module
  File "<frozen importlib._bootstrap>", line 1030, in _gcd_import
  File "<frozen importlib._bootstrap>", line 1007, in _find_and_load
  File "<frozen importlib._bootstrap>", line 984, in _find_and_load_unlocked
ModuleNotFoundError: No module named 'matplotlib.backends.backend_pdf'

Apparently, pyinstaller does not pack the backend_pdf. Trying to add it as a hidden import in #200 made it worse and the pyinstaller build is completely broken. @paulmueller Do you have any idea maybe?

raimund-schluessler commented 2 years ago

Explicitly importing PdfPages from matplotlib.backends.backend_pdf in https://github.com/BrillouinMicroscopy/bmlab/pull/134 solved the issue.