I can't get pyinstaller to create an .exe out of my python code.
I think it must have something to do with
A: I'm using Kivy for the prodject, and
B: I'm trying to use anaconda as my python interpreter.
For awhile it would make the .exe but when I launched it it would give a bunch of errors about no window being available. I tried installing/uninstalling packages, re-setting up my python interpreter on my editor (PyCharm), and finally I re-installed anaconda. Now when I try to run it, it wont even create the .exe, it just gives me an error.
This is the command I'm running in the terminal,
(venv) C:\Users\Luc\PycharmProjects\GoogleCommandCenter>pyinstaller --onefile main.spec
This is the error message I'm getting,
895 INFO: PyInstaller: 3.3.1
896 INFO: Python: 3.6.4
896 INFO: Platform: Windows-10-10.0.16299-SP0
898 INFO: UPX is not available.
900 INFO: Extending PYTHONPATH with paths
['C:\\Users\\Luc\\PycharmProjects\\GoogleCommandCenter',
'C:\\Users\\Luc\\PycharmProjects\\GoogleCommandCenter',
'C:\\Users\\Luc\\PycharmProjects\\GoogleCommandCenter\\venv',
'C:\\Users\\Luc\\PycharmProjects\\GoogleCommandCenter\\venv\\Scripts\\python.exe']
901 INFO: checking Analysis
901 INFO: Building Analysis because out00-Analysis.toc is non existent
901 INFO: Initializing module dependency graph...
907 INFO: Initializing module graph hooks...
910 INFO: Analyzing base_library.zip ...
4627 INFO: running Analysis out00-Analysis.toc
4629 INFO: Adding Microsoft.Windows.Common-Controls to dependent assemblies of final executable
required by c:\users\luc\pycharmprojects\googlecommandcenter\venv\scripts\python.exe
5229 INFO: Caching module hooks...
5233 INFO: Analyzing main.py
8793 INFO: Processing pre-find module path hook distutils
8795 INFO: distutils: retargeting to non-venv dir 'C:\\Users\\Luc\\Anaconda3\\Lib\\distutils'
10009 INFO: Processing pre-find module path hook site
10010 INFO: site: retargeting to fake-dir 'c:\\users\\luc\\pycharmprojects\\googlecommandcenter\\venv\\lib\\site-packages\\PyInstaller\\fake-modules'
18352 INFO: Processing pre-safe import module hook six.moves
21522 INFO: Loading module hooks...
21523 INFO: Loading module hook "hook-distutils.py"...
21524 INFO: Loading module hook "hook-encodings.py"...
21614 INFO: Loading module hook "hook-kivy.py"...
Purge log fired. Analysing...
Purge 23 log files
Purge finished!
[INFO ] [Logger ] Record log in C:\Users\Luc\.kivy\logs\kivy_18-04-12_0.txt
21657 INFO: [Logger ] Record log in C:\Users\Luc\.kivy\logs\kivy_18-04-12_0.txt
[INFO ] [Kivy ] v1.10.0
21627 INFO: [Kivy ] v1.10.0
[INFO ] [Python ] v3.6.4 |Anaconda, Inc.| (default, Jan 16 2018, 10:22:32) [MSC v.1900 64 bit (AMD64)]
21657 INFO: [Python ] v3.6.4 |Anaconda, Inc.| (default, Jan 16 2018, 10:22:32) [MSC v.1900 64 bit (AMD64)]
[INFO ] [Factory ] 194 symbols loaded
21660 INFO: [Factory ] 194 symbols loaded
[INFO ] [Logger ] Record log in C:\Users\Luc\.kivy\logs\kivy_18-04-12_21.txt
[INFO ] [Kivy ] v1.10.0
[INFO ] [Python ] v3.6.4 |Anaconda, Inc.| (default, Jan 16 2018, 10:22:32) [MSC v.1900 64 bit (AMD64)]
[INFO ] [Image ] Providers: img_tex, img_dds, img_sdl2, img_gif (img_pil, img_ffpyplayer ignored)
[INFO ] [Logger ] Record log in C:\Users\Luc\.kivy\logs\kivy_18-04-12_22.txt
[INFO ] [Kivy ] v1.10.0
[INFO ] [Python ] v3.6.4 |Anaconda, Inc.| (default, Jan 16 2018, 10:22:32) [MSC v.1900 64 bit (AMD64)]
[INFO ] [AudioGstplayer] Using Gstreamer 1.10.2.0
[INFO ] [Audio ] Providers: audio_gstplayer, audio_sdl2 (audio_ffpyplayer ignored)
[INFO ] [Image ] Providers: img_tex, img_dds, img_sdl2, img_gif (img_pil, img_ffpyplayer ignored)
[CRITICAL] [Camera ] Unable to find any valuable Camera provider.
opencv - ModuleNotFoundError: No module named 'cv2'
File "c:\users\luc\pycharmprojects\googlecommandcenter\venv\lib\site-packages\kivy\core\__init__.py", line 59, in core_select_lib
fromlist=[modulename], level=0)
File "c:\users\luc\pycharmprojects\googlecommandcenter\venv\lib\site-packages\kivy\core\camera\camera_opencv.py", line 45, in <module>
import cv2
[INFO ] [Clipboard ] Provider: winctypes
[INFO ] [Factory ] 194 symbols loaded
[INFO ] [OSC ] using <thread> for socket
[INFO ] [Window ] Provider: sdl2
[INFO ] [GL ] Using the "OpenGL" graphics system
[INFO ] [GL ] GLEW initialization succeeded
[INFO ] [GL ] Backend used <glew>
[INFO ] [GL ] OpenGL version <b'4.6.0 NVIDIA 388.13'>
[INFO ] [GL ] OpenGL vendor <b'NVIDIA Corporation'>
[INFO ] [GL ] OpenGL renderer <b'GeForce GTX 750 Ti/PCIe/SSE2'>
[INFO ] [GL ] OpenGL parsed version: 4, 6
[INFO ] [GL ] Shading version <b'4.60 NVIDIA'>
[INFO ] [GL ] Texture max size <16384>
[INFO ] [GL ] Texture max units <32>
[INFO ] [Window ] auto add sdl2 input provider
[INFO ] [Window ] virtual keyboard not allowed, single mode, not docked
[CRITICAL] [Spelling ] Unable to find any valuable Spelling provider.
enchant - ModuleNotFoundError: No module named 'enchant'
File "c:\users\luc\pycharmprojects\googlecommandcenter\venv\lib\site-packages\kivy\core\__init__.py", line 59, in core_select_lib
fromlist=[modulename], level=0)
File "c:\users\luc\pycharmprojects\googlecommandcenter\venv\lib\site-packages\kivy\core\spelling\spelling_enchant.py", line 6, in <module>
import enchant
[INFO ] [Text ] Provider: sdl2
[INFO ] [VideoGstplayer] Using Gstreamer 1.10.2.0
[INFO ] [Video ] Provider: gstplayer
28584 INFO: Import to be excluded not found: '_tkinter'
28584 INFO: Import to be excluded not found: 'tkinter'
28584 INFO: Excluding import 'twisted'
28588 INFO: Removing import of twisted from module kivy.support
28589 INFO: Loading module hook "hook-lib2to3.py"...
28592 INFO: Loading module hook "hook-numpy.core.py"...
Traceback (most recent call last):
File "C:\Users\Luc\Anaconda3\lib\site-packages\numpy\core\__init__.py", line 16, in <module>
from . import multiarray
ImportError: DLL load failed: The specified module could not be found.
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "<string>", line 2, in <module>
File "C:\Users\Luc\Anaconda3\lib\site-packages\numpy\__init__.py", line 142, in <module>
from . import add_newdocs
File "C:\Users\Luc\Anaconda3\lib\site-packages\numpy\add_newdocs.py", line 13, in <module>
from numpy.lib import add_newdoc
File "C:\Users\Luc\Anaconda3\lib\site-packages\numpy\lib\__init__.py", line 8, in <module>
from .type_check import *
File "C:\Users\Luc\Anaconda3\lib\site-packages\numpy\lib\type_check.py", line 11, in <module>
import numpy.core.numeric as _nx
File "C:\Users\Luc\Anaconda3\lib\site-packages\numpy\core\__init__.py", line 26, in <module>
raise ImportError(msg)
ImportError:
Importing the multiarray numpy extension module failed. Most
likely you are trying to import a failed build of numpy.
If you're working with a numpy git repo, try `git clean -xdf` (removes all
files not under version control). Otherwise reinstall numpy.
Original error was: DLL load failed: The specified module could not be found.
Traceback (most recent call last):
28814 WARNING: stderr: Traceback (most recent call last):
File "C:\Users\Luc\Anaconda3\lib\site-packages\numpy\core\__init__.py", line 16, in <module>
28815 WARNING: stderr: File "C:\Users\Luc\Anaconda3\lib\site-packages\numpy\core\__init__.py", line 16, in <module>
from . import multiarray
28816 WARNING: stderr: from . import multiarray
ImportError: DLL load failed: The specified module could not be found.
28817 WARNING: stderr: ImportError: DLL load failed: The specified module could not be found.
28824 WARNING: stderr:
During handling of the above exception, another exception occurred:
28824 WARNING: stderr: During handling of the above exception, another exception occurred:
28825 WARNING: stderr:
Traceback (most recent call last):
28826 WARNING: stderr: Traceback (most recent call last):
File "C:\Users\Luc\Anaconda3\Lib\pkgutil.py", line 490, in find_loader
28827 WARNING: stderr: File "C:\Users\Luc\Anaconda3\Lib\pkgutil.py", line 490, in find_loader
spec = importlib.util.find_spec(fullname)
28827 WARNING: stderr: spec = importlib.util.find_spec(fullname)
File "c:\users\luc\pycharmprojects\googlecommandcenter\venv\lib\importlib\util.py", line 88, in find_spec
28828 WARNING: stderr: File "c:\users\luc\pycharmprojects\googlecommandcenter\venv\lib\importlib\util.py", line 88, in find_spec
parent = __import__(parent_name, fromlist=['__path__'])
28829 WARNING: stderr: parent = __import__(parent_name, fromlist=['__path__'])
File "C:\Users\Luc\Anaconda3\lib\site-packages\numpy\__init__.py", line 142, in <module>
28829 WARNING: stderr: File "C:\Users\Luc\Anaconda3\lib\site-packages\numpy\__init__.py", line 142, in <module>
from . import add_newdocs
28830 WARNING: stderr: from . import add_newdocs
File "C:\Users\Luc\Anaconda3\lib\site-packages\numpy\add_newdocs.py", line 13, in <module>
28830 WARNING: stderr: File "C:\Users\Luc\Anaconda3\lib\site-packages\numpy\add_newdocs.py", line 13, in <module>
from numpy.lib import add_newdoc
28831 WARNING: stderr: from numpy.lib import add_newdoc
File "C:\Users\Luc\Anaconda3\lib\site-packages\numpy\lib\__init__.py", line 8, in <module>
28831 WARNING: stderr: File "C:\Users\Luc\Anaconda3\lib\site-packages\numpy\lib\__init__.py", line 8, in <module>
from .type_check import *
28833 WARNING: stderr: from .type_check import *
File "C:\Users\Luc\Anaconda3\lib\site-packages\numpy\lib\type_check.py", line 11, in <module>
28833 WARNING: stderr: File "C:\Users\Luc\Anaconda3\lib\site-packages\numpy\lib\type_check.py", line 11, in <module>
import numpy.core.numeric as _nx
28834 WARNING: stderr: import numpy.core.numeric as _nx
File "C:\Users\Luc\Anaconda3\lib\site-packages\numpy\core\__init__.py", line 26, in <module>
28834 WARNING: stderr: File "C:\Users\Luc\Anaconda3\lib\site-packages\numpy\core\__init__.py", line 26, in <module>
raise ImportError(msg)
28835 WARNING: stderr: raise ImportError(msg)
ImportError:
28835 WARNING: stderr: ImportError:
Importing the multiarray numpy extension module failed. Most
28836 WARNING: stderr: Importing the multiarray numpy extension module failed. Most
likely you are trying to import a failed build of numpy.
28836 WARNING: stderr: likely you are trying to import a failed build of numpy.
If you're working with a numpy git repo, try `git clean -xdf` (removes all
28836 WARNING: stderr: If you're working with a numpy git repo, try `git clean -xdf` (removes all
files not under version control). Otherwise reinstall numpy.
28837 WARNING: stderr: files not under version control). Otherwise reinstall numpy.
28837 WARNING: stderr:
Original error was: DLL load failed: The specified module could not be found.
28837 WARNING: stderr: Original error was: DLL load failed: The specified module could not be found.
28838 WARNING: stderr:
28838 WARNING: stderr:
The above exception was the direct cause of the following exception:
28839 WARNING: stderr: The above exception was the direct cause of the following exception:
28839 WARNING: stderr:
Traceback (most recent call last):
28839 WARNING: stderr: Traceback (most recent call last):
File "c:\users\luc\pycharmprojects\googlecommandcenter\venv\lib\site-packages\PyInstaller\utils\hooks\__init__.py", line 325, in get_module_file_attribute
28840 WARNING: stderr: File "c:\users\luc\pycharmprojects\googlecommandcenter\venv\lib\site-packages\PyInstaller\utils\hooks\__init__.py", line 325, in get_module_file_attribute
loader = pkgutil.find_loader(package)
28841 WARNING: stderr: loader = pkgutil.find_loader(package)
File "C:\Users\Luc\Anaconda3\Lib\pkgutil.py", line 496, in find_loader
28841 WARNING: stderr: File "C:\Users\Luc\Anaconda3\Lib\pkgutil.py", line 496, in find_loader
raise ImportError(msg.format(fullname, type(ex), ex)) from ex
28842 WARNING: stderr: raise ImportError(msg.format(fullname, type(ex), ex)) from ex
ImportError: Error while finding loader for 'numpy.core' (<class 'ImportError'>:
28843 WARNING: stderr: ImportError: Error while finding loader for 'numpy.core' (<class 'ImportError'>:
Importing the multiarray numpy extension module failed. Most
28843 WARNING: stderr: Importing the multiarray numpy extension module failed. Most
likely you are trying to import a failed build of numpy.
28843 WARNING: stderr: likely you are trying to import a failed build of numpy.
If you're working with a numpy git repo, try `git clean -xdf` (removes all
28843 WARNING: stderr: If you're working with a numpy git repo, try `git clean -xdf` (removes all
files not under version control). Otherwise reinstall numpy.
28844 WARNING: stderr: files not under version control). Otherwise reinstall numpy.
28844 WARNING: stderr:
Original error was: DLL load failed: The specified module could not be found.
28844 WARNING: stderr: Original error was: DLL load failed: The specified module could not be found.
)
28844 WARNING: stderr: )
28845 WARNING: stderr:
During handling of the above exception, another exception occurred:
28845 WARNING: stderr: During handling of the above exception, another exception occurred:
28846 WARNING: stderr:
Traceback (most recent call last):
28846 WARNING: stderr: Traceback (most recent call last):
File "C:\Users\Luc\Anaconda3\Lib\runpy.py", line 193, in _run_module_as_main
28846 WARNING: stderr: File "C:\Users\Luc\Anaconda3\Lib\runpy.py", line 193, in _run_module_as_main
"__main__", mod_spec)
28847 WARNING: stderr: "__main__", mod_spec)
File "C:\Users\Luc\Anaconda3\Lib\runpy.py", line 85, in _run_code
28847 WARNING: stderr: File "C:\Users\Luc\Anaconda3\Lib\runpy.py", line 85, in _run_code
exec(code, run_globals)
28847 WARNING: stderr: exec(code, run_globals)
File "C:\Users\Luc\PycharmProjects\GoogleCommandCenter\venv\Scripts\pyinstaller.exe\__main__.py", line 9, in <module>
28848 WARNING: stderr: File "C:\Users\Luc\PycharmProjects\GoogleCommandCenter\venv\Scripts\pyinstaller.exe\__main__.py", line 9, in <module>
File "c:\users\luc\pycharmprojects\googlecommandcenter\venv\lib\site-packages\PyInstaller\__main__.py", line 94, in run
28849 WARNING: stderr: File "c:\users\luc\pycharmprojects\googlecommandcenter\venv\lib\site-packages\PyInstaller\__main__.py", line 94, in run
run_build(pyi_config, spec_file, **vars(args))
28857 WARNING: stderr: run_build(pyi_config, spec_file, **vars(args))
File "c:\users\luc\pycharmprojects\googlecommandcenter\venv\lib\site-packages\PyInstaller\__main__.py", line 46, in run_build
28857 WARNING: stderr: File "c:\users\luc\pycharmprojects\googlecommandcenter\venv\lib\site-packages\PyInstaller\__main__.py", line 46, in run_build
PyInstaller.building.build_main.main(pyi_config, spec_file, **kwargs)
28858 WARNING: stderr: PyInstaller.building.build_main.main(pyi_config, spec_file, **kwargs)
File "c:\users\luc\pycharmprojects\googlecommandcenter\venv\lib\site-packages\PyInstaller\building\build_main.py", line 791, in main
28858 WARNING: stderr: File "c:\users\luc\pycharmprojects\googlecommandcenter\venv\lib\site-packages\PyInstaller\building\build_main.py", line 791, in main
build(specfile, kw.get('distpath'), kw.get('workpath'), kw.get('clean_build'))
28860 WARNING: stderr: build(specfile, kw.get('distpath'), kw.get('workpath'), kw.get('clean_build'))
File "c:\users\luc\pycharmprojects\googlecommandcenter\venv\lib\site-packages\PyInstaller\building\build_main.py", line 737, in build
28860 WARNING: stderr: File "c:\users\luc\pycharmprojects\googlecommandcenter\venv\lib\site-packages\PyInstaller\building\build_main.py", line 737, in build
exec(text, spec_namespace)
28863 WARNING: stderr: exec(text, spec_namespace)
File "<string>", line 20, in <module>
28864 WARNING: stderr: File "<string>", line 20, in <module>
File "c:\users\luc\pycharmprojects\googlecommandcenter\venv\lib\site-packages\PyInstaller\building\build_main.py", line 213, in __init__
28866 WARNING: stderr: File "c:\users\luc\pycharmprojects\googlecommandcenter\venv\lib\site-packages\PyInstaller\building\build_main.py", line 213, in __init__
self.__postinit__()
28868 WARNING: stderr: self.__postinit__()
File "c:\users\luc\pycharmprojects\googlecommandcenter\venv\lib\site-packages\PyInstaller\building\datastruct.py", line 161, in __postinit__
28869 WARNING: stderr: File "c:\users\luc\pycharmprojects\googlecommandcenter\venv\lib\site-packages\PyInstaller\building\datastruct.py", line 161, in __postinit__
self.assemble()
28870 WARNING: stderr: self.assemble()
File "c:\users\luc\pycharmprojects\googlecommandcenter\venv\lib\site-packages\PyInstaller\building\build_main.py", line 472, in assemble
28871 WARNING: stderr: File "c:\users\luc\pycharmprojects\googlecommandcenter\venv\lib\site-packages\PyInstaller\building\build_main.py", line 472, in assemble
module_hook.post_graph()
28872 WARNING: stderr: module_hook.post_graph()
File "c:\users\luc\pycharmprojects\googlecommandcenter\venv\lib\site-packages\PyInstaller\building\imphook.py", line 410, in post_graph
28872 WARNING: stderr: File "c:\users\luc\pycharmprojects\googlecommandcenter\venv\lib\site-packages\PyInstaller\building\imphook.py", line 410, in post_graph
self._load_hook_module()
28874 WARNING: stderr: self._load_hook_module()
File "c:\users\luc\pycharmprojects\googlecommandcenter\venv\lib\site-packages\PyInstaller\building\imphook.py", line 377, in _load_hook_module
28874 WARNING: stderr: File "c:\users\luc\pycharmprojects\googlecommandcenter\venv\lib\site-packages\PyInstaller\building\imphook.py", line 377, in _load_hook_module
self.hook_module_name, self.hook_filename)
28875 WARNING: stderr: self.hook_module_name, self.hook_filename)
File "c:\users\luc\pycharmprojects\googlecommandcenter\venv\lib\site-packages\PyInstaller\compat.py", line 744, in importlib_load_source
28875 WARNING: stderr: File "c:\users\luc\pycharmprojects\googlecommandcenter\venv\lib\site-packages\PyInstaller\compat.py", line 744, in importlib_load_source
return mod_loader.load_module()
28876 WARNING: stderr: return mod_loader.load_module()
File "<frozen importlib._bootstrap_external>", line 399, in _check_name_wrapper
28877 WARNING: stderr: File "<frozen importlib._bootstrap_external>", line 399, in _check_name_wrapper
File "<frozen importlib._bootstrap_external>", line 823, in load_module
28878 WARNING: stderr: File "<frozen importlib._bootstrap_external>", line 823, in load_module
File "<frozen importlib._bootstrap_external>", line 682, in load_module
28880 WARNING: stderr: File "<frozen importlib._bootstrap_external>", line 682, in load_module
File "<frozen importlib._bootstrap>", line 265, in _load_module_shim
28883 WARNING: stderr: File "<frozen importlib._bootstrap>", line 265, in _load_module_shim
File "<frozen importlib._bootstrap>", line 684, in _load
28886 WARNING: stderr: File "<frozen importlib._bootstrap>", line 684, in _load
File "<frozen importlib._bootstrap>", line 665, in _load_unlocked
28891 WARNING: stderr: File "<frozen importlib._bootstrap>", line 665, in _load_unlocked
File "<frozen importlib._bootstrap_external>", line 678, in exec_module
28893 WARNING: stderr: File "<frozen importlib._bootstrap_external>", line 678, in exec_module
File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed
28895 WARNING: stderr: File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed
File "c:\users\luc\pycharmprojects\googlecommandcenter\venv\lib\site-packages\PyInstaller\hooks\hook-numpy.core.py", line 27, in <module>
28897 WARNING: stderr: File "c:\users\luc\pycharmprojects\googlecommandcenter\venv\lib\site-packages\PyInstaller\hooks\hook-numpy.core.py", line 27, in <module>
pkg_base, pkg_dir = get_package_paths('numpy.core')
28898 WARNING: stderr: pkg_base, pkg_dir = get_package_paths('numpy.core')
File "c:\users\luc\pycharmprojects\googlecommandcenter\venv\lib\site-packages\PyInstaller\utils\hooks\__init__.py", line 530, in get_package_paths
28899 WARNING: stderr: File "c:\users\luc\pycharmprojects\googlecommandcenter\venv\lib\site-packages\PyInstaller\utils\hooks\__init__.py", line 530, in get_package_paths
file_attr = get_module_file_attribute(package)
28900 WARNING: stderr: file_attr = get_module_file_attribute(package)
File "c:\users\luc\pycharmprojects\googlecommandcenter\venv\lib\site-packages\PyInstaller\utils\hooks\__init__.py", line 336, in get_module_file_attribute
28902 WARNING: stderr: File "c:\users\luc\pycharmprojects\googlecommandcenter\venv\lib\site-packages\PyInstaller\utils\hooks\__init__.py", line 336, in get_module_file_attribute
raise ImportError
28903 WARNING: stderr: raise ImportError
ImportError
28903 WARNING: stderr: ImportError
I have also tried messing with my .spec file. Here it is,
# -*- mode: python -*-
block_cipher = None
a = Analysis(['main.py'],
pathex=[
'C:\\Users\\Luc\\PycharmProjects\\GoogleCommandCenter',
'C:\\Users\\Luc\\PycharmProjects\\GoogleCommandCenter\\venv',
'C:\\Users\\Luc\\PycharmProjects\\GoogleCommandCenter\\venv\\Scripts\\python.exe'
],
binaries=[],
datas=[],
hiddenimports=[],
hookspath=[],
runtime_hooks=[],
excludes=[],
win_no_prefer_redirects=False,
win_private_assemblies=False,
cipher=block_cipher)
pyz = PYZ(a.pure, a.zipped_data,
cipher=block_cipher)
exe = EXE(pyz,
a.scripts,
a.binaries,
a.zipfiles,
a.datas,
name='main',
debug=False,
strip=False,
upx=True,
runtime_tmpdir=None,
console=True )