Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

freeze not working: Failed to execute script main #31

Closed
boulund opened this issue Sep 30, 2018 · 16 comments
Closed

freeze not working: Failed to execute script main #31

boulund opened this issue Sep 30, 2018 · 16 comments

Comments

@boulund
Copy link

boulund commented Sep 30, 2018

Hi,

Thanks for all the work you've put into fbs, the documentation has been really helpful! I ran into an issue now the first time I tried freezing my application, the frozen application won't start. I ran the following command to freeze the application (on Windows):

(pyqt_fbs) C:\Users\fredr\Documents\Code\list_scanner>python -m fbs freeze

This command produced no output.

When trying to run the produced target/CTMR list scanner/CTMR list scanner.exe I get the following message in a small dialog window:

Window title: Fatal Error!
Content: (Yellow exclamation sign) Failed to execute script main
Button: OK

All code is available here: https://github.com/ctmrbio/list_scanner/tree/pyqt-fbs. There is a conda environment file in the repo to reproduce the environment I was using as well.

I don't really know where to start troubleshooting this, is there a log file for frozen applications or something like that?

@mherrmann
Copy link
Owner

Hi, does the problem also occur with vanilla (not conda) Python 3.5, PyQt 5.9.2 and PyInstaller 3.3.1?

@mherrmann
Copy link
Owner

And you can also do python -m fbs freeze --debug to get more info when starting the app.

@boulund
Copy link
Author

boulund commented Sep 30, 2018

Thanks @mherrmann!

The debug output shows (not surprisingly) that there appears to be an issue with pandas:

(pyqt_fbs) C:\Users\fredr\Documents\Code\list_scanner\target\CTMR list scanner>"CTMR list scanner.exe"
[18748] PyInstaller Bootloader 3.x
[18748] LOADER: executable is C:\Users\fredr\Documents\Code\list_scanner\target\CTMR list scanner\CTMR list scanner.exe
[18748] LOADER: homepath is C:\Users\fredr\Documents\Code\list_scanner\target\CTMR list scanner
[18748] LOADER: _MEIPASS2 is NULL
[18748] LOADER: archivename is C:\Users\fredr\Documents\Code\list_scanner\target\CTMR list scanner\CTMR list scanner.exe
[18748] LOADER: No need to extract files to run; setting extractionpath to homepath
[18748] LOADER: SetDllDirectory(C:\Users\fredr\Documents\Code\list_scanner\target\CTMR list scanner)
[18748] LOADER: Already in the child - running user's code.
[18748] LOADER: Python library: C:\Users\fredr\Documents\Code\list_scanner\target\CTMR list scanner\python35.dll
[18748] LOADER: Loaded functions from Python library.
[18748] LOADER: Manipulating environment (sys.path, sys.prefix)
[18748] LOADER: Pre-init sys.path is C:\Users\fredr\Documents\Code\list_scanner\target\CTMR list scanner\base_library.zip;C:\Users\fredr\Documents\Code\list_scanner\target\CTMR list scanner
[18748] LOADER: sys.prefix is C:\Users\fredr\Documents\Code\list_scanner\target\CTMR list scanner
[18748] LOADER: Setting runtime options
[18748] LOADER: Initializing python
[18748] LOADER: Overriding Python's sys.path
[18748] LOADER: Post-init sys.path is C:\Users\fredr\Documents\Code\list_scanner\target\CTMR list scanner\base_library.zip;C:\Users\fredr\Documents\Code\list_scanner\target\CTMR list scanner
[18748] LOADER: Setting sys.argv
[18748] LOADER: setting sys._MEIPASS
[18748] LOADER: importing modules from CArchive
[18748] LOADER: extracted struct
[18748] LOADER: callfunction returned...
[18748] LOADER: extracted pyimod01_os_path
[18748] LOADER: callfunction returned...
[18748] LOADER: extracted pyimod02_archive
[18748] LOADER: callfunction returned...
[18748] LOADER: extracted pyimod03_importers
[18748] LOADER: callfunction returned...
[18748] LOADER: Installing PYZ archive with Python modules.
[18748] LOADER: PYZ archive: out00-PYZ.pyz
[18748] LOADER: Running pyiboot01_bootstrap.py
[18748] LOADER: Running pyi_rth_multiprocessing.py
[18748] LOADER: Running pyi_rth_pkgres.py
[18748] LOADER: Running pyi_rth_win32comgenpy.py
[18748] LOADER: Running pyi_rth_qt5.py
[18748] LOADER: Running main.py
Traceback (most recent call last):
  File "site-packages\pandas\__init__.py", line 26, in <module>
  File "c:\users\fredr\appdata\local\conda\conda\envs\pyqt_fbs\lib\site-packages\PyInstaller\loader\pyimod03_importers.py", line 631, in exec_module
    exec(bytecode, module.__dict__)
  File "site-packages\pandas\_libs\__init__.py", line 4, in <module>
  File "c:\users\fredr\appdata\local\conda\conda\envs\pyqt_fbs\lib\site-packages\PyInstaller\loader\pyimod03_importers.py", line 714, in load_module
    module = loader.load_module(fullname)
  File "pandas\_libs\tslibs\conversion.pxd", line 11, in init pandas._libs.tslib
  File "c:\users\fredr\appdata\local\conda\conda\envs\pyqt_fbs\lib\site-packages\PyInstaller\loader\pyimod03_importers.py", line 714, in load_module
    module = loader.load_module(fullname)
  File "pandas\_libs\tslibs\conversion.pyx", line 1, in init pandas._libs.tslibs.conversion
