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.
--
You received this message because you are subscribed to the Google Groups
"PyInstaller" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at https://groups.google.com/group/pyinstaller.
For more options, visit https://groups.google.com/d/optout.
49 INFO: PyInstaller: 3.5.dev0+b54a15d72e
49 INFO: Python: 3.6.7
50 INFO: Platform: Linux-4.18.0-17-generic-x86_64-with-Ubuntu-18.04-bionic
50 INFO: wrote /home/paul/PycharmProjects/majiq/voila/guiapp/voila_freeze.spec
51 INFO: UPX is not available.
53 INFO: Extending PYTHONPATH with paths
['/home/paul/PycharmProjects', '/home/paul/PycharmProjects/majiq/voila/guiapp']
53 INFO: checking Analysis
53 INFO: Building Analysis because Analysis-00.toc is non existent
53 INFO: Initializing module dependency graph...
55 INFO: Initializing module graph hooks...
57 INFO: Analyzing base_library.zip ...
4023 INFO: running Analysis Analysis-00.toc
4055 INFO: Caching module hooks...
4060 INFO: Analyzing /home/paul/PycharmProjects/majiq/voila/run_voila.py
5552 INFO: Processing pre-find module path hook distutils
5630 INFO: Processing pre-safe import module hook six.moves
8032 INFO: Processing pre-safe import module hook setuptools.extern.six.moves
8514 INFO: Processing pre-find module path hook site
8514 INFO: site: retargeting to fake-dir
'/usr/local/lib/python3.6/dist-packages/PyInstaller/fake-modules'
24326 INFO: Processing pre-safe import module hook gi.repository.GObject
29364 INFO: Loading module hooks...
29364 INFO: Loading module hook "hook-lib2to3.py"...
29366 INFO: Loading module hook "hook-jinja2.py"...
29392 INFO: Loading module hook "hook-xml.etree.cElementTree.py"...
29393 INFO: Loading module hook "hook-sysconfig.py"...
29404 INFO: Loading module hook "hook-PIL.Image.py"...
29876 INFO: Loading module hook "hook-matplotlib.py"...
30178 INFO: Loading module hook "hook-scipy.py"...
30182 INFO: Loading module hook "hook-matplotlib.backends.py"...
30711 INFO: Matplotlib backend "GTK": ignored
Gtk* backend requires pygtk to be installed.
31855 INFO: Matplotlib backend "GTKAgg": ignored
Gtk* backend requires pygtk to be installed.
32120 INFO: Matplotlib backend "GTKCairo": ignored
No module named 'gtk'
32491 INFO: Matplotlib backend "MacOSX": ignored
cannot import name '_macosx'
32853 INFO: Matplotlib backend "Qt4Agg": ignored
Matplotlib qt-based backends require an external PyQt4, PyQt5,
PySide or PySide2 package to be installed, but it was not found.
33242 INFO: Matplotlib backend "Qt5Agg": ignored
Matplotlib qt-based backends require an external PyQt4, PyQt5,
PySide or PySide2 package to be installed, but it was not found.
33691 INFO: Matplotlib backend "TkAgg": added
34071 INFO: Matplotlib backend "WX": ignored
Matplotlib backend_wx and backend_wxagg require wxPython >=2.8.12
34442 INFO: Matplotlib backend "WXAgg": ignored
Matplotlib backend_wx and backend_wxagg require wxPython >=2.8.12
34905 INFO: Matplotlib backend "GTK3Cairo": added
/usr/lib/python3/dist-packages/matplotlib/backends/backend_gtk3agg.py:17:
UserWarning: The Gtk3Agg backend is known to not work on Python 3.x with
pycairo. Try installing cairocffi.
"The Gtk3Agg backend is known to not work on Python 3.x with pycairo. "
35364 INFO: Matplotlib backend "GTK3Agg": added
35618 INFO: Matplotlib backend "WebAgg": ignored
Traceback (most recent call last):
File "/usr/lib/python3/dist-packages/matplotlib/backends/backend_webagg.py",
line 29, in <module>
import tornado
ModuleNotFoundError: No module named 'tornado'
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "<string>", line 12, in <module>
File "/usr/lib/python3/dist-packages/matplotlib/backends/backend_webagg.py",
line 31, in <module>
raise RuntimeError("The WebAgg backend requires Tornado.")
RuntimeError: The WebAgg backend requires Tornado.
35887 INFO: Matplotlib backend "nbAgg": ignored
No module named 'tornado'
36262 INFO: Matplotlib backend "agg": added
36637 INFO: Matplotlib backend "cairo": added
36890 INFO: Matplotlib backend "gdk": ignored
No module named 'gobject'
37261 INFO: Matplotlib backend "pdf": added
37712 INFO: Matplotlib backend "pgf": added
38092 INFO: Matplotlib backend "ps": added
38481 INFO: Matplotlib backend "svg": added
38848 INFO: Matplotlib backend "template": added
39039 INFO: Processing pre-safe import module hook gi.repository.Gtk
39040 INFO: Processing pre-safe import module hook gi.repository.Gdk
39040 INFO: Processing pre-safe import module hook gi.repository.GLib
39158 INFO: Loading module hook "hook-sqlite3.py"...
39224 INFO: Loading module hook "hook-pygments.py"...
41091 INFO: Loading module hook "hook-pydoc.py"...
41092 INFO: Loading module hook "hook-numpy.core.py"...
41206 INFO: Loading module hook "hook-numpy.py"...
41207 INFO: Loading module hook "hook-distutils.py"...
41209 INFO: Loading module hook "hook-gi.repository.Gdk.py"...
41375 INFO: Processing pre-safe import module hook gi.repository.cairo
41376 INFO: Processing pre-safe import module hook gi.repository.Pango
41377 INFO: Processing pre-safe import module hook gi.repository.Gio
41377 INFO: Processing pre-safe import module hook gi.repository.GdkPixbuf
41378 INFO: Loading module hook "hook-PIL.SpiderImagePlugin.py"...
41384 INFO: Import to be excluded not found: 'FixTk'
41384 INFO: Excluding import 'tkinter'
41389 INFO: Loading module hook "hook-IPython.py"...
41396 INFO: Excluding import 'PyQt4'
41409 INFO: Excluding import 'PySide'
41420 INFO: Excluding import 'matplotlib'
41427 INFO: Removing import of matplotlib from module IPython.core.pylabtools
41428 INFO: Removing import of matplotlib._pylab_helpers from module
IPython.core.pylabtools
41428 INFO: Removing import of matplotlib.pyplot from module
IPython.core.pylabtools
41428 INFO: Removing import of matplotlib.figure from module
IPython.core.pylabtools
41431 INFO: Excluding import 'PyQt5'
41443 INFO: Import to be excluded not found: 'gtk'
41444 INFO: Loading module hook "hook-pkg_resources.py"...
41731 INFO: Processing pre-safe import module hook win32com
42062 INFO: Loading module hook "hook-gi.repository.GObject.py"...
42231 WARNING: Hidden import "gi._gobject" not found!
42231 INFO: Loading module hook "hook-scipy.special._ufuncs.py"...
42232 INFO: Loading module hook "hook-_tkinter.py"...
42334 INFO: checking Tree
42334 INFO: Building Tree because Tree-00.toc is non existent
42334 INFO: Building Tree Tree-00.toc
42344 INFO: checking Tree
42344 INFO: Building Tree because Tree-01.toc is non existent
42344 INFO: Building Tree Tree-01.toc
42349 INFO: Loading module hook "hook-scipy.sparse.csgraph.py"...
42354 INFO: Loading module hook "hook-gi.repository.Pango.py"...
42499 INFO: Loading module hook "hook-encodings.py"...
42570 INFO: Loading module hook "hook-setuptools.py"...
43220 INFO: Loading module hook "hook-pytest.py"...
44046 INFO: Loading module hook "hook-PIL.py"...
44050 INFO: Excluding import 'PyQt4'
44054 INFO: Removing import of PyQt4 from module PIL.ImageQt
44055 INFO: Excluding import 'PySide'
44059 INFO: Removing import of PySide from module PIL.ImageQt
44061 INFO: Import to be excluded not found: 'FixTk'
44061 INFO: Excluding import 'PyQt5'
44067 INFO: Removing import of PyQt5 from module PIL.ImageQt
44070 INFO: Excluding import 'tkinter'
44077 INFO: Loading module hook "hook-jedi.py"...
44079 INFO: Loading module hook "hook-gi.py"...
44080 INFO: Loading module hook "hook-gi.repository.Gtk.py"...
45565 INFO: Processing pre-safe import module hook gi.repository.xlib
45566 INFO: Processing pre-safe import module hook gi.repository.Atk
45567 INFO: Loading module hook "hook-xml.dom.domreg.py"...
45568 INFO: Loading module hook "hook-pytz.py"...
45569 INFO: Loading module hook "hook-scipy.special._ellip_harm_2.py"...
47409 INFO: Loading module hook "hook-gi.repository.cairo.py"...
47547 INFO: Loading module hook "hook-xml.py"...
47549 INFO: Loading module hook "hook-h5py.py"...
47550 INFO: Loading module hook "hook-scipy.linalg.py"...
47555 INFO: Loading module hook "hook-gi.repository.GdkPixbuf.py"...
47556 WARNING: "hook-gi.repository.GdkPixbuf" ignored, since GDK not found
(i.e., "gdk-pixbuf-query-loaders" not in $PATH).
47556 INFO: Loading module hook "hook-gi.repository.xlib.py"...
47682 INFO: Loading module hook "hook-gi.repository.Gio.py"...
47899 INFO: Loading module hook "hook-gi.repository.GLib.py"...
48152 INFO: Loading module hook "hook-gi.repository.Atk.py"...
48426 INFO: checking Tree
48426 INFO: Building Tree because Tree-02.toc is non existent
48426 INFO: Building Tree Tree-02.toc
48476 INFO: Looking for ctypes DLLs
48879 WARNING: library user32 required via ctypes not found
49007 INFO: Analyzing run-time hooks ...
49035 INFO: Including run-time hook 'pyi_rth_pkgres.py'
49037 INFO: Including run-time hook 'pyi_rth_multiprocessing.py'
49042 INFO: Including run-time hook 'pyi_rth__tkinter.py'
49044 INFO: Including run-time hook 'pyi_rth_glib.py'
49045 INFO: Including run-time hook 'pyi_rth_gdkpixbuf.py'
49047 INFO: Including run-time hook 'pyi_rth_gio.py'
49048 INFO: Including run-time hook 'pyi_rth_gtk.py'
49050 INFO: Including run-time hook 'pyi_rth_gi.py'
49051 INFO: Including run-time hook 'pyi_rth_mplconfig.py'
49053 INFO: Including run-time hook 'pyi_rth_mpldata.py'
49055 INFO: Including run-time hook 'pyi_rth_traitlets.py'
49107 INFO: Looking for dynamic libraries
51849 INFO: Looking for eggs
51850 INFO: Python library not in binary dependencies. Doing additional
searching...
51878 INFO: Using Python library /usr/lib/x86_64-linux-gnu/libpython3.6m.so.1.0
51918 INFO: Warnings written to
/tmp/voila_build/voila_freeze/warn-voila_freeze.txt
52189 INFO: Graph cross-reference written to
/tmp/voila_build/voila_freeze/xref-voila_freeze.html
52970 INFO: checking PYZ
52971 INFO: Building PYZ because PYZ-00.toc is non existent
52971 INFO: Building PYZ (ZlibArchive) /tmp/voila_build/voila_freeze/PYZ-00.pyz
56161 INFO: Building PYZ (ZlibArchive) /tmp/voila_build/voila_freeze/PYZ-00.pyz
completed successfully.
56234 INFO: checking PKG
56234 INFO: Building PKG because PKG-00.toc is non existent
56234 INFO: Building PKG (CArchive) PKG-00.pkg
56283 INFO: Building PKG (CArchive) PKG-00.pkg completed successfully.
56284 INFO: Bootloader
/usr/local/lib/python3.6/dist-packages/PyInstaller/bootloader/Linux-64bit/run
56284 INFO: checking EXE
56284 INFO: Building EXE because EXE-00.toc is non existent
56284 INFO: Building EXE from EXE-00.toc
56285 INFO: Appending archive to ELF section in EXE
/tmp/voila_build/voila_freeze/voila_freeze
56305 INFO: Building EXE from EXE-00.toc completed successfully.
56355 INFO: checking COLLECT
56355 INFO: Building COLLECT because COLLECT-00.toc is non existent
56355 INFO: Building COLLECT COLLECT-00.toc
61107 INFO: Building COLLECT COLLECT-00.toc completed successfully.
75 INFO: PyInstaller: 3.5.dev0+b54a15d72e
75 INFO: Python: 3.7.3
75 INFO: Platform: Windows-10-10.0.17763-SP0
75 INFO: wrote E:\voila\voila_freeze.spec
75 INFO: UPX is not available.
90 INFO: Extending PYTHONPATH with paths
['E:\\voila']
90 INFO: checking Analysis
90 INFO: Building Analysis because Analysis-00.toc is non existent
90 INFO: Initializing module dependency graph...
90 INFO: Initializing module graph hooks...
106 INFO: Analyzing base_library.zip ...
4369 INFO: running Analysis Analysis-00.toc
4369 INFO: Adding Microsoft.Windows.Common-Controls to dependent assemblies of
final executable
required by c:\users\user\appdata\local\programs\python\python37\python.exe
5276 INFO: Caching module hooks...
5276 INFO: Analyzing E:\voila\run_voila.py
5370 INFO: Loading module hooks...
5370 INFO: Loading module hook "hook-encodings.py"...
5495 INFO: Loading module hook "hook-pydoc.py"...
5495 INFO: Loading module hook "hook-xml.py"...
5841 INFO: Looking for ctypes DLLs
5841 INFO: Analyzing run-time hooks ...
5854 INFO: Looking for dynamic libraries
7949 INFO: Looking for eggs
7949 INFO: Using Python library
c:\users\user\appdata\local\programs\python\python37\python37.dll
7949 INFO: Found binding redirects:
[]
7949 INFO: Warnings written to C:\tmp\work\voila_freeze\warn-voila_freeze.txt
8029 INFO: Graph cross-reference written to
C:\tmp\work\voila_freeze\xref-voila_freeze.html
8058 INFO: checking PYZ
8058 INFO: Building PYZ because PYZ-00.toc is non existent
8058 INFO: Building PYZ (ZlibArchive) C:\tmp\work\voila_freeze\PYZ-00.pyz
8713 INFO: Building PYZ (ZlibArchive) C:\tmp\work\voila_freeze\PYZ-00.pyz
completed successfully.
8746 INFO: checking PKG
8746 INFO: Building PKG because PKG-00.toc is non existent
8746 INFO: Building PKG (CArchive) PKG-00.pkg
8792 INFO: Building PKG (CArchive) PKG-00.pkg completed successfully.
8792 INFO: Bootloader
c:\users\user\appdata\local\programs\python\python37\lib\site-packages\PyInstaller\bootloader\Windows-64bit\run.exe
8792 INFO: checking EXE
8792 INFO: Building EXE because EXE-00.toc is non existent
8792 INFO: Building EXE from EXE-00.toc
8792 INFO: Appending archive to EXE C:\tmp\work\voila_freeze\voila_freeze.exe
8885 INFO: Building EXE from EXE-00.toc completed successfully.
8885 INFO: checking COLLECT
8885 INFO: Building COLLECT because COLLECT-00.toc is non existent
8885 INFO: Building COLLECT COLLECT-00.toc
9198 INFO: Building COLLECT COLLECT-00.toc completed successfully.