fbs freeze fails due to modules not found in PYZ
Hello I want to thank you for development of fbs. I am hoping you can point me in the right direction for an issue I am having using it to package my second project. I've tried to compile the exe using python3.5 and python3.6 and the main script will fail each time even though fbs runs with no issue. The only errors I can find state module not found in PYZ this is happening for a wide range of modules. Using the same environment I can compile an empty startproject with no problem. I realize that this is likely a problem with my code organization but I don't understand what not found in PYZ is pointing me towards in order to find a fix. Any help would be greatly appreciated.
I think I've also already seen these PYZ errors you mention, and don't think they will help much.
You say "the main script fails". What exactly do you mean by that? How does it fail? Do you simply not see anything? Do you get a dialog? ...? I cannot help you if you don't provide such information.
Thank you for the quick response. The only information I get from the debug dialog when trying to run the application is the mentioned list of PYZ errors. No errors in the build dialog. I think it maybe related to some external resources that I am importing. I'm going to work with that and see if anything comes of it.
Then I was too harsh, sorry. I would hope that there's is at least some interesting information in between all the PYZ errors. Are you sure there isn't some message or stack trace in there somewhere? What if you add print(...) statements to early parts of your code?
I can't find anything consistent in the stack trace except for lots of missing files. After lots of tries using different environments I was able to build my project on a WIN7 machine with Anaconda Environments. However for whatever reason WIN10 seems to have lots of missing dll files and base python modules. Even after a fresh install of vanilla python on a clean WIN10 image many dll files are missing even if i manually copy the dll files to the locations they are ignored. even using a simple os.listdir in python refuses to acknowledge the files exist when they are clearly visible in a file viewer. I would say this is something I have done but the same problem arose on a machine that was working just fine for builds and a brand new image. I have a suspcision that it is related to the recent windows10 updates that seem to be wrecking havoc but I'm not really a windows user so I can't be sure.
Well It seems that even after building and running fine on windows 7 I am having the same failure running the built application on windows 10. Could you confirm current builds from windows 10 are functional? Any information would be helpful.
fman uses fbs, is built on Windows 7 and runs fine on Windows 10.
This has been built successfully in the past couple of weeks? I am wondering if some of the recent crazy bugs released by for windows 10 could have messed something up. I have used fbs as recently as a couple of months ago and had no issues with either Windows 7 or Windows 10.
Yes. fman's last release was 8 days ago.
Keeping this thread going so that maybe someone else can benefit from my ongoing frustration. I have narrowed my problem down to something going on with importing pandas under the WIN10 configuration that is redirecting pointers that then cause fbs to not find the pyinstaller libraries. Not sure if this is a known issue
from fbs_runtime.application_context.PyQt5 import ApplicationContext
import pandas as pd# ||
if name == 'main': appctxt = ApplicationContext() # 1. Instantiate ApplicationContext window = QMainWindow() window.resize(250, 150) window.show() exit_code = appctxt.app.exec_() # 2. Invoke appctxt.app.exec_() sys.exit(exit_code)
simply adding the pandas import statement to the basic startproject file will cause fbs to error during build. with the following error
30903 INFO: Found binding redirects:
[]
Traceback (most recent call last):
File "c:\users\sb\appdata\local\programs\python\python36\lib\runpy.py", line 193, in run_module_as_main
"main", mod_spec)
File "c:\users\sb\appdata\local\programs\python\python36\lib\runpy.py", line 85, in run_code
exec(code, run_globals)
File "C:\Users\sb\AppData\Local\Programs\Python\Python36\Scripts\pyinstaller.exe_main.py", line 9, in
found this issue documented previously with a pandas import problem . tried the fix documented there but still receiving the same error shown above.
After a couple of builds with different projects it seems that this issue is related to importing modules from files in the same directory as main. Is there a requirement within fbs to only build the main.py file? or are additional python files supposed to be setup as reference files as well configuration files? I intend to do some testing when I get a chance but I haven't seen these specifics within the documentation related to resource files.
Is there a requirement within fbs to only build the main.py file?
No. fbs should handle imports you have in your main file (and other files).
are additional python files supposed to be setup as reference files as well configuration files?
Also no. fbs (actually, PyInstaller) should just handle them.
In short, fbs should be able to handle all imports that take place when you do python path/to/your/main.py.
I'm still struggling with this issue, at one point I was able to complete a build but the problem seems to still be persistent. I have continued to narrow things down and it seems to be some import issue with the QT5 DLLs. Specifically I'm stuck getting the Qt5Core.dll but I imagine it will fail on the others if I could get past this. It seems that the target exe is looking for dll in the path C:\Users\sb\AppData\Local\Programs\Microsoft VS Code\bin\Qt5Core.dll instead of looking in the target path. The dlls exist in the target path in the same directory as the target exe. Is there a way to force the path to look in the target directory?
Here is the full trace
C:\Users\sb\AppData\Local\Programs\Microsoft VS Code\bin\Qt5Core.dll
Traceback (most recent call last):
File "main.py", line 1, in