ImportError: No module named 'pandas._libs.tslibs.np_datetime'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "main.py", line 18, in <module>
  File "c:\users\fredr\appdata\local\conda\conda\envs\pyqt_fbs\lib\site-packages\PyInstaller\loader\pyimod03_importers.py", line 631, in exec_module
    exec(bytecode, module.__dict__)
  File "sample_list.py", line 9, in <module>
  File "c:\users\fredr\appdata\local\conda\conda\envs\pyqt_fbs\lib\site-packages\PyInstaller\loader\pyimod03_importers.py", line 631, in exec_module
    exec(bytecode, module.__dict__)
  File "site-packages\pandas\__init__.py", line 35, in <module>
ImportError: C extension: No module named 'pandas._libs.tslibs.np_datetime' not built. If you want to import pandas from the source directory, you may need to run 'python setup.py build_ext --inplace --force' to build the C extensions first.
[18748] Failed to execute script main
[18748] LOADER: OK.
[18748] LOADER: Cleaning up Python interpreter.

I'm planning to get rid of the pandas dependency in the tool, so it's probably not the end of the world. I don't have more time to play around with this now, but I think I can handle it from here. Thanks for the help so far!

@mherrmann
Copy link
Owner

Ok cool. Happy to help :-)

@boulund
Copy link
Author

boulund commented Sep 30, 2018

@mherrmann By the way, is it to be expected that pandas would work with fbs?

I'm curious because I might have a need for it in another project.

@mherrmann
Copy link
Owner

I strive to support every library. Just let me know when you start working on the other project.

@boulund
Copy link
Author

boulund commented Oct 1, 2018

@mherrmann What kind of information do you need? I could see myself using pandas for some lightweight data handling in a few applications for use here in the lab. I guess you could try whip up a simple application that just imports pandas and maybe plots a simple dataframe or something, that would be a great start!
For full usability to package small data analysis applications I would love to be able to easily import at least the basic science stack in python: numpy, scipy, pandas, matplotlib.

@mherrmann
Copy link
Owner

To be perfectly direct: The information I need is that my efforts will not be in vain. You say now "it would be nice for maybe a project in the future". I could now spend days adding support for the libraries you mention (if they don't work already), just to have you simply never get around to actually using the fruits of my labor. That's why I want to know when you start using fbs in earnest.

@boulund
Copy link
Author

boulund commented Oct 1, 2018

I absolutely understand your motivation, and I value your honesty 👍. I'm not going to make you start working on this before I really need it.

To be perfectly honest, in the particular situation that made me create this issue in the first place, I will most likely be able to easily replace pandas with e.g. xlread or openpyxl, since the only thing I really use pandas for in this project is convenience when reading tabular data from e.g. Excel files (they are abundant in the lab) or various CSV formats. This functionality is easy to replace in this project.

I'll make sure to create a new issue if/when I encounter issues with e.g. pandas in future projects! Thanks for your help so far.

@mherrmann
Copy link
Owner

Sounds good. Thanks!

@hossiluc
Copy link

hossiluc commented Jul 2, 2019

check.txt

I'm having some problems where fbs run opens the program well, but when using fbs freeze the executable file is not working.

I've tried some of the tips on the website but still cant figure it out, any help will be appreciated

i'm attaching the output of fbs freeze --debug

@mherrmann
Copy link
Owner

You're using python version 3.7. Please try with 3.6. If the problem persists, please open a new issue.

@woody0105
Copy link

@hossiluc
I am also having the same issue with python3.7. My freeze --debug log is exactly the same as your attached file.
I changed to python3.6 and the errors are gone but still having issues. when trying to execute app, i got alert saying:"failed to execute script main".
Anyone can help me fix the issue?

@mherrmann
Copy link
Owner

@huangsongfan Python 3.7 is not yet supported by fbs. Regarding your question for help, I suggest you ask on StackOverflow.

@woody0105
Copy link

@mherrmann
Thank you.

@minaee
Copy link

minaee commented Aug 4, 2020

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 <a =href"https://github.com/mherrmann/fbs-tutorial">fbs-tutorial step by step 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

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

what is the problem?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants