I have been having some difficulties compiling my Python program using Pyinstaller. My program has multiple modules and about 2000 lines of code. It uses TaurusScada as a sort of wrapper for PYQT, Numpy, and a few other modules. The platform is Python 2.7 and Ubuntu 15.04. I'm also using Pyinstaller 3.1. I was successful in compiling a small "Hello World" type application so I know it works. I am not married to Pyinstaller as I have tried cx_Freeze as well without success. Rather than leaving my entire code on here I'll start by leaving the traceback and error in hopes that someone can shed some light on this:
66874 INFO: Processing hook hook-gi.repository.GdkPixbuf.py
Traceback (most recent call last):
File "/usr/local/bin/pyinstaller", line 11, in <module>
sys.exit(run())
File "/usr/local/lib/python2.7/dist-packages/PyInstaller/__main__.py", line 90, in run
run_build(pyi_config, spec_file, **vars(args))
File "/usr/local/lib/python2.7/dist-packages/PyInstaller/__main__.py", line 46, in run_build
PyInstaller.building.build_main.main(pyi_config, spec_file, **kwargs)
File "/usr/local/lib/python2.7/dist-packages/PyInstaller/building/build_main.py", line 755, in main
build(specfile, kw.get('distpath'), kw.get('workpath'), kw.get('clean_build'))
File "/usr/local/lib/python2.7/dist-packages/PyInstaller/building/build_main.py", line 701, in build
exec(text, spec_namespace)
File "<string>", line 16, in <module>
File "/usr/local/lib/python2.7/dist-packages/PyInstaller/building/build_main.py", line 212, in __init__
self.__postinit__()
File "/usr/local/lib/python2.7/dist-packages/PyInstaller/building/datastruct.py", line 183, in __postinit__
self.assemble()
File "/usr/local/lib/python2.7/dist-packages/PyInstaller/building/build_main.py", line 432, in assemble
imphook_object = ImportHook(imported_name, hook_file)
File "/usr/local/lib/python2.7/dist-packages/PyInstaller/building/imphook.py", line 182, in __init__
self._module = importlib_load_source(hook_modname, self._filename)
File "/usr/local/lib/python2.7/dist-packages/PyInstaller/hooks/hook-gi.repository.GdkPixbuf.py", line 36, in <module>
cachedata = subprocess.check_output('gdk-pixbuf-query-loaders')
File "/usr/lib/python2.7/subprocess.py", line 566, in check_output
process = Popen(stdout=PIPE, *popenargs, **kwargs)
File "/usr/lib/python2.7/subprocess.py", line 710, in __init__
errread, errwrite)
File "/usr/lib/python2.7/subprocess.py", line 1335, in _execute_child
raise child_exception
OSError: [Errno 2] No such file or directory
Any help is much appreciated.
i had a similar error today. You are missing the gdk-pixbuf library:
so just run:
sudo apt-get install libgdk-pixbuf2.0-dev
and pyinstaller should go smoothly
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'
Traceback (most recent call last):
File "c:\users\me\appdata\local\programs\python\python39\lib\runpy.py", l
ine 197, in _run_module_as_main
return _run_code(code, main_globals, None,
File "c:\users\me\appdata\local\programs\python\python39\lib\runpy.py", l
ine 87, in _run_code
exec(code, run_globals)
File "C:\Users\me\AppData\Local\Programs\Python\Python39\Scripts\pyinstal
ler.exe\__main__.py", line 7, in <module>
File "c:\users\me\appdata\local\programs\python\python39\lib\site-package
s\PyInstaller\__main__.py", line 126, in run
run_build(pyi_config, spec_file, **vars(args))
File "c:\users\me\appdata\local\programs\python\python39\lib\site-package
s\PyInstaller\__main__.py", line 65, in run_build
PyInstaller.building.build_main.main(pyi_config, spec_file, **kwargs)
File "c:\users\me\appdata\local\programs\python\python39\lib\site-package
s\PyInstaller\building\build_main.py", line 815, in main
build(specfile, kw.get('distpath'), kw.get('workpath'), kw.get('clean_build'
))
File "c:\users\me\appdata\local\programs\python\python39\lib\site-package
s\PyInstaller\building\build_main.py", line 762, in build
exec(code, spec_namespace)
File "C:\Users\me\Desktop\Game\main.spec", line 23, in <module>
exe = EXE(pyz,
File "c:\users\me\appdata\local\programs\python\python39\lib\site-package
s\PyInstaller\building\api.py", line 524, in __init__
self.__postinit__()
File "c:\users\me\appdata\local\programs\python\python39\lib\site-package
s\PyInstaller\building\datastruct.py", line 159, in __postinit__
self.assemble()
File "c:\users\me\appdata\local\programs\python\python39\lib\site-package
s\PyInstaller\building\api.py", line 771, in assemble
with open(self.name, 'wb') as outf:
PermissionError: [Errno 13] Permission denied: 'C:\\Users\\me\\Desktop\\Gam
e\\dist\\main.exe'
Why does it not allow me to make it an executable? I'm using Pyinstaller and I ran pyinstaller --onefile -w main.py.. I tried doing other methods, but none of them worked.
Hopefully somebody can help. :)
Thanks,
Dragon
If you are on a Linux machine, try to use the command:
sudo pyinstaller --onefile -w main.py
and if you are on a Windows machine, try to open the cmd using administrator privilege. Just write cmd in the search bar, right-click on the result and chose
open as administrator
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.
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
If i understand MRJob correctly, you can simulate hadoop's multi process run using MRJob by running it with
python mrfile.py -r local input.txt
I'm running windows(no choice for now), and when I issue the above command, i'm getting a bunch of mambo jumbo and at the end it tells me :
WindowsError: [Error 2] The system cannot find the file specified
This is the full error. Could someone help?
C:\Users\someuser\Documents\Python_projects\something>python MRJob_parser.py -r loc
al test2.txt
no configs found; falling back on auto-configuration
no configs found; falling back on auto-configuration
creating tmp directory c:\users\someuser\appdata\local\temp\MRJob_parser.someuser.
20150701.211822.496000
writing wrapper script to c:\users\someuser\appdata\local\temp\MRJob_parser.bw401
45.20150701.211822.496000\setup-wrapper.sh
writing to c:\users\someuser\appdata\local\temp\MRJob_parser.someuser.20150701.211
822.496000\step-0-mapper_part-00000
> sh -ex setup-wrapper.sh 'c:\Users\someuser\Documents\python_venv\something_Project\
Scripts\python.exe' MRJob_parser.py --step-num=0 --mapper 'c:\users\someuser\appd
ata\local\temp\MRJob_parser.someuser.20150701.211822.496000\input_part-00000' > c
:\users\someuser\appdata\local\temp\MRJob_parser.someuser.20150701.211822.496000\s
tep-0-mapper_part-00000
Traceback (most recent call last):
File "MRJob_parser.py", line 18, in <module>
Extractor.run()
File "c:\Users\someuser\Documents\python_venv\something_Project\lib\site-packages\m
rjob\job.py", line 461, in run
mr_job.execute()
File "c:\Users\someuser\Documents\python_venv\something_Project\lib\site-packages\m
rjob\job.py", line 479, in execute
super(MRJob, self).execute()
File "c:\Users\someuser\Documents\python_venv\something_Project\lib\site-packages\m
rjob\launch.py", line 151, in execute
self.run_job()
File "c:\Users\someuser\Documents\python_venv\something_Project\lib\site-packages\m
rjob\launch.py", line 214, in run_job
runner.run()
File "c:\Users\someuser\Documents\python_venv\something_Project\lib\site-packages\m
rjob\runner.py", line 464, in run
self._run()
File "c:\Users\someuser\Documents\python_venv\something_Project\lib\site-packages\m
rjob\sim.py", line 173, in _run
self._invoke_step(step_num, 'mapper')
File "c:\Users\someuser\Documents\python_venv\something_Project\lib\site-packages\m
rjob\sim.py", line 260, in _invoke_step
working_dir, env)
File "c:\Users\someuser\Documents\python_venv\something_Project\lib\site-packages\m
rjob\local.py", line 147, in _run_step
procs_args, output_path, working_dir, env)
File "c:\Users\someuser\Documents\python_venv\something_Project\lib\site-packages\m
rjob\local.py", line 250, in _invoke_processes
cwd=working_dir, env=env)
File "c:\Users\someuser\Documents\python_venv\something_Project\lib\site-packages\m
rjob\local.py", line 73, in _chain_procs
proc = Popen(args, **proc_kwargs)
File "C:\Python27\Lib\subprocess.py", line 710, in __init__
errread, errwrite)
File "C:\Python27\Lib\subprocess.py", line 958, in _execute_child
startupinfo)
WindowsError: [Error 2] The system cannot find the file specified
C:\Users\someuser\Documents\Python_projects\something>
From https://github.com/Yelp/mrjob:
# locally
python mrjob/examples/mr_word_freq_count.py README.rst > counts
My guess is that you don't have to pass in the local runner option and that's causing some kind of error.