Search code examples
pythonpython-3.xmatplotlibpyqt5fbs

Failed to execute script fbs_pyinstaller_hook


I'm trying to create an executable file from the my PyQt5 application. my system specs:

  • ubuntu 18.04
  • python (3.6.9)
  • fbs (0.8.9)
  • matplotlib (3.3.0)
  • numpy (1.19.1)
  • pandas (1.1.0)

I'm following fbs tutorial to build a executable file from my application. I run the application without error with fbs run command.

The fbs freeze command produce this output:

-c:12: MatplotlibDeprecationWarning: 
The matplotlib.backends.backend_qt4agg backend was deprecated in Matplotlib 3.3 and will be removed two minor releases later.
Done. You can now run `target/DataVisualization/DataVisualization`. If
that doesn't work, see https://build-system.fman.io/troubleshooting.

But I'm importing version 5 of matplotlib.backends.backend_qt4agg in my code as:

from matplotlib.backends.backend_qt5agg import FigureCanvasQTAgg, NavigationToolbar2QT as NavigationToolbar

when I run the executable file from

~/MyProject/target/AppName

I get this error:

./AppName 
Traceback (most recent call last):
  File "fbs_pyinstaller_hook.py", line 2, in <module>
  File "importlib/__init__.py", line 126, in import_module
  File "<frozen importlib._bootstrap>", line 994, in _gcd_import
  File "<frozen importlib._bootstrap>", line 971, in _find_and_load
  File "<frozen importlib._bootstrap>", line 941, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed
  File "<frozen importlib._bootstrap>", line 994, in _gcd_import
  File "<frozen importlib._bootstrap>", line 971, in _find_and_load
  File "<frozen importlib._bootstrap>", line 953, in _find_and_load_unlocked
ModuleNotFoundError: No module named 'fbs_runtime'
[1331] Failed to execute script fbs_pyinstaller_hook

I have checked the solutions given in these links, but none of them came handy!

Any ideas of what to do?


Solution

  • I entirely gave up using FBS.. pyinstaller works very well for compiling PyQt5 code.. try using just pyinstaller and see if that works.