To compile use *--onefile *option.
pyinstaller --onefile <filename>.py

This should work and if you want to suppress the console window compile as 
follows:
pyinstaller --onefile -w <filename>.py

Hope this helps

On Wednesday, 14 August 2019 06:08:56 UTC-4, Ken Sullivan wrote:
>
> I'm running into a runtime error when trying to run the pyinstaller 
> generated executable on another machine, or the same machine but dist 
> directory has moved, or even just called from a lower subdirectory, e.g. 
> D:\> base-folder\project\dist\main\main.exe instead of 
> D:\base-folder\project\dist\main> main.exe (though D:\base-folder\project> 
> dist\main\main.exe works). The error trace is:
>
> Traceback (most recent call last):
>   File "site-packages\pbr\version.py", line 442, in 
> _get_version_from_pkg_resources
>   File "site-packages\pkg_resources\__init__.py", line 352, in get_provider
>   File "site-packages\pkg_resources\__init__.py", line 895, in require
>   File "site-packages\pkg_resources\__init__.py", line 781, in resolve
> pkg_resources.DistributionNotFound: The 'mock' distribution was not found 
> and is required by the application
>
> During handling of the above exception, another exception occurred:
>
> Traceback (most recent call last):
>   File "project\main.py", line 23, in <module>
>   File "<frozen importlib._bootstrap>", line 971, in _find_and_load
>   File "<frozen importlib._bootstrap>", line 955, in 
> _find_and_load_unlocked
>   File "<frozen importlib._bootstrap>", line 665, in _load_unlocked
>   File 
> "D:\WPy-3670-1.1b\python-3.6.7.amd64\lib\site-packages\PyInstaller\loader\pyimod03_importers.py",
>  
> line 627, in exec_module
>     exec(bytecode, module.__dict__)
>   File "NiftyNet\niftynet\__init__.py", line 46, in <module>
>   File "<frozen importlib._bootstrap>", line 971, in _find_and_load
>   File "<frozen importlib._bootstrap>", line 955, in 
> _find_and_load_unlocked
>   File "<frozen importlib._bootstrap>", line 665, in _load_unlocked
>   File 
> "D:\WPy-3670-1.1b\python-3.6.7.amd64\lib\site-packages\PyInstaller\loader\pyimod03_importers.py",
>  
> line 627, in exec_module
>     exec(bytecode, module.__dict__)
>   File "NiftyNet\niftynet\io\misc_io.py", line 14, in <module>
>   File "<frozen importlib._bootstrap>", line 971, in _find_and_load
>   File "<frozen importlib._bootstrap>", line 955, in 
> _find_and_load_unlocked
>   File "<frozen importlib._bootstrap>", line 665, in _load_unlocked
>   File 
> "D:\WPy-3670-1.1b\python-3.6.7.amd64\lib\site-packages\PyInstaller\loader\pyimod03_importers.py",
>  
> line 627, in exec_module
>     exec(bytecode, module.__dict__)
>   File "site-packages\nibabel\__init__.py", line 74, in <module>
>   File "<frozen importlib._bootstrap>", line 971, in _find_and_load
>   File "<frozen importlib._bootstrap>", line 955, in 
> _find_and_load_unlocked
>   File "<frozen importlib._bootstrap>", line 665, in _load_unlocked
>   File 
> "D:\WPy-3670-1.1b\python-3.6.7.amd64\lib\site-packages\PyInstaller\loader\pyimod03_importers.py",
>  
> line 627, in exec_module
>     exec(bytecode, module.__dict__)
>   File "site-packages\mock\__init__.py", line 2, in <module>
>   File "<frozen importlib._bootstrap>", line 971, in _find_and_load
>   File "<frozen importlib._bootstrap>", line 955, in 
> _find_and_load_unlocked
>   File "<frozen importlib._bootstrap>", line 665, in _load_unlocked
>   File 
> "D:\WPy-3670-1.1b\python-3.6.7.amd64\lib\site-packages\PyInstaller\loader\pyimod03_importers.py",
>  
> line 627, in exec_module
>     exec(bytecode, module.__dict__)
>   File "site-packages\mock\mock.py", line 71, in <module>
>   File "site-packages\pbr\version.py", line 462, in semantic_version
>   File "site-packages\pbr\version.py", line 449, in 
> _get_version_from_pkg_resources
>   File "site-packages\pbr\packaging.py", line 874, in get_version
> Exception: Versioning for this project requires either an sdist tarball, 
> or access to an upstream git repository. It's also possible that there is a 
> mismatch between the package name in setup.cfg and the argument given to 
> pbr.version.VersionInfo. Project name mock was given, but was not able to 
> be found.
>
>
> If I run with --debug=imports, the lines immediatly preceding the 
> exception are:
> import 'sphinx.setup_command' # <pyimod03_importers.FrozenImporter object 
> at 0x000002749B2CF048>
> import 'pbr.builddoc' # <pyimod03_importers.FrozenImporter object at 
> 0x000002749B2CF048>
> import 'pbr.packaging' # <pyimod03_importers.FrozenImporter object at 
> 0x000002749B2CF048>
>
> When it works (ran in original location), those lines are followed with:
> import 'mock.mock' # <pyimod03_importers.FrozenImporter object at 
> 0x0000023DF208F048>
> import 'mock' # <pyimod03_importers.FrozenImporter object at 
> 0x0000023DF208F048>
> <many more lines...>
>
> I wasn't able to get it to complete with --debug=all.
>
> pyinstaller is installed and ran within a WinPython command prompt. I had 
> to edit the .spec file to increase the recursionlimit to 5000, and to add 
> some hiddenimports. OS is Windows 10, 64-bit.
>
> Anything I could be doing wrong, or anything to try?
>
>
>

-- 
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 view this discussion on the web visit 
https://groups.google.com/d/msgid/pyinstaller/ceb135e8-4393-47b8-881f-a4825dbc7f6e%40googlegroups.com.

Reply via email to