Trying to figure out why Pyinstaller does not make the .EXE in the \Dist folder.
What i'm running is pyinstaller --onefile FileName.py
But after this it fails:
7758 INFO: Building PYZ (ZlibArchive) An error occurred, traceback follows:
Traceback (most recent call last):
File "c:\users\marcu\appdata\local\programs\python\python38-32\lib\site-packages\auto_py_to_exe__main__.py", line 269, in convert
pyi.run() # Execute PyInstaller
File "c:\users\marcu\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\marcu\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\marcu\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\marcu\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\Marcu\AppData\Local\Temp\tmp2gf7vp4s\File_Rename.spec", line 18, in
pyz = PYZ(a.pure, a.zipped_data,
File "c:\users\marcu\appdata\local\programs\python\python38-32\lib\site-packages\PyInstaller\building\api.py", line 98, in init
self.postinit()
File "c:\users\marcu\appdata\local\programs\python\python38-32\lib\site-packages\PyInstaller\building\datastruct.py", line 158, in postinit
self.assemble()
File "c:\users\marcu\appdata\local\programs\python\python38-32\lib\site-packages\PyInstaller\building\api.py", line 128, in assemble
self.code_dict = {
File "c:\users\marcu\appdata\local\programs\python\python38-32\lib\site-packages\PyInstaller\building\api.py", line 129, in
key: strip_paths_in_code(code)
File "c:\users\marcu\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\marcu\appdata\local\programs\python\python38-32\lib\site-packages\PyInstaller\building\utils.py", line 653, in
strip_paths_in_code(const_co, new_filename)
File "c:\users\marcu\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)
And so on.
Path is set
Newest versions
Script is working as intended when run through Python
The idea is to make the .py an .exe so i can run it on a computer that does not have Python.
I Found the answer.
By using pip install https://github.com/pyinstaller/pyinstaller/archive/develop.zip
it uninstalled the version 3.5 and installed the 4.0 dev version.
Used pyinstaller xxxx.py and voilĂ
Thank you for everyone's participation
Related
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'
I'm using auto-py-to-exe to compile a .py file. Whichever setting I choose, it does not work.
An error occurred while packaging
Traceback (most recent call last):
File "c:\users\benbe\appdata\local\programs\python\python39\lib\site-packages\auto_py_to_exe\packaging.py", line 131, in package
run_pyinstaller()
File "c:\users\benbe\appdata\local\programs\python\python39\lib\site-packages\PyInstaller\__main__.py", line 114, in run
run_build(pyi_config, spec_file, **vars(args))
File "c:\users\benbe\appdata\local\programs\python\python39\lib\site-packages\PyInstaller\__main__.py", line 65, in run_build
PyInstaller.building.build_main.main(pyi_config, spec_file, **kwargs)
File "c:\users\benbe\appdata\local\programs\python\python39\lib\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\benbe\appdata\local\programs\python\python39\lib\site-packages\PyInstaller\building\build_main.py", line 684, in build
exec(code, spec_namespace)
File "C:\Users\benbe\AppData\Local\Temp\tmpbliekynp\main.spec", line 21, in <module>
exe = EXE(pyz,
File "c:\users\benbe\appdata\local\programs\python\python39\lib\site-packages\PyInstaller\building\api.py", line 450, in __init__
self.__postinit__()
File "c:\users\benbe\appdata\local\programs\python\python39\lib\site-packages\PyInstaller\building\datastruct.py", line 160, in __postinit__
self.assemble()
File "c:\users\benbe\appdata\local\programs\python\python39\lib\site-packages\PyInstaller\building\api.py", line 549, in assemble
icon.CopyIcons(tmpnm, self.icon)
File "c:\users\benbe\appdata\local\programs\python\python39\lib\site-packages\PyInstaller\utils\win32\icon.py", line 216, in CopyIcons
return CopyIcons_FromIco(dstpath, [srcpath])
File "c:\users\benbe\appdata\local\programs\python\python39\lib\site-packages\PyInstaller\utils\win32\icon.py", line 153, in CopyIcons_FromIco
for i, f in enumerate(icons):
File "c:\users\benbe\appdata\local\programs\python\python39\lib\site-packages\PyInstaller\utils\win32\icon.py", line 117, in __init__
entry.fromfile(file)
File "c:\users\benbe\appdata\local\programs\python\python39\lib\site-packages\PyInstaller\utils\win32\icon.py", line 76, in fromfile
self._fields_ = list(struct.unpack(self._format_, data))
struct.error: unpack requires a buffer of 16 bytes
Project output will not be moved to output folder.
Try installing a older-version of python try python 3.8.10
Install python 3.8.10 now go to the directory where it is installed and go inside the script folder and open cmd there and type pip install auto-py-to-exe then opy your code file and paste it in the script folder of python 3.8.10 and then open cmd there and type auto-py-to-exe and then try to make the exe.
make sure your cmd is opened in the script directory
If it still does not work try it using the module pyinstaller in python 3.8.10 here you can know details about making a exe In this link you will see how to make a exe with pyinstaller module
or you can try using cx_freeze module here is a link for it or if you want to see a tutorial search in youtube or you can go to this link or this one
I'm getting a ValueError: source code string cannot contain null bytes when executing a command pyinstaller main.py in a cmd both with and without administrator privileges.
Traceback (most recent call last):
File "c:\users\User\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\User\appdata\local\programs\python\python38\lib\runpy.py", line 85, in _run_code
exec(code, run_globals)
File "C:\Users\User\AppData\Local\Programs\Python\Python38\Scripts\pyinstaller.exe\__main__.py", line 7, in <module>
File "c:\users\User\appdata\local\programs\python\python38\lib\site-packages\PyInstaller\__main__.py", line 114, in run
run_build(pyi_config, spec_file, **vars(args))
File "c:\users\User\appdata\local\programs\python\python38\lib\site-packages\PyInstaller\__main__.py", line 65, in run_build
PyInstaller.building.build_main.main(pyi_config, spec_file, **kwargs)
File "c:\users\User\appdata\local\programs\python\python38\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:\users\User\appdata\local\programs\python\python38\lib\site-packages\PyInstaller\building\build_main.py", line 681, in build
exec(code, spec_namespace)
File "C:\Users\User\OneDrive\Pulpit\CODE\Python 3\PyGame Games\Game Of Pong\main.spec", line 30, in <module>
coll = COLLECT(exe,
File "c:\users\User\appdata\local\programs\python\python38\lib\site-packages\PyInstaller\building\api.py", line 698, in __init__
self.__postinit__()
File "c:\users\User\appdata\local\programs\python\python38\lib\site-packages\PyInstaller\building\datastruct.py", line 160, in __postinit__
self.assemble()
File "c:\users\User\appdata\local\programs\python\python38\lib\site-packages\PyInstaller\building\api.py", line 732, in assemble
fnm = checkCache(fnm, strip=self.strip_binaries,
File "c:\users\User\appdata\local\programs\python\python38\lib\site-packages\PyInstaller\building\utils.py", line 197, in checkCache
cache_index = load_py_data_struct(cacheindexfn)
File "c:\users\User\appdata\local\programs\python\python38\lib\site-packages\PyInstaller\utils\misc.py", line 233, in load_py_data_struct
return eval(f.read())
ValueError: source code string cannot contain null bytes
I tried deleting NULL characters from my code using Notepad++ and I tried reinstalling pyinstaller, yet the problem still persists.
I figured it out. It seems that pyinstaller isn't compatible with the latest version of Python 3 (as of 24.05.2020). I uninstalled Python 3.8.3 and I installed Python 3.7.7, installed all of the libraries I was using in main.py and it worked! Such a simple solution.
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.
So i'm trying to change something in the .spec file which i've named "filename.py", although pyinstaller can never find the file even if i open the command prompt from within the folder that contains the file.
I've even tried inserting the whole file path but still received the same error.
PS C:\Users\S3401\Desktop\New folder> pyi-makespec filename.py
wrote C:\Users\S3401\Desktop\New folder\filename.spec
now run pyinstaller.py to build the executable
PS C:\Users\S3401\Desktop\New folder> pyinstaller .\filename.spec
46 INFO: PyInstaller: 3.3.1
46 INFO: Python: 3.6.6
46 INFO: Platform: Windows-10-10.0.17134-SP0
47 INFO: UPX is not available.
Traceback (most recent call last):
File "C:\Program Files\Python36\Scripts\pyinstaller-script.py", line 11, in <module>
load_entry_point('PyInstaller==3.3.1', 'console_scripts', 'pyinstaller')()
File "c:\program files\python36\lib\site-packages\PyInstaller\__main__.py", line 94, in run
run_build(pyi_config, spec_file, **vars(args))
File "c:\program files\python36\lib\site-packages\PyInstaller\__main__.py", line 46, in run_build
PyInstaller.building.build_main.main(pyi_config, spec_file, **kwargs)
File "c:\program files\python36\lib\site-packages\PyInstaller\building\build_main.py", line 791, in main
build(specfile, kw.get('distpath'), kw.get('workpath'), kw.get('clean_build'))
File "c:\program files\python36\lib\site-packages\PyInstaller\building\build_main.py", line 737, in build
exec(text, spec_namespace)
File "<string>", line 16, in <module>
File "c:\program files\python36\lib\site-packages\PyInstaller\building\build_main.py", line 162, in __init__
raise ValueError("script '%s' not found" % script)
ValueError: script 'filename.py' not found