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?
Related
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
I am new to Python, just installed Python 3.9.1 and PyCharm IDE community edition (I have a license for IntelliJ).
I created my first project "Hello World" program in a project name "test1" which has 1 file main.py:
print("Hello World")
input()
I opened a command-line (cmd.exe) with Administrator permissions and run pip install pyinstaller to install pyInstaller, then navigated to my project d:\development\PyCharmProjects\pythonProject\test1 and run pyinstaller main.py build to create and executable file (main.exe).
The building FAILS with PermissionError: [Errno 13] Permission denied: 'D:\\development\\PycharmProjects\\pythonProject\\test1\\build'
here is the log of the build:
D:\development\PycharmProjects\pythonProject\test1>pyinstaller main.py build
52 INFO: PyInstaller: 4.2
52 INFO: Python: 3.9.1
53 INFO: Platform: Windows-10-10.0.19041-SP0
54 INFO: wrote D:\development\PycharmProjects\pythonProject\test1\main.spec
57 INFO: UPX is not available.
58 INFO: Extending PYTHONPATH with paths
['D:\\development\\PycharmProjects\\pythonProject\\test1',
'D:\\development\\PycharmProjects\\pythonProject\\test1',
'D:\\development\\PycharmProjects\\pythonProject\\test1']
63 INFO: checking Analysis
64 INFO: Building Analysis because Analysis-00.toc is non existent
64 INFO: Initializing module dependency graph...
65 INFO: Caching module graph hooks...
70 WARNING: Several hooks defined for module 'win32ctypes.core'. Please
take care they do not conflict.
74 INFO: Analyzing base_library.zip ...
2163 INFO: Processing pre-find module path hook distutils from
'd:\\devtools\\python\\python39\\lib\\site-packages\\PyInstaller\\hooks\\pre_find_module_path\\hook-distutils.py'.
2164 INFO: distutils: retargeting to non-venv dir 'd:\\devtools\\python\\python39\\lib'
3793 INFO: Caching module dependency graph...
3884 INFO: running Analysis Analysis-00.toc
3886 INFO: Adding Microsoft.Windows.Common-Controls to dependent assemblies of final executable
required by d:\devtools\python\python39\python.exe
3935 WARNING: lib not found: api-ms-win-core-path-l1-1-0.dll dependency of d:\devtools\python\python39\python39.dll
3968 INFO: Analyzing D:\development\PycharmProjects\pythonProject\test1\main.py
3970 INFO: Analyzing D:\development\PycharmProjects\pythonProject\test1\build
Traceback (most recent call last):
File "d:\devtools\python\python39\lib\runpy.py", line 197, in _run_module_as_main
return _run_code(code, main_globals, None,
File "d:\devtools\python\python39\lib\runpy.py", line 87, in _run_code
exec(code, run_globals)
File "D:\devtools\Python\Python39\Scripts\pyinstaller.exe\__main__.py", line 7, in <module>
File "d:\devtools\python\python39\lib\site-packages\PyInstaller\__main__.py", line 114, in run
run_build(pyi_config, spec_file, **vars(args))
File "d:\devtools\python\python39\lib\site-packages\PyInstaller\__main__.py", line 65, in run_build
PyInstaller.building.build_main.main(pyi_config, spec_file, **kwargs)
File "d:\devtools\python\python39\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 "d:\devtools\python\python39\lib\site-packages\PyInstaller\building\build_main.py", line 672, in build
exec(code, spec_namespace)
File "D:\development\PycharmProjects\pythonProject\test1\main.spec", line 6, in <module>
a = Analysis(['main.py', 'build'],
File "d:\devtools\python\python39\lib\site-packages\PyInstaller\building\build_main.py", line 242, in __init__
self.__postinit__()
File "d:\devtools\python\python39\lib\site-packages\PyInstaller\building\datastruct.py", line 160, in __postinit__
self.assemble()
File "d:\devtools\python\python39\lib\site-packages\PyInstaller\building\build_main.py", line 414, in assemble
priority_scripts.append(self.graph.run_script(script))
File "d:\devtools\python\python39\lib\site-packages\PyInstaller\depend\analysis.py", line 320, in run_script
return super(PyiModuleGraph, self).run_script(
File "d:\devtools\python\python39\lib\site-packages\PyInstaller\lib\modulegraph\modulegraph.py", line 1407, in run_script
with open(pathname, 'rb') as fp:
PermissionError: [Errno 13] Permission denied: 'D:\\development\\PycharmProjects\\pythonProject\\test1\\build'
I am using:
Windows 10 Home,
Python 3.9.1
PyCharm 2020.3 Community Edition
pyinstaller 4.2
PermissionError: [Errno 13] Permission denied
PermissionError: [Errno 13] in python
PermissionError: [Errno 13] Permission denied: pyinstaller.exe/TKinter
I tried to do it without the build, and the executable main.exe was created, but when I run it I get another error:
What am I doing wrong?
Am I creating the executable correctly?
I would appreciate any assistance.
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'm trying to create an executable file using PyInstaller with my script. For reference, I am using Windows 10 with Python 3.8.0 and PyInstaller version 3.5.
My script is called hello_world.py and it is saved in it's own folder.
print("Hello World!")
In command prompt, I navigate to the folder that hello_world.py is in and run:
pyinstaller hello_world.py
And this is the output:
46 INFO: PyInstaller: 3.5
46 INFO: Python: 3.8.0
46 INFO: Platform: Windows-10-10.0.17763-SP0
62 INFO: wrote F:\Python\Python Scripts\Pyinstaller\Py installer test\hello_world.spec
78 INFO: UPX is not available.
78 INFO: Extending PYTHONPATH with paths
['F:\\Python\\Python Scripts\\Pyinstaller\\Py installer test',
'F:\\Python\\Python Scripts\\Pyinstaller\\Py installer test']
78 INFO: checking Analysis
78 INFO: Building Analysis because Analysis-00.toc is non existent
78 INFO: Initializing module dependency graph...
93 INFO: Initializing module graph hooks...
93 INFO: Analyzing base_library.zip ...
3592 INFO: running Analysis Analysis-00.toc
3592 INFO: Adding Microsoft.Windows.Common-Controls to dependent assemblies of final executable
required by c:\users\l&a\appdata\local\programs\python\python38\python.exe
4014 INFO: Caching module hooks...
4014 INFO: Analyzing F:\Python\Python Scripts\Pyinstaller\Py installer test\hello_world.py
4045 INFO: Loading module hooks...
4045 INFO: Loading module hook "hook-encodings.py"...
4202 INFO: Loading module hook "hook-pydoc.py"...
4202 INFO: Loading module hook "hook-xml.py"...
4405 INFO: Looking for ctypes DLLs
4420 INFO: Analyzing run-time hooks ...
4420 INFO: Including run-time hook 'pyi_rth_multiprocessing.py'
4420 INFO: Looking for dynamic libraries
5592 INFO: Looking for eggs
5592 INFO: Using Python library c:\users\l&a\appdata\local\programs\python\python38\python38.dll
5592 INFO: Found binding redirects:
[]
5592 INFO: Warnings written to F:\Python\Python Scripts\Pyinstaller\Py installer test\build\hello_world\warn-hello_world.txt
5670 INFO: Graph cross-reference written to F:\Python\Python Scripts\Pyinstaller\Py installer test\build\hello_world\xref-hello_world.html
5686 INFO: checking PYZ
5686 INFO: Building PYZ because PYZ-00.toc is non existent
5686 INFO: Building PYZ (ZlibArchive) F:\Python\Python Scripts\Pyinstaller\Py installer test\build\hello_world\PYZ-00.pyz
Traceback (most recent call last):
File "c:\users\l&a\appdata\local\programs\python\python38\lib\runpy.py", line 192, in _run_module_as_main
return _run_code(code, main_globals, None,
File "c:\users\l&a\appdata\local\programs\python\python38\lib\runpy.py", line 85, in _run_code
exec(code, run_globals)
File "C:\Users\L&A\AppData\Local\Programs\Python\Python38\Scripts\pyinstaller.exe\__main__.py", line 7, in <module>
File "c:\users\l&a\appdata\local\programs\python\python38\lib\site-packages\PyInstaller\__main__.py", line 111, in run
run_build(pyi_config, spec_file, **vars(args))
File "c:\users\l&a\appdata\local\programs\python\python38\lib\site-packages\PyInstaller\__main__.py", line 63, in run_build
PyInstaller.building.build_main.main(pyi_config, spec_file, **kwargs)
File "c:\users\l&a\appdata\local\programs\python\python38\lib\site-packages\PyInstaller\building\build_main.py", line 844, in main
build(specfile, kw.get('distpath'), kw.get('workpath'), kw.get('clean_build'))
File "c:\users\l&a\appdata\local\programs\python\python38\lib\site-packages\PyInstaller\building\build_main.py", line 791, in build
exec(code, spec_namespace)
File "F:\Python\Python Scripts\Pyinstaller\Py installer test\hello_world.spec", line 18, in <module>
pyz = PYZ(a.pure, a.zipped_data,
File "c:\users\l&a\appdata\local\programs\python\python38\lib\site-packages\PyInstaller\building\api.py", line 98, in __init__
self.__postinit__()
File "c:\users\l&a\appdata\local\programs\python\python38\lib\site-packages\PyInstaller\building\datastruct.py", line 158, in __postinit__
self.assemble()
File "c:\users\l&a\appdata\local\programs\python\python38\lib\site-packages\PyInstaller\building\api.py", line 128, in assemble
self.code_dict = {
File "c:\users\l&a\appdata\local\programs\python\python38\lib\site-packages\PyInstaller\building\api.py", line 129, in <dictcomp>
key: strip_paths_in_code(code)
File "c:\users\l&a\appdata\local\programs\python\python38\lib\site-packages\PyInstaller\building\utils.py", line 652, in strip_paths_in_code
consts = tuple(
File "c:\users\l&a\appdata\local\programs\python\python38\lib\site-packages\PyInstaller\building\utils.py", line 653, in <genexpr>
strip_paths_in_code(const_co, new_filename)
File "c:\users\l&a\appdata\local\programs\python\python38\lib\site-packages\PyInstaller\building\utils.py", line 660, in strip_paths_in_code
return code_func(co.co_argcount, co.co_kwonlyargcount, co.co_nlocals, co.co_stacksize,
TypeError: an integer is required (got type bytes)
This creates folders called 'dist' and 'build' and a file called 'hello_world.spec' but the 'dist' folder is empty. What is going wrong?
I search for
TypeError: an integer is required (got type bytes)
Did you read this?
I had this issue in the past, can you please perform the follwing:
open Anaconda prompt or any other IDE per example spyder or Atom terminal, command line as admin and Navigate to the folder where the .py located and run the command as bellow:
In my example the file I want to compile it is getwindowsversion.py
this is will create just standalone .exe can be used,
pyinstaller --onefile getwindowsversion.py
if you want to create regular build,
pyinstaller getwindowsversion.py
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