ModuleNotFoundError and missing submodules on windows only, Linux works good
I have a strange issue, I know you will need more information and I will respond with it as quickly as possible as soon as anyone lets me know what would be the most helpful to provide.
I am trying to package a python app for cross-platform usage. It is basically a small web server (flask) for localhost.
So far, I have, with a few minor resolved problems, been able to package it for Linux (ubuntu) and OSX. However, windows is giving me some trouble. The build goes fine, but on running I get ModuleNotFoundError with the missing module being the main name of my app (the toplevel package). I use basically the same build command on both platforms, using the default 'single folder' mode.
One very obvious problem is that, in the output folder, on Linux I can see all of the folders available for modules that were used, for example I see the folders "cairo" and "psutil" and about 20 others in the output folder. In windows, however, there are ZERO folders in the output folder. There are a few library files like _bz2.py and _hashlib.py , but it seems most of the content is missing. Similarly, the output folder on Linux is ~100MB, while on windows it is ~10MB. Finally, the build time seems to be significantly shorter on windows. Clearly some big part of the program dependencies are seemingly not being found when running pyinstaller on windows, but because this is so obvious, I am doubtful that it is a bug, I feel like it may be some simple option I am missing somewhere.
(Interestingly, I can copy over the folders in the output folder from Linux to windows, which changes the error to ImportError, cannot import name (unknown location). Obviously windows will not be able to read some of the .so files in those folders, so I did not really expect it to work)
Things I have tried:
Using single file (-F) mode
using --hidden-import X for the module that it says is missing
Log files are attached
Please let me know if I should share a link to the exact pyinstaller commands and output files on each OS. Appreciate your time to read my post.