Bundling Data files with PyInstaller 2.1 and MEIPASS error –onefile

I think I see the problem. You’re not feeding data_files into your Analysis object. Here’s how I add my data files in my .spec file: a = Analysis(….) a.datas += [(‘7z.dll’, ‘7z.dll’, ‘DATA’)] a.datas += [(‘7z.exe’, ‘7z.exe’, ‘DATA’)] a.datas += [(‘collection.xml’, ‘collection.xml’, ‘DATA’)] a.datas += [(‘License.html’, ‘License.html’, ‘DATA’)] pyz = PYZ(a.pure) exe = EXE(pyz, a.scripts … Read more

Pyinstaller ; ModuleNotFoundError: No module named ‘sklearn.utils._cython_blas’

PyInstaller uses a hook mechanism for each Python module, but sometimes it misses some internal packages so you need to provide them manually. You can use –hidden-import to add sklearn‘s missing modules. pyinstaller -F –hidden-import=”sklearn.utils._cython_blas” –hidden-import=”sklearn.neighbors.typedefs” –hidden-import=”sklearn.neighbors.quad_tree” –hidden-import=”sklearn.tree._utils” Datamanager.py

Importing external module in single-file exe created with PyInstaller

The following steps allow a Python module (named external_module here) outside of an executable created by PyInstaller to be imported and for that module to import modules that were bundled into the executable. Add excludes=[‘external_module’] to the Analysis object used in the PyInstaller spec. This prevents external_module.py being bundled into the executable. Add sys.path.append(os.path.dirname(sys.executable)) where … Read more

How to use pyinstaller?

I would suggest to first read the Using Pyinstaller section in the documentation of the module itself. You can also use some tutorials (e.g. Matt Borgerson’s one). In order to recap you should: write your script and make sure that it works run from the command line: ~\ pyinstaller your_file_name.py this command will generate a … Read more