I'm trying to build an exe file from my pycharm project but it did not succeed. I've tried several solutions from the Internet but they didn't work for me. there was nothing in the dist folder.
the statement I used was "pyinstaller main.py". I also upgraded pyinstaller from 4.2 to 5.0 and it still didn't work.
please help. Thanks
Here is the output from both Pycharm terminal.
Microsoft Windows [Version 10.0.18363.1440]
(c) 2019 Microsoft Corporation. All rights reserved.
(venv) C:\Users\Ghia\PycharmProjects\test>pyinstaller main.py
130 INFO: PyInstaller: 4.2
130 INFO: Python: 3.9.2
130 INFO: Platform: Windows-10-10.0.18362-SP0
130 INFO: wrote C:\Users\Ghia\PycharmProjects\test\main.spec
137 INFO: UPX is not available.
140 INFO: Extending PYTHONPATH with paths
['C:\\Users\\Ghia\\PycharmProjects\\test',
'C:\\Users\\Ghia\\PycharmProjects\\test']
150 INFO: checking Analysis
150 INFO: Building Analysis because Analysis-00.toc is non existent
159 INFO: Initializing module dependency graph...
170 INFO: Caching module graph hooks...
190 WARNING: Several hooks defined for module 'win32ctypes.core'. Please take care they do not conflict.
199 INFO: Analyzing base_library.zip ...
6866 INFO: Processing pre-find module path hook distutils from 'c:\\users\\ghia\\pycharmprojects\\test\\venv\\lib\\site-packages\\PyInstaller\\hooks\\pre
_find_module_path\\hook-distutils.py'.
6870 INFO: distutils: retargeting to non-venv dir 'C:\\Program Files\\WindowsApps\\PythonSoftwareFoundation.Python.3.9_3.9.752.0_x64__qbz5n2kfra8p0\\lib'
9638 INFO: Caching module dependency graph...
9848 INFO: running Analysis Analysis-00.toc
9856 INFO: Adding Microsoft.Windows.Common-Controls to dependent assemblies of final executable
required by c:\users\ghia\pycharmprojects\test\venv\scripts\python.exe
9879 INFO: Analyzing C:\Users\Ghia\PycharmProjects\test\main.py
10145 INFO: Processing module hooks...
10146 INFO: Loading module hook 'hook-difflib.py' from 'c:\\users\\ghia\\pycharmprojects\\test\\venv\\lib\\site-packages\\PyInstaller\\hooks'...
10148 INFO: Excluding import of doctest from module difflib
10148 INFO: Loading module hook 'hook-distutils.py' from 'c:\\users\\ghia\\pycharmprojects\\test\\venv\\lib\\site-packages\\PyInstaller\\hooks'...
10150 INFO: Loading module hook 'hook-encodings.py' from 'c:\\users\\ghia\\pycharmprojects\\test\\venv\\lib\\site-packages\\PyInstaller\\hooks'...
10459 INFO: Loading module hook 'hook-heapq.py' from 'c:\\users\\ghia\\pycharmprojects\\test\\venv\\lib\\site-packages\\PyInstaller\\hooks'...
10461 INFO: Excluding import of doctest from module heapq
10462 INFO: Loading module hook 'hook-multiprocessing.util.py' from 'c:\\users\\ghia\\pycharmprojects\\test\\venv\\lib\\site-packages\\PyInstaller\\hooks
'...
10464 INFO: Excluding import of test from module multiprocessing.util
10464 INFO: Excluding import of test.support from module multiprocessing.util
10464 INFO: Loading module hook 'hook-pickle.py' from 'c:\\users\\ghia\\pycharmprojects\\test\\venv\\lib\\site-packages\\PyInstaller\\hooks'...
10466 INFO: Excluding import of argparse from module pickle
10466 INFO: Loading module hook 'hook-sysconfig.py' from 'c:\\users\\ghia\\pycharmprojects\\test\\venv\\lib\\site-packages\\PyInstaller\\hooks'...
10468 INFO: Loading module hook 'hook-xml.py' from 'c:\\users\\ghia\\pycharmprojects\\test\\venv\\lib\\site-packages\\PyInstaller\\hooks'...
10838 INFO: Loading module hook 'hook-_tkinter.py' from 'c:\\users\\ghia\\pycharmprojects\\test\\venv\\lib\\site-packages\\PyInstaller\\hooks'...
10850 WARNING: lib not found: python39.dll dependency of C:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.9_3.9.752.0_x64__qbz5n2kfra8p0\DL
Ls\_tkinter.pyd
11370 INFO: checking Tree
11489 INFO: checking Tree
11779 INFO: checking Tree
11819 INFO: Looking for ctypes DLLs
11824 INFO: Analyzing run-time hooks ...
11829 INFO: Including run-time hook 'c:\\users\\ghia\\pycharmprojects\\test\\venv\\lib\\site-packages\\PyInstaller\\hooks\\rthooks\\pyi_rth_multiprocessi
ng.py'
11834 INFO: Including run-time hook 'c:\\users\\ghia\\pycharmprojects\\test\\venv\\lib\\site-packages\\PyInstaller\\hooks\\rthooks\\pyi_rth__tkinter.py'
11843 INFO: Looking for dynamic libraries
11860 WARNING: lib not found: python39.dll dependency of C:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.9_3.9.752.0_x64__qbz5n2kfra8p0\DL
Ls\_multiprocessing.pyd
11888 WARNING: lib not found: python39.dll dependency of C:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.9_3.9.752.0_x64__qbz5n2kfra8p0\DL
Ls\unicodedata.pyd
11917 WARNING: lib not found: python39.dll dependency of C:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.9_3.9.752.0_x64__qbz5n2kfra8p0\DL
Ls\select.pyd
11945 WARNING: lib not found: python39.dll dependency of C:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.9_3.9.752.0_x64__qbz5n2kfra8p0\DL
Ls\_socket.pyd
11988 WARNING: lib not found: python39.dll dependency of C:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.9_3.9.752.0_x64__qbz5n2kfra8p0\DL
Ls\_decimal.pyd
12024 WARNING: lib not found: python39.dll dependency of C:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.9_3.9.752.0_x64__qbz5n2kfra8p0\DL
Ls\_overlapped.pyd
12072 WARNING: lib not found: python39.dll dependency of C:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.9_3.9.752.0_x64__qbz5n2kfra8p0\DL
Ls\_ssl.pyd
12106 WARNING: lib not found: python39.dll dependency of C:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.9_3.9.752.0_x64__qbz5n2kfra8p0\DL
Ls\_queue.pyd
12135 WARNING: lib not found: python39.dll dependency of C:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.9_3.9.752.0_x64__qbz5n2kfra8p0\DL
Ls\pyexpat.pyd
12156 WARNING: lib not found: python39.dll dependency of C:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.9_3.9.752.0_x64__qbz5n2kfra8p0\DL
Ls\_asyncio.pyd
12179 WARNING: lib not found: python39.dll dependency of C:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.9_3.9.752.0_x64__qbz5n2kfra8p0\DL
Ls\_hashlib.pyd
12208 WARNING: lib not found: python39.dll dependency of C:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.9_3.9.752.0_x64__qbz5n2kfra8p0\DL
Ls\_lzma.pyd
12235 WARNING: lib not found: python39.dll dependency of C:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.9_3.9.752.0_x64__qbz5n2kfra8p0\DL
Ls\_bz2.pyd
12269 WARNING: lib not found: python39.dll dependency of C:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.9_3.9.752.0_x64__qbz5n2kfra8p0\DL
Ls\_ctypes.pyd
12305 WARNING: lib not found: python39.dll dependency of C:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.9_3.9.752.0_x64__qbz5n2kfra8p0\DL
Ls\_tkinter.pyd
12621 INFO: Looking for eggs
12621 INFO: Python library not in binary dependencies. Doing additional searching...
12623 WARNING: Can not get binary dependencies for file: C:\Users\Ghia\AppData\Local\Microsoft\WindowsApps\PythonSoftwareFoundation.Python.3.9_qbz5n2kfra
8p0\python.exe
12623 WARNING: Reason: 'The file is empty'
Traceback (most recent call last):
File "C:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.9_3.9.752.0_x64__qbz5n2kfra8p0\lib\runpy.py", line 197, in _run_module_as_main
return _run_code(code, main_globals, None,
File "C:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.9_3.9.752.0_x64__qbz5n2kfra8p0\lib\runpy.py", line 87, in _run_code
exec(code, run_globals)
File "C:\Users\Ghia\PycharmProjects\test\venv\Scripts\pyinstaller.exe\__main__.py", line 7, in <module>
File "c:\users\ghia\pycharmprojects\test\venv\lib\site-packages\PyInstaller\__main__.py", line 114, in run
run_build(pyi_config, spec_file, **vars(args))
File "c:\users\ghia\pycharmprojects\test\venv\lib\site-packages\PyInstaller\__main__.py", line 65, in run_build
PyInstaller.building.build_main.main(pyi_config, spec_file, **kwargs)
File "c:\users\ghia\pycharmprojects\test\venv\lib\site-packages\PyInstaller\building\build_main.py", line 725, in main
build(specfile, kw.get('distpath'), kw.get('workpath'), kw.get('clean_build'))
File "c:\users\ghia\pycharmprojects\test\venv\lib\site-packages\PyInstaller\building\build_main.py", line 672, in build
exec(code, spec_namespace)
File "C:\Users\Ghia\PycharmProjects\test\main.spec", line 6, in <module>
a = Analysis(['main.py'],
File "c:\users\ghia\pycharmprojects\test\venv\lib\site-packages\PyInstaller\building\build_main.py", line 242, in __init__
self.__postinit__()
File "c:\users\ghia\pycharmprojects\test\venv\lib\site-packages\PyInstaller\building\datastruct.py", line 160, in __postinit__
self.assemble()
File "c:\users\ghia\pycharmprojects\test\venv\lib\site-packages\PyInstaller\building\build_main.py", line 476, in assemble
self._check_python_library(self.binaries)
File "c:\users\ghia\pycharmprojects\test\venv\lib\site-packages\PyInstaller\building\build_main.py", line 569, in _check_python_library
python_lib = bindepend.get_python_library_path()
File "c:\users\ghia\pycharmprojects\test\venv\lib\site-packages\PyInstaller\depend\bindepend.py", line 945, in get_python_library_path
raise IOError(msg)
OSError: Python library not found: python39.dll, libpython3.9m.dll, libpython3.9.dll, libpython39.dll, libpython39m.dll
This would mean your Python installation doesn't come with proper library files.
This usually happens by missing development package, or unsuitable build parameters of Python installation.
* On Debian/Ubuntu, you would need to install Python development packages
* apt-get install python3-dev
* apt-get install python-dev
* If you're building Python by yourself, please rebuild your Python with `--enable-shared` (or, `--enable-framework` on Darwin)
upgrade pip and try to install pyinstaller from github repo
python.exe -m pip install --upgrade pip
python.exe -m pip install https://github.com/pyinstaller/pyinstaller/archive/develop.zip
after that try to build exe file.
pyinstaller "filename"
'pyinstaller' is not recognized as an internal or external command,
operable program or batch file. it gave me this
Related
I always have used pyinstaller to create executables files but now when on working on a older project I am facing some issues.
I have figured out that the main problem is while importing pyreadstat package. (pyreadstat is a python package to read spss files.)
import pyreadstat
Post running pyinstaller it first gives error for Module not found pandas. To resolve this I added --hidden-import pandas then it gave another error about Module not found pyreadstat._readstat_writer.
Once I added that as hidden import I got Module not found worker.
I am now not sure why pyinstaller is behaving in this way. Earlier it used to work correctly.
Can someone provider their input here. Below is the cmd log for reference.
D:\Projects\Test>pyinstaller --onefile test.py
62 INFO: PyInstaller: 4.1
62 INFO: Python: 3.9.1
62 INFO: Platform: Windows-10-10.0.19041-SP0
62 INFO: wrote D:\Projects\Test\test.spec
62 INFO: UPX is not available.
69 INFO: Extending PYTHONPATH with paths
['D:\\Projects\\Test', 'D:\\Projects\\Test']
69 INFO: checking Analysis
69 INFO: Building Analysis because Analysis-00.toc is non existent
69 INFO: Initializing module dependency graph...
69 INFO: Caching module graph hooks...
85 INFO: Analyzing base_library.zip ...
1941 INFO: Processing pre-find module path hook distutils from 'c:\\program files\\python39\\lib\\site-packages\\PyInstaller\\hooks\\pre_find_module_path\\hook-distutils.py'.
1941 INFO: distutils: retargeting to non-venv dir 'c:\\program files\\python39\\lib'
3458 INFO: Caching module dependency graph...
3552 INFO: running Analysis Analysis-00.toc
3552 INFO: Adding Microsoft.Windows.Common-Controls to dependent assemblies of final executable
required by c:\program files\python39\python.exe
3599 WARNING: lib not found: api-ms-win-core-path-l1-1-0.dll dependency of c:\program files\python39\python39.dll
3615 INFO: Analyzing D:\Projects\Test\test.py
3630 INFO: Processing module hooks...
3630 INFO: Loading module hook 'hook-difflib.py' from 'c:\\program files\\python39\\lib\\site-packages\\PyInstaller\\hooks'...
3630 INFO: Excluding import of doctest from module difflib
3630 INFO: Loading module hook 'hook-distutils.py' from 'c:\\program files\\python39\\lib\\site-packages\\PyInstaller\\hooks'...
3630 INFO: Loading module hook 'hook-distutils.util.py' from 'c:\\program files\\python39\\lib\\site-packages\\PyInstaller\\hooks'...
3630 INFO: Excluding import of lib2to3.refactor from module distutils.util
3630 INFO: Loading module hook 'hook-encodings.py' from 'c:\\program files\\python39\\lib\\site-packages\\PyInstaller\\hooks'...
3703 INFO: Loading module hook 'hook-heapq.py' from 'c:\\program files\\python39\\lib\\site-packages\\PyInstaller\\hooks'...
3703 INFO: Excluding import of doctest from module heapq
3703 INFO: Loading module hook 'hook-lib2to3.py' from 'c:\\program files\\python39\\lib\\site-packages\\PyInstaller\\hooks'...
3828 INFO: Loading module hook 'hook-multiprocessing.util.py' from 'c:\\program files\\python39\\lib\\site-packages\\PyInstaller\\hooks'...
3828 INFO: Excluding import of test.support from module multiprocessing.util
3828 INFO: Excluding import of test from module multiprocessing.util
3844 INFO: Loading module hook 'hook-pickle.py' from 'c:\\program files\\python39\\lib\\site-packages\\PyInstaller\\hooks'...
3844 INFO: Excluding import of argparse from module pickle
3844 INFO: Loading module hook 'hook-sysconfig.py' from 'c:\\program files\\python39\\lib\\site-packages\\PyInstaller\\hooks'...
3844 INFO: Loading module hook 'hook-xml.etree.cElementTree.py' from 'c:\\program files\\python39\\lib\\site-packages\\PyInstaller\\hooks'...
3844 INFO: Loading module hook 'hook-xml.py' from 'c:\\program files\\python39\\lib\\site-packages\\PyInstaller\\hooks'...
3891 INFO: Loading module hook 'hook-_tkinter.py' from 'c:\\program files\\python39\\lib\\site-packages\\PyInstaller\\hooks'...
4006 INFO: checking Tree
4006 INFO: Building Tree because Tree-00.toc is non existent
4021 INFO: Building Tree Tree-00.toc
4085 INFO: checking Tree
4085 INFO: Building Tree because Tree-01.toc is non existent
4085 INFO: Building Tree Tree-01.toc
4180 INFO: checking Tree
4180 INFO: Building Tree because Tree-02.toc is non existent
4180 INFO: Building Tree Tree-02.toc
4196 INFO: Looking for ctypes DLLs
4211 INFO: Analyzing run-time hooks ...
4211 INFO: Including run-time hook 'c:\\program files\\python39\\lib\\site-packages\\PyInstaller\\hooks\\rthooks\\pyi_rth_multiprocessing.py'
4211 INFO: Looking for dynamic libraries
4446 INFO: Looking for eggs
4446 INFO: Using Python library c:\program files\python39\python39.dll
4446 INFO: Found binding redirects:
[]
4446 INFO: Warnings written to D:\Projects\Test\build\test\warn-test.txt
4477 INFO: Graph cross-reference written to D:\Projects\Test\build\test\xref-test.html
4524 INFO: checking PYZ
4524 INFO: Building PYZ because PYZ-00.toc is non existent
4524 INFO: Building PYZ (ZlibArchive) D:\Projects\Test\build\test\PYZ-00.pyz
4883 INFO: Building PYZ (ZlibArchive) D:\Projects\Test\build\test\PYZ-00.pyz completed successfully.
4899 INFO: checking PKG
4899 INFO: Building PKG because PKG-00.toc is non existent
4899 INFO: Building PKG (CArchive) PKG-00.pkg
6528 INFO: Building PKG (CArchive) PKG-00.pkg completed successfully.
6528 INFO: Bootloader c:\program files\python39\lib\site-packages\PyInstaller\bootloader\Windows-64bit\run.exe
6528 INFO: checking EXE
6528 INFO: Building EXE because EXE-00.toc is non existent
6528 INFO: Building EXE from EXE-00.toc
6528 INFO: Appending archive to EXE D:\Projects\Test\dist\test.exe
6700 INFO: Building EXE from EXE-00.toc completed successfully.
D:\Projects\Test>cd dist
D:\Projects\Test\dist>test.exe
Traceback (most recent call last):
File "test.py", line 1, in <module>
File "c:\program files\python39\lib\site-packages\PyInstaller\loader\pyimod03_importers.py", line 493, in exec_module
exec(bytecode, module.__dict__)
File "pyreadstat\__init__.py", line 17, in <module>
File "pyreadstat\pyreadstat.pyx", line 1, in init pyreadstat.pyreadstat
File "pyreadstat\_readstat_parser.pyx", line 28, in init pyreadstat._readstat_parser
ModuleNotFoundError: No module named 'pandas'
[10584] Failed to execute script test
Currently i meet issue while packaging exe through pyinstaller .
I create a virtual environmental under pycharm , and my programe is very simple
a = input("please input a :")
b = input("please input b: ")
c = print(a+b)
the code stored in test.py . and then I type pyinstaller -F test.py on pycharm consle , it shows as below . as you seen , many libs not found , and packaing failed .
(venv) C:\cheng\Project\STC_Tool\venv>pyinstaller -v
3.6
(venv) C:\cheng\Project\STC_Tool\venv>pyinstaller -F test.py
67 INFO: PyInstaller: 3.6
67 INFO: Python: 3.7.8
70 INFO: Platform: Windows-10-10.0.18362-SP0
72 INFO: wrote C:\cheng\Project\STC_Tool\venv\test.spec
73 INFO: UPX is not available.
74 INFO: Extending PYTHONPATH with paths
['C:\\cheng\\Project\\STC_Tool\\venv', 'C:\\cheng\\Project\\STC_Tool\\venv']
75 INFO: checking Analysis
77 INFO: Building because C:\cheng\Project\STC_Tool\venv\test.py changed
78 INFO: Initializing module dependency graph...
80 INFO: Caching module graph hooks...
83 INFO: Analyzing base_library.zip ...
2178 INFO: Processing pre-find module path hook distutils
2191 INFO: distutils: retargeting to non-venv dir 'C:\\cheng\\Software\\Python\\lib'
3247 INFO: Caching module dependency graph...
3348 INFO: running Analysis Analysis-00.toc
3351 INFO: Adding Microsoft.Windows.Common-Controls to dependent assemblies of final executable
required by c:\cheng\project\stc_tool\venv\scripts\python.exe
3365 WARNING: lib not found: VERSION.dll dependency of c:\cheng\project\stc_tool\venv\scripts\python.exe
3371 INFO: Analyzing C:\cheng\Project\STC_Tool\venv\test.py
3373 INFO: Processing module hooks...
3374 INFO: Loading module hook "hook-distutils.py"...
3375 INFO: Loading module hook "hook-encodings.py"...
3656 INFO: Loading module hook "hook-pydoc.py"...
3657 INFO: Loading module hook "hook-sysconfig.py"...
3659 INFO: Loading module hook "hook-xml.py"...
3910 INFO: Looking for ctypes DLLs
3915 INFO: Analyzing run-time hooks ...
3917 INFO: Looking for dynamic libraries
3937 WARNING: lib not found: VCRUNTIME140.dll dependency of C:\cheng\Software\Python\DLLs\select.pyd
3947 WARNING: lib not found: python37.dll dependency of C:\cheng\Software\Python\DLLs\select.pyd
3966 WARNING: lib not found: VCRUNTIME140.dll dependency of C:\cheng\Software\Python\DLLs\_socket.pyd
3974 WARNING: lib not found: python37.dll dependency of C:\cheng\Software\Python\DLLs\_socket.pyd
3978 WARNING: lib not found: VCRUNTIME140.dll dependency of C:\cheng\Software\Python\DLLs\_lzma.pyd
3994 WARNING: lib not found: python37.dll dependency of C:\cheng\Software\Python\DLLs\_lzma.pyd
4001 WARNING: lib not found: VCRUNTIME140.dll dependency of C:\cheng\Software\Python\DLLs\_bz2.pyd
4027 WARNING: lib not found: python37.dll dependency of C:\cheng\Software\Python\DLLs\_bz2.pyd
4052 WARNING: lib not found: VCRUNTIME140.dll dependency of C:\cheng\Software\Python\DLLs\_hashlib.pyd
4062 WARNING: lib not found: python37.dll dependency of C:\cheng\Software\Python\DLLs\_hashlib.pyd
4071 WARNING: lib not found: libcrypto-1_1.dll dependency of C:\cheng\Software\Python\DLLs\_hashlib.pyd
4079 WARNING: lib not found: libssl-1_1.dll dependency of C:\cheng\Software\Python\DLLs\_ssl.pyd
4095 WARNING: lib not found: VCRUNTIME140.dll dependency of C:\cheng\Software\Python\DLLs\_ssl.pyd
4097 WARNING: lib not found: python37.dll dependency of C:\cheng\Software\Python\DLLs\_ssl.pyd
4106 WARNING: lib not found: libcrypto-1_1.dll dependency of C:\cheng\Software\Python\DLLs\_ssl.pyd
4128 WARNING: lib not found: VCRUNTIME140.dll dependency of C:\cheng\Software\Python\DLLs\unicodedata.pyd
4141 WARNING: lib not found: python37.dll dependency of C:\cheng\Software\Python\DLLs\unicodedata.pyd
4161 WARNING: lib not found: VCRUNTIME140.dll dependency of C:\cheng\Software\Python\DLLs\pyexpat.pyd
4171 WARNING: lib not found: python37.dll dependency of C:\cheng\Software\Python\DLLs\pyexpat.pyd
4174 INFO: Looking for eggs
4174 INFO: Python library not in binary dependencies. Doing additional searching...
4180 INFO: Using Python library
4180 INFO: Found binding redirects:
[]
4194 INFO: Warnings written to C:\cheng\Project\STC_Tool\venv\build\test\warn-test.txt
4252 INFO: Graph cross-reference written to C:\cheng\Project\STC_Tool\venv\build\test\xref-test.html
4261 INFO: checking PYZ
4268 INFO: Building because toc changed
4270 INFO: Building PYZ (ZlibArchive) C:\cheng\Project\STC_Tool\venv\build\test\PYZ-00.pyz
4875 INFO: Building PYZ (ZlibArchive) C:\cheng\Project\STC_Tool\venv\build\test\PYZ-00.pyz completed successfully.
4890 INFO: checking PKG
4891 INFO: Building because toc changed
4893 INFO: Building PKG (CArchive) PKG-00.pkg
Traceback (most recent call last):
File "C:\cheng\Software\Python\lib\runpy.py", line 193, in _run_module_as_main
"__main__", mod_spec)
File "C:\cheng\Software\Python\lib\runpy.py", line 85, in _run_code
exec(code, run_globals)
File "C:\cheng\Project\STC_Tool\venv\Scripts\pyinstaller.exe\__main__.py", line 7, in <module>
File "c:\cheng\project\stc_tool\venv\lib\site-packages\PyInstaller\__main__.py", line 114, in run
run_build(pyi_config, spec_file, **vars(args))
File "c:\cheng\project\stc_tool\venv\lib\site-packages\PyInstaller\__main__.py", line 65, in run_build
PyInstaller.building.build_main.main(pyi_config, spec_file, **kwargs)
File "c:\cheng\project\stc_tool\venv\lib\site-packages\PyInstaller\building\build_main.py", line 734, in main
build(specfile, kw.get('distpath'), kw.get('workpath'), kw.get('clean_build'))
File "c:\cheng\project\stc_tool\venv\lib\site-packages\PyInstaller\building\build_main.py", line 681, in build
exec(code, spec_namespace)
File "C:\cheng\Project\STC_Tool\venv\test.spec", line 33, in <module>
console=True )
File "c:\cheng\project\stc_tool\venv\lib\site-packages\PyInstaller\building\api.py", line 436, in __init__
upx_exclude=self.upx_exclude
File "c:\cheng\project\stc_tool\venv\lib\site-packages\PyInstaller\building\api.py", line 199, in __init__
self.__postinit__()
File "c:\cheng\project\stc_tool\venv\lib\site-packages\PyInstaller\building\datastruct.py", line 160, in __postinit__
self.assemble()
File "c:\cheng\project\stc_tool\venv\lib\site-packages\PyInstaller\building\api.py", line 262, in assemble
dist_nm=inm)
File "c:\cheng\project\stc_tool\venv\lib\site-packages\PyInstaller\building\utils.py", line 220, in checkCache
digest = cacheDigest(fnm, redirects)
File "c:\cheng\project\stc_tool\venv\lib\site-packages\PyInstaller\building\utils.py", line 365, in cacheDigest
with open(fnm, "rb") as f:
FileNotFoundError: [Errno 2] No such file or directory: ''
if I remobve -F option and type pyinstaller test.py directly , the packaing would be successfully
(venv) C:\cheng\Project\STC_Tool\venv>pyinstaller test.py
65 INFO: PyInstaller: 3.6
65 INFO: Python: 3.7.8
66 INFO: Platform: Windows-10-10.0.18362-SP0
68 INFO: wrote C:\cheng\Project\STC_Tool\venv\test.spec
70 INFO: UPX is not available.
70 INFO: Extending PYTHONPATH with paths
['C:\\cheng\\Project\\STC_Tool\\venv', 'C:\\cheng\\Project\\STC_Tool\\venv']
70 INFO: checking Analysis
75 INFO: checking PYZ
98 INFO: checking PKG
98 INFO: Building because toc changed
99 INFO: Building PKG (CArchive) PKG-00.pkg
125 INFO: Building PKG (CArchive) PKG-00.pkg completed successfully.
128 INFO: Bootloader c:\cheng\project\stc_tool\venv\lib\site-packages\PyInstaller\bootloader\Windows-32bit\run.exe
129 INFO: checking EXE
131 INFO: Building because toc changed
132 INFO: Building EXE from EXE-00.toc
134 INFO: Appending archive to EXE C:\cheng\Project\STC_Tool\venv\build\test\test.exe
137 INFO: Building EXE from EXE-00.toc completed successfully.
142 INFO: checking COLLECT
WARNING: The output directory "C:\cheng\Project\STC_Tool\venv\dist\test" and ALL ITS CONTENTS will be REMOVED! Continue? (y/N)y
On your own risk, you can use the option `--noconfirm` to get rid of this question.
2769 INFO: Removing dir C:\cheng\Project\STC_Tool\venv\dist\test
2780 INFO: Building COLLECT COLLECT-00.toc
2830 INFO: Building COLLECT COLLECT-00.toc completed successfully.
but the test.exe flashed and closed after I click , I using screen recording tool capture the flash error
, it shows Error loading Python DLL 'c:\cheng\Project\STC_Tool\venv\dist\test'
the python installed on win10 is python3.7 , and I am using win10 64 bit operating system.
could you please give me some suggestiones .
after unistall pyinstaller and then reinstall pyinstaller again , issue solved.
please considered to update system variable as well.
I have built python3.8 on a virgin installation of Centos 7.7 via:
CXX="/usr/bin/g++"
export CXX
./configure LDFLAGS="-static -static-libgcc" CPPFLAGS="-static" \
--enable-optimizations \
--prefix=/opt/python38 \
--enable-shared \
--enable-static \
--with-system-expat \
--with-system-ffi \
--with-ensurepip=yes
snaptime=`date +%Y%m%d.%H%M`
/usr/bin/make -j `nproc` 2>&1 | /usr/bin/tee log.${snaptime}
echo "remember to 'make altinstall' to avoid overwriting your system python"
Next, I attempt to build a standalone executable via "pyinstaller hello.py"
I receive the following output/errors:
$ pyinstaller hello.py
25 INFO: PyInstaller: 3.5
25 INFO: Python: 3.8.0
53 INFO: Platform: Linux-3.10.0-1062.9.1.el7.x86_64-x86_64-with-glibc2.17
53 INFO: wrote /home/usr/testpy1/hello.spec
54 INFO: UPX is not available.
55 INFO: Extending PYTHONPATH with paths
['/home/usr/testpy1', '/home/usr/testpy1']
55 INFO: checking Analysis
55 INFO: Building Analysis because Analysis-00.toc is non existent
55 INFO: Initializing module dependency graph...
56 INFO: Initializing module graph hooks...
57 INFO: Analyzing base_library.zip ...
2331 INFO: running Analysis Analysis-00.toc
2342 INFO: Caching module hooks...
2345 INFO: Analyzing /home/usr/testpy1/hello.py
2348 INFO: Loading module hooks...
2348 INFO: Loading module hook "hook-encodings.py"...
2378 INFO: Loading module hook "hook-pydoc.py"...
2379 INFO: Loading module hook "hook-xml.py"...
2504 INFO: Looking for ctypes DLLs
2506 INFO: Analyzing run-time hooks ...
2507 INFO: Including run-time hook 'pyi_rth_multiprocessing.py'
2511 INFO: Looking for dynamic libraries
2795 INFO: Looking for eggs
2796 INFO: Python library not in binary dependencies. Doing additional searching...
Traceback (most recent call last):
File "/usr/local/bin/pyinstaller", line 8, in <module>
sys.exit(run())
File "/usr/local/lib/python3.8/site-packages/PyInstaller/__main__.py", line 111, in run
run_build(pyi_config, spec_file, **vars(args))
File "/usr/local/lib/python3.8/site-packages/PyInstaller/__main__.py", line 63, in run_build
PyInstaller.building.build_main.main(pyi_config, spec_file, **kwargs)
File "/usr/local/lib/python3.8/site-packages/PyInstaller/building/build_main.py", line 844, in main
build(specfile, kw.get('distpath'), kw.get('workpath'), kw.get('clean_build'))
File "/usr/local/lib/python3.8/site-packages/PyInstaller/building/build_main.py", line 791, in build
exec(code, spec_namespace)
File "/home/usr/testpy1/hello.spec", line 6, in <module>
a = Analysis(['hello.py'],
File "/usr/local/lib/python3.8/site-packages/PyInstaller/building/build_main.py", line 243, in __init__
self.__postinit__()
File "/usr/local/lib/python3.8/site-packages/PyInstaller/building/datastruct.py", line 158, in __postinit__
self.assemble()
File "/usr/local/lib/python3.8/site-packages/PyInstaller/building/build_main.py", line 575, in assemble
self._check_python_library(self.binaries)
File "/usr/local/lib/python3.8/site-packages/PyInstaller/building/build_main.py", line 681, in _check_python_library
raise IOError(msg)
OSError: Python library not found: libpython3.8.so.1.0, libpython3.8m.so.1.0, libpython3.8m.so, libpython3.8mu.so.1.0
This would mean your Python installation doesn't come with proper library files.
This usually happens by missing development package, or unsuitable build parameters of Python installation.
* On Debian/Ubuntu, you would need to install Python development packages
* apt-get install python3-dev
* apt-get install python-dev
* If you're building Python by yourself, please rebuild your Python with `--enable-shared` (or, `--enable-framework` on Darwin)
When I check my build directory, sure enough, the specified files (libpython3.8.so.1.0, libpython3.8m.so.1.0, libpython3.8m.so, libpython3.8mu.so.1.0) do not exist in my build directory, nor in my /usr/lib and /usr/lib64 directories.
Also, from the root directory, I have run "cd '/' && find . | grep -i libpython3.8" and received one line of output ->
/home/usr/python3.8/Python-3.8.0/libpython3.8.a
Because I have both --enable-shared and --enable-static on the ./configure command-line, I expect both .a and .so files to be generated with the build and altinstall, but that is obviously not happening.
I am also aware that the problem may be from 'pyinstaller' - perhaps it is not yet working with versions of python greater than 3.5?
Comments? Suggestions? Questions?
I am trying to ship an executable from my python script which lives inside a virtual environment using pipenv which again relies on pyenv for python versioning. For that, I want to us pyinstaller.
What I did:
pipenv install pyinstaller
pyinstaller --onefile my_script.py
Output:
40 INFO: PyInstaller: 3.5
40 INFO: Python: 3.6.9
41 INFO: Platform: Linux-4.15.0-65-generic-x86_64-with-debian-stretch-sid
42 INFO: wrote /home/matthaeus/cybathlon/planvec/qt_video_gui_example.spec
44 INFO: UPX is not available.
45 INFO: Extending PYTHONPATH with paths
['/home/matthaeus/cybathlon/planvec', '/home/matthaeus/cybathlon/planvec']
45 INFO: checking Analysis
45 INFO: Building Analysis because Analysis-00.toc is non existent
45 INFO: Initializing module dependency graph...
46 INFO: Initializing module graph hooks...
47 INFO: Analyzing base_library.zip ...
2786 INFO: running Analysis Analysis-00.toc
2801 INFO: Caching module hooks...
2805 INFO: Analyzing /home/matthaeus/cybathlon/planvec/qt_video_gui_example.py
3284 INFO: Processing pre-find module path hook distutils
3285 INFO: distutils: retargeting to non-venv dir '/home/matthaeus/.pyenv/versions/3.6.9/lib/python3.6/distutils/__init__.py'
3972 INFO: Processing pre-safe import module hook setuptools.extern.six.moves
4336 INFO: Processing pre-find module path hook site
4337 INFO: site: retargeting to fake-dir '/home/matthaeus/.local/share/virtualenvs/planvec-R86NQhbu/lib/python3.6/site-packages/PyInstaller/fake-modules'
6327 INFO: Loading module hooks...
6328 INFO: Loading module hook "hook-numpy.core.py"...
6458 INFO: Loading module hook "hook-sysconfig.py"...
6464 INFO: Loading module hook "hook-PyQt5.QtCore.py"...
6534 INFO: Loading module hook "hook-scipy.py"...
6535 INFO: Loading module hook "hook-PyQt5.py"...
6549 WARNING: Hidden import "sip" not found!
6549 INFO: Loading module hook "hook-pkg_resources.py"...
6788 INFO: Processing pre-safe import module hook win32com
7015 INFO: Loading module hook "hook-numpy.py"...
7015 INFO: Loading module hook "hook-cv2.py"...
7016 INFO: Loading module hook "hook-PyQt5.QtGui.py"...
7048 INFO: Loading module hook "hook-PyQt5.QtWidgets.py"...
7096 INFO: Loading module hook "hook-pydoc.py"...
7097 INFO: Loading module hook "hook-xml.py"...
7150 INFO: Loading module hook "hook-encodings.py"...
7203 INFO: Loading module hook "hook-setuptools.py"...
7423 WARNING: Hidden import "distutils.command.build_ext" not found!
7680 INFO: Looking for ctypes DLLs
7762 INFO: Analyzing run-time hooks ...
7769 INFO: Including run-time hook 'pyi_rth_pyqt5.py'
7770 INFO: Including run-time hook 'pyi_rth_pkgres.py'
7771 INFO: Including run-time hook 'pyi_rth_multiprocessing.py'
7785 INFO: Looking for dynamic libraries
9784 INFO: Looking for eggs
9784 INFO: Python library not in binary dependencies. Doing additional searching...
Traceback (most recent call last):
File "/home/matthaeus/.local/share/virtualenvs/planvec-R86NQhbu/bin/pyinstaller", line 8, in <module>
sys.exit(run())
File "/home/matthaeus/.local/share/virtualenvs/planvec-R86NQhbu/lib/python3.6/site-packages/PyInstaller/__main__.py", line 111, in run
run_build(pyi_config, spec_file, **vars(args))
File "/home/matthaeus/.local/share/virtualenvs/planvec-R86NQhbu/lib/python3.6/site-packages/PyInstaller/__main__.py", line 63, in run_build
PyInstaller.building.build_main.main(pyi_config, spec_file, **kwargs)
File "/home/matthaeus/.local/share/virtualenvs/planvec-R86NQhbu/lib/python3.6/site-packages/PyInstaller/building/build_main.py", line 844, in main
build(specfile, kw.get('distpath'), kw.get('workpath'), kw.get('clean_build'))
File "/home/matthaeus/.local/share/virtualenvs/planvec-R86NQhbu/lib/python3.6/site-packages/PyInstaller/building/build_main.py", line 791, in build
exec(code, spec_namespace)
File "/home/matthaeus/cybathlon/planvec/qt_video_gui_example.spec", line 17, in <module>
noarchive=False)
File "/home/matthaeus/.local/share/virtualenvs/planvec-R86NQhbu/lib/python3.6/site-packages/PyInstaller/building/build_main.py", line 243, in __init__
self.__postinit__()
File "/home/matthaeus/.local/share/virtualenvs/planvec-R86NQhbu/lib/python3.6/site-packages/PyInstaller/building/datastruct.py", line 158, in __postinit__
self.assemble()
File "/home/matthaeus/.local/share/virtualenvs/planvec-R86NQhbu/lib/python3.6/site-packages/PyInstaller/building/build_main.py", line 575, in assemble
self._check_python_library(self.binaries)
File "/home/matthaeus/.local/share/virtualenvs/planvec-R86NQhbu/lib/python3.6/site-packages/PyInstaller/building/build_main.py", line 681, in _check_python_library
raise IOError(msg)
OSError: Python library not found: libpython3.6mu.so.1.0, libpython3.6m.so, libpython3.6m.so.1.0, libpython3.6.so.1.0
This would mean your Python installation doesn't come with proper library files.
This usually happens by missing development package, or unsuitable build parameters of Python installation.
* On Debian/Ubuntu, you would need to install Python development packages
* apt-get install python3-dev
* apt-get install python-dev
* If you're building Python by yourself, please rebuild your Python with `--enable-shared` (or, `--enable-framework` on Darwin)
I tried the recommended python3-dev and python-dev installations without luck.
Now, I hope someone can enlighten me what is going on here!
Cheers,
Matt
You need to build with CPython shared-library enabled.
env PYTHON_CONFIGURE_OPTS="--enable-shared" pyenv install 3.6.9
eval "$(pyenv init -)"
Reference: https://github.com/pyenv/pyenv/wiki
I got this problem, I searched a lot, but can not find any solutions.
I want to build an executable with pyinstaller. I never had problems with this.
Now i got this traceback:
9677 INFO: Adding Microsoft.Windows.Common-Controls to dependent assemblies of final executable
10200 WARNING: lib not found: MSVCP90.dll dependency of C:\Python27\lib\site-packages\wx-3.0-msw\wx\_controls_.pyd
10246 WARNING: lib not found: MSVCR90.dll dependency of C:\Python27\lib\site-packages\wx-3.0-msw\wx\_controls_.pyd
10309 WARNING: lib not found: MSVCR90.dll dependency of C:\Python27\lib\site-packages\win32\win32evtlog.pyd
10371 WARNING: lib not found: MSVCR90.dll dependency of C:\Python27\lib\site-packages\win32\win32wnet.pyd
10637 WARNING: lib not found: MSVCR90.dll dependency of C:\Python27\lib\site-packages\wx-3.0-msw\wx\_grid.pyd
10964 WARNING: lib not found: MSVCR90.dll dependency of C:\Python27\lib\site-packages\wx-3.0-msw\wx\_windows_.pyd
11042 WARNING: lib not found: MSVCR90.dll dependency of C:\Python27\DLLs\_hashlib.pyd
11105 WARNING: lib not found: MSVCR90.dll dependency of C:\Python27\DLLs\bz2.pyd
11198 WARNING: lib not found: MSVCR90.dll dependency of C:\Python27\DLLs\_ssl.pyd
11651 WARNING: lib not found: MSVCR90.dll dependency of C:\Python27\lib\site-packages\wx-3.0-msw\wx\_core_.pyd
11915 WARNING: lib not found: MSVCR90.dll dependency of C:\Python27\lib\site-packages\wx-3.0-msw\wx\_misc_.pyd
12009 WARNING: lib not found: MSVCR90.dll dependency of C:\Python27\DLLs\_ctypes.pyd
12290 WARNING: lib not found: MSVCR90.dll dependency of C:\Python27\lib\site-packages\wx-3.0-msw\wx\_gdi_.pyd
12336 WARNING: lib not found: MSVCR90.dll dependency of C:\Python27\DLLs\pyexpat.pyd
12461 WARNING: lib not found: MSVCR90.dll dependency of C:\Python27\lib\site-packages\win32\win32api.pyd
12539 WARNING: lib not found: MSVCR90.dll dependency of C:\Python27\DLLs\_sqlite3.pyd
12602 WARNING: lib not found: MSVCR90.dll dependency of C:\Python27\DLLs\_socket.pyd
12696 WARNING: lib not found: MSVCR90.dll dependency of C:\Windows\system32\pywintypes27.dll
15207 WARNING: lib not found: MSVCP90.dll dependency of C:\Python27\lib\site-packages\wx-3.0-msw\wx\wxmsw30u_core_vc90.dll
15239 WARNING: lib not found: MSVCR90.dll dependency of C:\Python27\lib\site-packages\wx-3.0-msw\wx\wxmsw30u_core_vc90.dll
15846 WARNING: lib not found: MSVCP90.dll dependency of C:\Python27\lib\site-packages\wx-3.0-msw\wx\wxmsw30u_adv_vc90.dll
15894 WARNING: lib not found: MSVCR90.dll dependency of C:\Python27\lib\site-packages\wx-3.0-msw\wx\wxmsw30u_adv_vc90.dll
16065 WARNING: lib not found: MSVCP90.dll dependency of C:\Python27\lib\site-packages\wx-3.0-msw\wx\wxbase30u_vc90.dll
16112 WARNING: lib not found: MSVCR90.dll dependency of C:\Python27\lib\site-packages\wx-3.0-msw\wx\wxbase30u_vc90.dll
16627 WARNING: lib not found: MSVCR90.dll dependency of C:\Python27\lib\site-packages\wx-3.0-msw\wx\wxmsw30u_html_vc90.dll
16658 WARNING: lib not found: MSVCP90.dll dependency of C:\Python27\lib\site-packages\wx-3.0-msw\wx\wxmsw30u_html_vc90.dll
16815 WARNING: lib not found: MSVCR90.dll dependency of C:\Python27\lib\site-packages\wx-3.0-msw\wx\wxbase30u_net_vc90.dll
16845 INFO: Using Python library C:\Windows\system32\python27.dll
Traceback (most recent call last):
File "C:\Python27\Scripts\pyinstaller-script.py", line 9, in <module>
load_entry_point('PyInstaller==2.1', 'console_scripts', 'pyinstaller')()
File "C:\Python27\lib\site-packages\PyInstaller\main.py", line 88, in run
run_build(opts, spec_file, pyi_config)
File "C:\Python27\lib\site-packages\PyInstaller\main.py", line 46, in run_build
PyInstaller.build.main(pyi_config, spec_file, **opts.__dict__)
File "C:\Python27\lib\site-packages\PyInstaller\build.py", line 1924, in main
build(specfile, kw.get('distpath'), kw.get('workpath'), kw.get('clean_build'))
File "C:\Python27\lib\site-packages\PyInstaller\build.py", line 1873, in build
execfile(spec)
File "build_exportmanager.spec", line 5, in <module>
hookspath=None)
File "C:\Python27\lib\site-packages\PyInstaller\build.py", line 446, in __init__
self.__postinit__()
File "C:\Python27\lib\site-packages\PyInstaller\build.py", line 309, in __postinit__
self.assemble()
File "C:\Python27\lib\site-packages\PyInstaller\build.py", line 700, in assemble
for ln in importTracker.getwarnings():
File "C:\Python27\lib\site-packages\PyInstaller\depend\imptracker.py", line 381, in getwarnings
for w in mod.warnings:
TypeError: iteration over non-sequence
This is my *.spec:
# -*- mode: python -*-
a = Analysis(['gui.py'],
pathex=['C:\dev_projects\ExportManagerNG\trunk\src', 'C:\dev_projects\common'],
hiddenimports=[],
hookspath=None)
for d in a.datas:
if 'pyconfig' in d[0]:
a.datas.remove(d)
break
#a.binaries = a.binaries - TOC([
# ('tcl85.dll', '', ''),
# ('tk85.dll', '', ''),
# ('_tkinter', '', '')])
#a.datas = [x for x in a.datas if not os.path.dirname(x[1]).startswith("C:\\Python27\\tcl")]
#a.datas = [x for x in a.datas if not os.path.dirname(x[1]).startswith("C:\\Python27\\tk")]
pyz = PYZ(a.pure)
exe = EXE(pyz,
a.scripts,
a.binaries,
a.zipfiles,
a.datas,
name=os.path.join('../bin', 'exportmanager.exe'),
debug=False,
strip=None,
upx=True,
console=False )
I'm coding on Ubuntu - only building the executable in a virtual Win 7!
This is a specific version bug, i fixed it from a develop brunch:
git clone https://github.com/pyinstaller/pyinstaller.git
cd pyinstaller/
sudo python setup.py install