Pyinstaller Unable to Convert Fully - python
Specs
Python Version 3.9.6 (DL'd and installed from Python's website, not
Microsoft Store etc.)
Windows 10
Problem
I've tried to package python file in cmd using pyinstaller filename.py and pyinstaller --onefile Simple.py to *.exe which does not seem to work:
73 INFO: PyInstaller: 4.3 73 INFO: Python: 3.9.5 125 INFO: Platform:
Windows-10-10.0.19043-SP0 126 INFO: wrote
C:\Users\Baven\Desktop\Forexe\Simple.spec 186 INFO: UPX is available.
188 INFO: Extending PYTHONPATH with paths
['C:\Users\Baven\Desktop\Forexe',
'C:\Users\Baven\Desktop\Forexe'] 197 INFO: checking Analysis 197
INFO: Building Analysis because Analysis-00.toc is non existent 197
INFO: Initializing module dependency graph... 200 INFO: Caching module
graph hooks... 215 INFO: Analyzing base_library.zip ... 2561 INFO:
Processing pre-find module path hook distutils from
'C:\Users\Baven\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.9_qbz5n2kfra8p0\LocalCache\local-packages\Python39\site-packages\PyInstaller\hooks\pre_find_module_path\hook-distutils.py'.
2561 INFO: distutils: retargeting to non-venv dir 'C:\Program
Files\WindowsApps\PythonSoftwareFoundation.Python.3.9_3.9.1520.0_x64__qbz5n2kfra8p0\lib'
4598 INFO: Caching module dependency graph... 4789 INFO: running
Analysis Analysis-00.toc Traceback (most recent call last): File
"C:\Users\Baven\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.9_qbz5n2kfra8p0\LocalCache\local-packages\Python39\site-packages\win32ctypes\pywin32\pywintypes.py",
line 35, in pywin32error
yield File "C:\Users\Baven\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.9_qbz5n2kfra8p0\LocalCache\local-packages\Python39\site-packages\win32ctypes\pywin32\win32api.py",
line 43, in LoadLibraryEx
return _dll._LoadLibraryEx(fileName, 0, flags) File "C:\Users\Baven\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.9_qbz5n2kfra8p0\LocalCache\local-packages\Python39\site-packages\win32ctypes\core\ctypes_util.py",
line 42, in check_null
raise make_error(function, function_name) OSError: [WinError 1920] The file cannot be accessed by the system.
During handling of the above exception, another exception occurred:
Traceback (most recent call last): File "C:\Program
Files\WindowsApps\PythonSoftwareFoundation.Python.3.9_3.9.1520.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.1520.0_x64__qbz5n2kfra8p0\lib\runpy.py",
line 87, in run_code
exec(code, run_globals) File "C:\Users\Baven\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.9_qbz5n2kfra8p0\LocalCache\local-packages\Python39\Scripts\pyinstaller.exe_main.py",
line 7, in File
"C:\Users\Baven\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.9_qbz5n2kfra8p0\LocalCache\local-packages\Python39\site-packages\PyInstaller_main.py",
line 114, in run
run_build(pyi_config, spec_file, **vars(args)) File "C:\Users\Baven\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.9_qbz5n2kfra8p0\LocalCache\local-packages\Python39\site-packages\PyInstaller_main.py",
line 65, in run_build
PyInstaller.building.build_main.main(pyi_config, spec_file, **kwargs) File "C:\Users\Baven\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.9_qbz5n2kfra8p0\LocalCache\local-packages\Python39\site-packages\PyInstaller\building\build_main.py",
line 737, in main
build(specfile, kw.get('distpath'), kw.get('workpath'), kw.get('clean_build')) File
"C:\Users\Baven\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.9_qbz5n2kfra8p0\LocalCache\local-packages\Python39\site-packages\PyInstaller\building\build_main.py",
line 684, in build
exec(code, spec_namespace) File "C:\Users\Baven\Desktop\Forexe\Simple.spec", line 7, in
a = Analysis(['Simple.py'], File "C:\Users\Baven\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.9_qbz5n2kfra8p0\LocalCache\local-packages\Python39\site-packages\PyInstaller\building\build_main.py",
line 242, in init
self.postinit() File "C:\Users\Baven\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.9_qbz5n2kfra8p0\LocalCache\local-packages\Python39\site-packages\PyInstaller\building\datastruct.py",
line 160, in postinit
self.assemble() File "C:\Users\Baven\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.9_qbz5n2kfra8p0\LocalCache\local-packages\Python39\site-packages\PyInstaller\building\build_main.py",
line 391, in assemble
self.binaries.extend(bindepend.Dependencies([('', python, '')], File
"C:\Users\Baven\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.9_qbz5n2kfra8p0\LocalCache\local-packages\Python39\site-packages\PyInstaller\depend\bindepend.py",
line 224, in Dependencies
for ftocnm, fn in getAssemblyFiles(pth, manifest, redirects): File
"C:\Users\Baven\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.9_qbz5n2kfra8p0\LocalCache\local-packages\Python39\site-packages\PyInstaller\depend\bindepend.py",
line 403, in getAssemblyFiles
for assembly in getAssemblies(pth): File "C:\Users\Baven\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.9_qbz5n2kfra8p0\LocalCache\local-packages\Python39\site-packages\PyInstaller\depend\bindepend.py",
line 354, in getAssemblies
res = GetManifestResources(pth) File "C:\Users\Baven\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.9_qbz5n2kfra8p0\LocalCache\local-packages\Python39\site-packages\PyInstaller\utils\win32\winmanifest.py",
line 1016, in GetManifestResources
return winresource.GetResources(filename, [RT_MANIFEST], names, languages) File
"C:\Users\Baven\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.9_qbz5n2kfra8p0\LocalCache\local-packages\Python39\site-packages\PyInstaller\utils\win32\winresource.py",
line 170, in GetResources
hsrc = win32api.LoadLibraryEx(filename, 0, LOAD_LIBRARY_AS_DATAFILE) File
"C:\Users\Baven\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.9_qbz5n2kfra8p0\LocalCache\local-packages\Python39\site-packages\win32ctypes\pywin32\win32api.py",
line 43, in LoadLibraryEx
return _dll._LoadLibraryEx(fileName, 0, flags) File "C:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.9_3.9.1520.0_x64__qbz5n2kfra8p0\lib\contextlib.py",
line 135, in exit
self.gen.throw(type, value, traceback) File "C:\Users\Baven\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.9_qbz5n2kfra8p0\LocalCache\local-packages\Python39\site-packages\win32ctypes\pywin32\pywintypes.py",
line 37, in pywin32error
raise error(exception.winerror, exception.function, exception.strerror) win32ctypes.pywin32.pywintypes.error: (1920,
'LoadLibraryExW', 'The file cannot be accessed by the system.')
C:\Users\Baven\Desktop\Forexe>pyinstaller --onefile Simple.py 72 INFO:
PyInstaller: 4.3 72 INFO: Python: 3.9.5 122 INFO: Platform:
Windows-10-10.0.19043-SP0 123 INFO: wrote
C:\Users\Baven\Desktop\Forexe\Simple.spec 166 INFO: UPX is available.
168 INFO: Extending PYTHONPATH with paths
['C:\Users\Baven\Desktop\Forexe',
'C:\Users\Baven\Desktop\Forexe'] 177 INFO: checking Analysis 177
INFO: Building Analysis because Analysis-00.toc is non existent 178
INFO: Initializing module dependency graph... 181 INFO: Caching module
graph hooks... 196 INFO: Analyzing base_library.zip ... 2579 INFO:
Processing pre-find module path hook distutils from
'C:\Users\Baven\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.9_qbz5n2kfra8p0\LocalCache\local-packages\Python39\site-packages\PyInstaller\hooks\pre_find_module_path\hook-distutils.py'.
2580 INFO: distutils: retargeting to non-venv dir 'C:\Program
Files\WindowsApps\PythonSoftwareFoundation.Python.3.9_3.9.1520.0_x64__qbz5n2kfra8p0\lib'
4596 INFO: Caching module dependency graph... 4777 INFO: running
Analysis Analysis-00.toc Traceback (most recent call last): File
"C:\Users\Baven\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.9_qbz5n2kfra8p0\LocalCache\local-packages\Python39\site-packages\win32ctypes\pywin32\pywintypes.py",
line 35, in pywin32error
yield File "C:\Users\Baven\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.9_qbz5n2kfra8p0\LocalCache\local-packages\Python39\site-packages\win32ctypes\pywin32\win32api.py",
line 43, in LoadLibraryEx
return _dll._LoadLibraryEx(fileName, 0, flags) File "C:\Users\Baven\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.9_qbz5n2kfra8p0\LocalCache\local-packages\Python39\site-packages\win32ctypes\core\ctypes_util.py",
line 42, in check_null
raise make_error(function, function_name) OSError: [WinError 1920] The file cannot be accessed by the system.
During handling of the above exception, another exception occurred:
Traceback (most recent call last): File "C:\Program
Files\WindowsApps\PythonSoftwareFoundation.Python.3.9_3.9.1520.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.1520.0_x64__qbz5n2kfra8p0\lib\runpy.py",
line 87, in run_code
exec(code, run_globals) File "C:\Users\Baven\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.9_qbz5n2kfra8p0\LocalCache\local-packages\Python39\Scripts\pyinstaller.exe_main.py",
line 7, in File
"C:\Users\Baven\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.9_qbz5n2kfra8p0\LocalCache\local-packages\Python39\site-packages\PyInstaller_main.py",
line 114, in run
run_build(pyi_config, spec_file, **vars(args)) File "C:\Users\Baven\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.9_qbz5n2kfra8p0\LocalCache\local-packages\Python39\site-packages\PyInstaller_main.py",
line 65, in run_build
PyInstaller.building.build_main.main(pyi_config, spec_file, **kwargs) File "C:\Users\Baven\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.9_qbz5n2kfra8p0\LocalCache\local-packages\Python39\site-packages\PyInstaller\building\build_main.py",
line 737, in main
build(specfile, kw.get('distpath'), kw.get('workpath'), kw.get('clean_build')) File
"C:\Users\Baven\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.9_qbz5n2kfra8p0\LocalCache\local-packages\Python39\site-packages\PyInstaller\building\build_main.py",
line 684, in build
exec(code, spec_namespace) File "C:\Users\Baven\Desktop\Forexe\Simple.spec", line 7, in
a = Analysis(['Simple.py'], File "C:\Users\Baven\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.9_qbz5n2kfra8p0\LocalCache\local-packages\Python39\site-packages\PyInstaller\building\build_main.py",
line 242, in init
self.postinit() File "C:\Users\Baven\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.9_qbz5n2kfra8p0\LocalCache\local-packages\Python39\site-packages\PyInstaller\building\datastruct.py",
line 160, in postinit
self.assemble() File "C:\Users\Baven\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.9_qbz5n2kfra8p0\LocalCache\local-packages\Python39\site-packages\PyInstaller\building\build_main.py",
line 391, in assemble
self.binaries.extend(bindepend.Dependencies([('', python, '')], File
"C:\Users\Baven\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.9_qbz5n2kfra8p0\LocalCache\local-packages\Python39\site-packages\PyInstaller\depend\bindepend.py",
line 224, in Dependencies
for ftocnm, fn in getAssemblyFiles(pth, manifest, redirects): File
"C:\Users\Baven\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.9_qbz5n2kfra8p0\LocalCache\local-packages\Python39\site-packages\PyInstaller\depend\bindepend.py",
line 403, in getAssemblyFiles
for assembly in getAssemblies(pth): File "C:\Users\Baven\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.9_qbz5n2kfra8p0\LocalCache\local-packages\Python39\site-packages\PyInstaller\depend\bindepend.py",
line 354, in getAssemblies
res = GetManifestResources(pth) File "C:\Users\Baven\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.9_qbz5n2kfra8p0\LocalCache\local-packages\Python39\site-packages\PyInstaller\utils\win32\winmanifest.py",
line 1016, in GetManifestResources
return winresource.GetResources(filename, [RT_MANIFEST], names, languages) File
"C:\Users\Baven\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.9_qbz5n2kfra8p0\LocalCache\local-packages\Python39\site-packages\PyInstaller\utils\win32\winresource.py",
line 170, in GetResources
hsrc = win32api.LoadLibraryEx(filename, 0, LOAD_LIBRARY_AS_DATAFILE) File
"C:\Users\Baven\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.9_qbz5n2kfra8p0\LocalCache\local-packages\Python39\site-packages\win32ctypes\pywin32\win32api.py",
line 43, in LoadLibraryEx
return _dll._LoadLibraryEx(fileName, 0, flags) File "C:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.9_3.9.1520.0_x64__qbz5n2kfra8p0\lib\contextlib.py",
line 135, in exit
self.gen.throw(type, value, traceback) File "C:\Users\Baven\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.9_qbz5n2kfra8p0\LocalCache\local-packages\Python39\site-packages\win32ctypes\pywin32\pywintypes.py",
line 37, in pywin32error
raise error(exception.winerror, exception.function, exception.strerror) win32ctypes.pywin32.pywintypes.error: (1920,
'LoadLibraryExW', 'The file cannot be accessed by the system.')
What I've also done and retried to package, all of which led to the outcome above (except the UPX)
Reinstalled
Restarted (also updated Windows)
Trying the conversion in virtual environment
Fixed the UPX (186 INFO: UPX is available.) by downloading and placing upx.exe in the *.py folder
Disabled (off) both (python & python3) App Installer in App execution aliases
What I find strange
Python version shown in cmd is still 3.9.5; also 3.9.5 in IDLE which changed to 3.9.6 after rebooting my PC
Other Python users can convert without issue
WindowsApps folder access returned none (e.g. return _run_code(code, main_globals, None, File "C:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.9_3.9.1520.0_x64__qbz5n2kfra8p0\lib\runpy.py",)
When manually accessing the WindowApps folder, the notification "You don't currently have permission to access this folder." is shown. If that is the root cause, anyway to allow Python to access it?
Here's the link to the python file and what was converted: https://drive.google.com/file/d/1L8vVEc4z6LYxgN6XHWwJlujVsicMgfMy/view
I have also tried the below code as a *.py file:
#!/usr/bin/python
import sqlite3
conn = sqlite3.connect('test.db')
print "Opened database successfully";
The below was the outcome:
Traceback (most recent call last): File
"C:\Users\Baven\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.9_qbz5n2kfra8p0\LocalCache\local-packages\Python39\site-packages\mysql\connector\network.py",
line 574, in open_connection
self.sock.connect(sockaddr) ConnectionRefusedError: [WinError 10061] No connection could be made because the target machine actively
refused it
During handling of the above exception, another exception occurred:
Traceback (most recent call last): File "C:\Program
Files\WindowsApps\PythonSoftwareFoundation.Python.3.9_3.9.1520.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.1520.0_x64__qbz5n2kfra8p0\lib\runpy.py",
line 87, in run_code
exec(code, run_globals) File "c:\Users\Baven.vscode\extensions\ms-python.python-2021.6.944021595\pythonFiles\lib\python\debugpy_main.py",
line 45, in
cli.main() File "c:\Users\Baven.vscode\extensions\ms-python.python-2021.6.944021595\pythonFiles\lib\python\debugpy/..\debugpy\server\cli.py",
line 444, in main
run() File "c:\Users\Baven.vscode\extensions\ms-python.python-2021.6.944021595\pythonFiles\lib\python\debugpy/..\debugpy\server\cli.py",
line 285, in run_file
runpy.run_path(target_as_str, run_name=compat.force_str("main")) File "C:\Program
Files\WindowsApps\PythonSoftwareFoundation.Python.3.9_3.9.1520.0_x64__qbz5n2kfra8p0\lib\runpy.py",
line 268, in run_path
return _run_module_code(code, init_globals, run_name, File "C:\Program
Files\WindowsApps\PythonSoftwareFoundation.Python.3.9_3.9.1520.0_x64__qbz5n2kfra8p0\lib\runpy.py",
line 97, in _run_module_code
_run_code(code, mod_globals, init_globals, File "C:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.9_3.9.1520.0_x64__qbz5n2kfra8p0\lib\runpy.py",
line 87, in run_code
exec(code, run_globals) File "c:\Users\Baven\Desktop\demo_mysql_test.py", line 3, in
mydb = mysql.connector.connect( File "C:\Users\Baven\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.9_qbz5n2kfra8p0\LocalCache\local-packages\Python39\site-packages\mysql\connector_init.py",
line 273, in connect
return MySQLConnection(*args, **kwargs) File "C:\Users\Baven\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.9_qbz5n2kfra8p0\LocalCache\local-packages\Python39\site-packages\mysql\connector\connection.py",
line 107, in init
self.connect(**kwargs) File "C:\Users\Baven\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.9_qbz5n2kfra8p0\LocalCache\local-packages\Python39\site-packages\mysql\connector\abstracts.py",
line 1003, in connect
self._open_connection() File "C:\Users\Baven\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.9_qbz5n2kfra8p0\LocalCache\local-packages\Python39\site-packages\mysql\connector\connection.py",
line 350, in _open_connection
self._socket.open_connection() File "C:\Users\Baven\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.9_qbz5n2kfra8p0\LocalCache\local-packages\Python39\site-packages\mysql\connector\network.py",
line 576, in open_connection
raise errors.InterfaceError( mysql.connector.errors.InterfaceError: 2003: Can't connect to MySQL
server on 'localhost:3306' (10061 No connection could be made because
the target machine actively refused it)
They (both pyinstaller and SQL) seem to be connected to one root cause.
This fixed the issue:
python3 -m pip install https://github.com/pyinstaller/pyinstaller/archive/develop.zip
Related
python 3.10 - no libpython3.10.so - pyinstaller fails
I am having a problem with pyinstaller with python 3.10.5 on Ubuntu 18.04. I built Python 3.10.5 from source. When I run pyinstaller with 3.10 I get the error below. When I run with 3.6 I get: 08:32:09 44362 INFO: Python library not in binary dependencies. Doing additional searching... 08:32:09 44394 INFO: Using Python library /usr/lib/x86_64-linux-gnu/libpython3.6m.so.1.0 Looking on my machine there is no libpython3.10m.so, so I wonder if this is the problem? (There is a libpython3.10.a) Would having a libpython3.10m.so fix the problem? Where do I get one from or how do I build one? pyinstaller/python 3.10 errors: INFO: Python library not in binary dependencies. Doing additional searching... Traceback (most recent call last): File "/usr/local/lib/python3.10/runpy.py", line 196, in _run_module_as_main return _run_code(code, main_globals, None, File "/usr/local/lib/python3.10/runpy.py", line 86, in _run_code exec(code, run_globals) File "/home/jenkins/.local/lib/python3.10/site-packages/PyInstaller/__main__.py", line 134, in <module> run() File "/home/jenkins/.local/lib/python3.10/site-packages/PyInstaller/__main__.py", line 124, in run run_build(pyi_config, spec_file, **vars(args)) File "/home/jenkins/.local/lib/python3.10/site-packages/PyInstaller/__main__.py", line 58, in run_build PyInstaller.building.build_main.main(pyi_config, spec_file, **kwargs) File "/home/jenkins/.local/lib/python3.10/site-packages/PyInstaller/building/build_main.py", line 782, in main build(specfile, kw.get('distpath'), kw.get('workpath'), kw.get('clean_build')) File "/home/jenkins/.local/lib/python3.10/site-packages/PyInstaller/building/build_main.py", line 714, in build exec(code, spec_namespace) File "/home/jenkins/workspace/TOOLS/tools-helper-build-python3-linux/hosttools/python/maxwell_dm.spec", line 7, in <module> a = Analysis(['maxwell_dm_gui/app_entry.py'], File "/home/jenkins/.local/lib/python3.10/site-packages/PyInstaller/building/build_main.py", line 277, in __init__ self.__postinit__() File "/home/jenkins/.local/lib/python3.10/site-packages/PyInstaller/building/datastruct.py", line 155, in __postinit__ self.assemble() File "/home/jenkins/.local/lib/python3.10/site-packages/PyInstaller/building/build_main.py", line 501, in assemble self._check_python_library(self.binaries) File "/home/jenkins/.local/lib/python3.10/site-packages/PyInstaller/building/build_main.py", line 605, in _check_python_library python_lib = bindepend.get_python_library_path() File "/home/jenkins/.local/lib/python3.10/site-packages/PyInstaller/depend/bindepend.py", line 897, in get_python_library_path python_libname = findLibrary(name) File "/home/jenkins/.local/lib/python3.10/site-packages/PyInstaller/depend/bindepend.py", line 775, in findLibrary lib = _which_library(name, paths) File "/home/jenkins/.local/lib/python3.10/site-packages/PyInstaller/depend/bindepend.py", line 806, in _which_library for _path in os.listdir(path): FileNotFoundError: [Errno 2] No such file or directory: '/usr/lib64'
Unable to convert py files to exe using pyinstaller
I was trying to convert my python program to a standalone executable file. However, after running pyinstaller, it runs into an error and doesn't output the file. This is the log: 60 INFO: PyInstaller: 3.6 60 INFO: Python: 3.8.3 60 INFO: Platform: Windows-10-10.0.18362-SP0 61 INFO: wrote C:\Users\username\Downloads\pip\test.spec 63 INFO: UPX is not available. 64 INFO: Extending PYTHONPATH with paths ['C:\\Users\\username\\Downloads\\pip', 'C:\\Users\\username\\Downloads\\pip'] 64 INFO: checking Analysis 65 INFO: Building Analysis because Analysis-00.toc is non existent 65 INFO: Initializing module dependency graph... 67 INFO: Caching module graph hooks... 71 INFO: Analyzing base_library.zip ... 1900 INFO: Processing pre-find module path hook distutils 1900 INFO: distutils: retargeting to non-venv dir 'C:\\Program Files\\WindowsApps\\PythonSoftwareFoundation.Python.3.8_3.8.1008.0_x64__qbz5n2kfra8p0\\lib' 3116 INFO: Caching module dependency graph... 3200 INFO: running Analysis Analysis-00.toc Traceback (most recent call last): File "C:\Users\username\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.8_qbz5n2kfra8p0\LocalCache\local-packages\Python38\site-packages\win32ctypes\pywin32\pywintypes.py", line 35, in pywin32error yield File "C:\Users\username\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.8_qbz5n2kfra8p0\LocalCache\local-packages\Python38\site-packages\win32ctypes\pywin32\win32api.py", line 43, in LoadLibraryEx return _dll._LoadLibraryEx(fileName, 0, flags) File "C:\Users\username\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.8_qbz5n2kfra8p0\LocalCache\local-packages\Python38\site-packages\win32ctypes\core\cffi\_dll.py", line 23, in _LoadLibraryEx result = check_null( File "C:\Users\username\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.8_qbz5n2kfra8p0\LocalCache\local-packages\Python38\site-packages\win32ctypes\core\cffi\_util.py", line 81, in __call__ self._raise_error(function_name) File "C:\Users\username\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.8_qbz5n2kfra8p0\LocalCache\local-packages\Python38\site-packages\win32ctypes\core\cffi\_util.py", line 92, in _raise_error raise exception OSError: [WinError 1920] The file cannot be accessed by the system During handling of the above exception, another exception occurred: Traceback (most recent call last): File "C:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.8_3.8.1008.0_x64__qbz5n2kfra8p0\lib\runpy.py", line 194, in _run_module_as_main return _run_code(code, main_globals, None, File "C:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.8_3.8.1008.0_x64__qbz5n2kfra8p0\lib\runpy.py", line 87, in _run_code exec(code, run_globals) File "C:\Users\username\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.8_qbz5n2kfra8p0\LocalCache\local-packages\Python38\Scripts\pyinstaller.exe\__main__.py", line 9, in <module> File "C:\Users\username\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.8_qbz5n2kfra8p0\LocalCache\local-packages\Python38\site-packages\PyInstaller\__main__.py", line 114, in run run_build(pyi_config, spec_file, **vars(args)) File "C:\Users\username\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.8_qbz5n2kfra8p0\LocalCache\local-packages\Python38\site-packages\PyInstaller\__main__.py", line 65, in run_build PyInstaller.building.build_main.main(pyi_config, spec_file, **kwargs) File "C:\Users\username\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.8_qbz5n2kfra8p0\LocalCache\local-packages\Python38\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:\Users\username\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.8_qbz5n2kfra8p0\LocalCache\local-packages\Python38\site-packages\PyInstaller\building\build_main.py", line 681, in build exec(code, spec_namespace) File "C:\Users\username\Downloads\pip\test.spec", line 6, in <module> a = Analysis(['test.py'], File "C:\Users\username\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.8_qbz5n2kfra8p0\LocalCache\local-packages\Python38\site-packages\PyInstaller\building\build_main.py", line 244, in __init__ self.__postinit__() File "C:\Users\username\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.8_qbz5n2kfra8p0\LocalCache\local-packages\Python38\site-packages\PyInstaller\building\datastruct.py", line 160, in __postinit__ self.assemble() File "C:\Users\username\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.8_qbz5n2kfra8p0\LocalCache\local-packages\Python38\site-packages\PyInstaller\building\build_main.py", line 393, in assemble self.binaries.extend(bindepend.Dependencies([('', python, '')], File "C:\Users\username\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.8_qbz5n2kfra8p0\LocalCache\local-packages\Python38\site-packages\PyInstaller\depend\bindepend.py", line 228, in Dependencies for ftocnm, fn in getAssemblyFiles(pth, manifest, redirects): File "C:\Users\username\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.8_qbz5n2kfra8p0\LocalCache\local-packages\Python38\site-packages\PyInstaller\depend\bindepend.py", line 404, in getAssemblyFiles for assembly in getAssemblies(pth): File "C:\Users\username\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.8_qbz5n2kfra8p0\LocalCache\local-packages\Python38\site-packages\PyInstaller\depend\bindepend.py", line 355, in getAssemblies res = GetManifestResources(pth) File "C:\Users\username\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.8_qbz5n2kfra8p0\LocalCache\local-packages\Python38\site-packages\PyInstaller\utils\win32\winmanifest.py", line 1007, in GetManifestResources return winresource.GetResources(filename, [RT_MANIFEST], names, languages) File "C:\Users\username\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.8_qbz5n2kfra8p0\LocalCache\local-packages\Python38\site-packages\PyInstaller\utils\win32\winresource.py", line 170, in GetResources hsrc = win32api.LoadLibraryEx(filename, 0, LOAD_LIBRARY_AS_DATAFILE) File "C:\Users\username\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.8_qbz5n2kfra8p0\LocalCache\local-packages\Python38\site-packages\win32ctypes\pywin32\win32api.py", line 43, in LoadLibraryEx return _dll._LoadLibraryEx(fileName, 0, flags) File "C:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.8_3.8.1008.0_x64__qbz5n2kfra8p0\lib\contextlib.py", line 131, in __exit__ self.gen.throw(type, value, traceback) File "C:\Users\username\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.8_qbz5n2kfra8p0\LocalCache\local-packages\Python38\site-packages\win32ctypes\pywin32\pywintypes.py", line 37, in pywin32error raise error(exception.winerror, exception.function, exception.strerror) win32ctypes.pywin32.pywintypes.error: (1920, 'LoadLibraryEx', 'The file cannot be accessed by the system') I also tried using brentvollebregt's auto-py-to-exe but ran into the same error. Does it have to do with admin rights? Do I have to run command prompt as an admin in order to use pyinstaller? Or do I have to be logged-in as the admin?
Please use google before posting a question on stackoverflow, this is the original question: https://stackoverflow.com/a/60320831/12533273 You may have two versions of python3 installed and that's cousing a problem, try uninstalling all versions of python and then reinstalling them.
.\pyinstaller --onefile -w 'filename.py' or pyinstaller --onefile -w 'filename.py' use the above two commands in the powershell while you went to the page of conversion should be made. https://media.geeksforgeeks.org/wp-content/uploads/20200202204743/Screenshot-5013.png
Pyinstaller generating empty dist folder
I'm relatively new to python and I'm trying to create an EXE of a Python Application. I saw that there is a lot of similar question here on Stack Overflow, but none has significative answers, so I decided to bring this again. Here is the verbose of the Pyinstaller: C:\Users\renan.klehm\Desktop\AutoCTE-Python>pyinstaller --onefile cli.py 164 INFO: PyInstaller: 3.5 165 INFO: Python: 3.8.0 165 INFO: Platform: Windows-7-6.1.7601-SP1 181 INFO: wrote C:\Users\renan.klehm\Desktop\AutoCTE-Python\cli.spec 184 INFO: UPX is not available. 185 INFO: Extending PYTHONPATH with paths ['C:\\Users\\renan.klehm\\Desktop\\AutoCTE-Python', 'C:\\Users\\renan.klehm\\Desktop\\AutoCTE-Python'] 185 INFO: checking Analysis 476 INFO: checking PYZ 476 INFO: Building PYZ because PYZ-00.toc is non existent 476 INFO: Building PYZ (ZlibArchive) C:\Users\renan.klehm\Desktop\AutoCTE-Python \build\cli\PYZ-00.pyz Traceback (most recent call last): File "c:\users\renan.klehm\appdata\local\programs\python\python38-32\lib\runpy .py", line 192, in _run_module_as_main return _run_code(code, main_globals, None, File "c:\users\renan.klehm\appdata\local\programs\python\python38-32\lib\runpy .py", line 85, in _run_code exec(code, run_globals) File "C:\Users\renan.klehm\AppData\Local\Programs\Python\Python38-32\Scripts\p yinstaller.exe\__main__.py", line 7, in <module> File "c:\users\renan.klehm\appdata\local\programs\python\python38-32\lib\site- packages\PyInstaller\__main__.py", line 111, in run run_build(pyi_config, spec_file, **vars(args)) File "c:\users\renan.klehm\appdata\local\programs\python\python38-32\lib\site- packages\PyInstaller\__main__.py", line 63, in run_build PyInstaller.building.build_main.main(pyi_config, spec_file, **kwargs) File "c:\users\renan.klehm\appdata\local\programs\python\python38-32\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\renan.klehm\appdata\local\programs\python\python38-32\lib\site- packages\PyInstaller\building\build_main.py", line 791, in build exec(code, spec_namespace) File "C:\Users\renan.klehm\Desktop\AutoCTE-Python\cli.spec", line 18, in <modu le> pyz = PYZ(a.pure, a.zipped_data, File "c:\users\renan.klehm\appdata\local\programs\python\python38-32\lib\site- packages\PyInstaller\building\api.py", line 98, in __init__ self.__postinit__() File "c:\users\renan.klehm\appdata\local\programs\python\python38-32\lib\site- packages\PyInstaller\building\datastruct.py", line 158, in __postinit__ self.assemble() File "c:\users\renan.klehm\appdata\local\programs\python\python38-32\lib\site- packages\PyInstaller\building\api.py", line 128, in assemble self.code_dict = { File "c:\users\renan.klehm\appdata\local\programs\python\python38-32\lib\site- packages\PyInstaller\building\api.py", line 129, in <dictcomp> key: strip_paths_in_code(code) File "c:\users\renan.klehm\appdata\local\programs\python\python38-32\lib\site- packages\PyInstaller\building\utils.py", line 652, in strip_paths_in_code consts = tuple( File "c:\users\renan.klehm\appdata\local\programs\python\python38-32\lib\site- packages\PyInstaller\building\utils.py", line 653, in <genexpr> strip_paths_in_code(const_co, new_filename) File "c:\users\renan.klehm\appdata\local\programs\python\python38-32\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) C:\Users\renan.klehm\Desktop\AutoCTE-Python>pyinstaller cli.py 131 INFO: PyInstaller: 3.5 131 INFO: Python: 3.8.0 131 INFO: Platform: Windows-7-6.1.7601-SP1 143 INFO: wrote C:\Users\renan.klehm\Desktop\AutoCTE-Python\cli.spec 144 INFO: UPX is not available. 147 INFO: Extending PYTHONPATH with paths ['C:\\Users\\renan.klehm\\Desktop\\AutoCTE-Python', 'C:\\Users\\renan.klehm\\Desktop\\AutoCTE-Python'] 147 INFO: checking Analysis 424 INFO: checking PYZ 424 INFO: Building PYZ because PYZ-00.toc is non existent 426 INFO: Building PYZ (ZlibArchive) C:\Users\renan.klehm\Desktop\AutoCTE-Python\build\cli\PYZ-00.pyz Traceback (most recent call last): File "c:\users\renan.klehm\appdata\local\programs\python\python38-32\lib\runpy.py", line 192, in _run_module_as_main return _run_code(code, main_globals, None, File "c:\users\renan.klehm\appdata\local\programs\python\python38-32\lib\runpy.py", line 85, in _run_code exec(code, run_globals) File "C:\Users\renan.klehm\AppData\Local\Programs\Python\Python38-32\Scripts\pyinstaller.exe\__main__.py", line 7, in <module> File "c:\users\renan.klehm\appdata\local\programs\python\python38-32\lib\site-packages\PyInstaller\__main__.py", line 111, in run run_build(pyi_config, spec_file, **vars(args)) File "c:\users\renan.klehm\appdata\local\programs\python\python38-32\lib\site-packages\PyInstaller\__main__.py", line 63, in run_build PyInstaller.building.build_main.main(pyi_config, spec_file, **kwargs) File "c:\users\renan.klehm\appdata\local\programs\python\python38-32\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\renan.klehm\appdata\local\programs\python\python38-32\lib\site-packages\PyInstaller\building\build_main.py", line 791, in build exec(code, spec_namespace) File "C:\Users\renan.klehm\Desktop\AutoCTE-Python\cli.spec", line 18, in <module> pyz = PYZ(a.pure, a.zipped_data, File "c:\users\renan.klehm\appdata\local\programs\python\python38-32\lib\site-packages\PyInstaller\building\api.py", line 98, in __init__ self.__postinit__() File "c:\users\renan.klehm\appdata\local\programs\python\python38-32\lib\site-packages\PyInstaller\building\datastruct.py", line 158, in __postinit__ self.assemble() File "c:\users\renan.klehm\appdata\local\programs\python\python38-32\lib\site-packages\PyInstaller\building\api.py", line 128, in assemble self.code_dict = { File "c:\users\renan.klehm\appdata\local\programs\python\python38-32\lib\site-packages\PyInstaller\building\api.py", line 129, in <dictcomp> key: strip_paths_in_code(code) File "c:\users\renan.klehm\appdata\local\programs\python\python38-32\lib\site-packages\PyInstaller\building\utils.py", line 652, in strip_paths_in_code consts = tuple( File "c:\users\renan.klehm\appdata\local\programs\python\python38-32\lib\site-packages\PyInstaller\building\utils.py", line 653, in <genexpr> strip_paths_in_code(const_co, new_filename) File "c:\users\renan.klehm\appdata\local\programs\python\python38-32\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) It generates both build and dist folders, but the dist folder where the .exe what supposed to be is empty.
Thanks, #John T I downgraded to 3.7.6 and now Pyinstaller is building the .exe as expected, a few errors show up when I run the .exe, but it's working! Thanks again.
pyinstaller script not found
I created my project with python 3.7. when I run 'pyinstaller --onefile -w dunamicGUI.py' command in terminal from /Users/mdarifulislam/Documents/GitHub/ZKProject/pythonServer/ directory it shows 40 INFO: PyInstaller: 3.5 40 INFO: Python: 2.7.16 47 INFO: Platform: Darwin-19.2.0-x86_64-i386-64bit 48 INFO: wrote /Users/mdarifulislam/Documents/GitHub/ZKProject/pythonServer/dunamicGUI.spec 54 INFO: UPX is not available. Traceback (most recent call last): File "/usr/local/bin/pyinstaller", line 10, in <module> sys.exit(run()) File "/usr/local/lib/python2.7/site-packages/PyInstaller/__main__.py", line 111, in run run_build(pyi_config, spec_file, **vars(args)) File "/usr/local/lib/python2.7/site-packages/PyInstaller/__main__.py", line 63, in run_build PyInstaller.building.build_main.main(pyi_config, spec_file, **kwargs) File "/usr/local/lib/python2.7/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/python2.7/site-packages/PyInstaller/building/build_main.py", line 791, in build exec(code, spec_namespace) File "/Users/mdarifulislam/Documents/GitHub/ZKProject/pythonServer/dunamicGUI.spec", line 17, in <module> noarchive=False) File "/usr/local/lib/python2.7/site-packages/PyInstaller/building/build_main.py", line 190, in __init__ raise ValueError("script '%s' not found" % script) ValueError: script '/Users/mdarifulislam/Documents/GitHub/ZKProject/pythonServer/dunamicGUI.py' not found Now what will be the solution.
Script not found when using pyinstaller
I am trying to convert a python script to an exe file. I have added the python script to a folder together with pyinstaller, and I use the right PATH in CMD: C:\Users\ola nordmann\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.7_qbz5n2kfra8p0\LocalCache\local-packages\Python37\Scripts\pyinstaller>pyinstaller --onefile CreatWordDoc.py 126 INFO: PyInstaller: 3.5 126 INFO: Python: 3.7.5 126 INFO: Platform: Windows-10-10.0.18362-SP0 127 INFO: wrote C:\Users\ola nordmann\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.7_qbz5n2kfra8p0\LocalCache\local-packages\Python37\Scripts\pyinstaller\CreatWordDoc.spec 132 INFO: UPX is not available. Traceback (most recent call last): File "C:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.7_3.7.1520.0_x64__qbz5n2kfra8p0\lib\runpy.py", line 193, in _run_module_as_main "__main__", mod_spec) File "C:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.7_3.7.1520.0_x64__qbz5n2kfra8p0\lib\runpy.py", line 85, in _run_code exec(code, run_globals) File "C:\Users\ola nordmann\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.7_qbz5n2kfra8p0\LocalCache\local-packages\Python37\Scripts\pyinstaller\pyinstaller.exe\__main__.py", line 7, in <module> File "C:\Users\ola nordmann\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.7_qbz5n2kfra8p0\LocalCache\local-packages\Python37\site-packages\PyInstaller\__main__.py", line 111, in run run_build(pyi_config, spec_file, **vars(args)) File "C:\Users\ola nordmann\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.7_qbz5n2kfra8p0\LocalCache\local-packages\Python37\site-packages\PyInstaller\__main__.py", line 63, in run_build PyInstaller.building.build_main.main(pyi_config, spec_file, **kwargs) File "C:\Users\ola nordmann\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.7_qbz5n2kfra8p0\LocalCache\local-packages\Python37\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\ola nordmann\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.7_qbz5n2kfra8p0\LocalCache\local-packages\Python37\site-packages\PyInstaller\building\build_main.py", line 791, in build exec(code, spec_namespace) File "C:\Users\ola nordmann\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.7_qbz5n2kfra8p0\LocalCache\local-packages\Python37\Scripts\pyinstaller\CreatWordDoc.spec", line 17, in <module> noarchive=False) File "C:\Users\ola nordmann\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.7_qbz5n2kfra8p0\LocalCache\local-packages\Python37\site-packages\PyInstaller\building\build_main.py", line 190, in __init__ raise ValueError("script '%s' not found" % script) ValueError: script 'C:\Users\ola nordmann\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.7_qbz5n2kfra8p0\LocalCache\local-packages\Python37\Scripts\pyinstaller\CreatWordDoc.py' not found This is what it shows. I know there are some similar questions here, but I have not found a solution yet.
I found the solution. I had to first install Python from their own website instead of the Windows store. Then I had to add it to a PATH. After this it still did not work because I used Python 3.8.0, so I had to install pyinstaller development version.