AlessandroZ / LaZagne

Credentials recovery project
GNU Lesser General Public License v3.0
9.52k stars 2.04k forks source link

Building on Linux is not working #636

Closed ricobandy closed 4 months ago

ricobandy commented 9 months ago

When I try to build the python script for linux it's not working and following is the error:

$ sudo pyinstaller --onefile -w laZagne.py /usr/bin/pyinstaller:6: DeprecationWarning: pkg_resources is deprecated as an API. See https://setuptools.pypa.io/en/latest/pkg_resources.html from pkg_resources import load_entry_point 184 INFO: PyInstaller: 3.5+498e6ee058 185 INFO: Python: 3.11.6 186 INFO: Platform: Linux-5.15.133.1-microsoft-standard-WSL2-x86_64-with-glibc2.37 186 INFO: wrote /home/echaqua/Tools/LaZagne/Linux/laZagne.spec 187 INFO: UPX is available. 188 INFO: Extending PYTHONPATH with paths ['/home/echaqua/Tools/LaZagne/Linux', '/home/echaqua/Tools/LaZagne/Linux'] 188 INFO: checking Analysis 189 INFO: Building Analysis because Analysis-00.toc is non existent 189 INFO: Initializing module dependency graph... 191 INFO: Initializing module graph hooks... 192 INFO: Analyzing base_library.zip ... 3838 INFO: Processing pre-find module path hook distutils Traceback (most recent call last): File "/usr/bin/pyinstaller", line 11, in load_entry_point('PyInstaller==3.5+498e6ee058', 'console_scripts', 'pyinstaller')() File "/usr/lib/python3/dist-packages/PyInstaller/main.py", line 111, in run run_build(pyi_config, spec_file, vars(args)) File "/usr/lib/python3/dist-packages/PyInstaller/main.py", line 63, in run_build PyInstaller.building.build_main.main(pyi_config, spec_file, kwargs) File "/usr/lib/python3/dist-packages/PyInstaller/building/build_main.py", line 844, in main build(specfile, kw.get('distpath'), kw.get('workpath'), kw.get('clean_build')) File "/usr/lib/python3/dist-packages/PyInstaller/building/build_main.py", line 791, in build exec(code, spec_namespace) File "/home/echaqua/Tools/LaZagne/Linux/laZagne.spec", line 6, in a = Analysis(['laZagne.py'], ^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/lib/python3/dist-packages/PyInstaller/building/build_main.py", line 243, in init self.postinit() File "/usr/lib/python3/dist-packages/PyInstaller/building/datastruct.py", line 158, in postinit self.assemble() File "/usr/lib/python3/dist-packages/PyInstaller/building/build_main.py", line 348, in assemble self.graph = initialize_modgraph( ^^^^^^^^^^^^^^^^^^^^ File "/usr/lib/python3/dist-packages/PyInstaller/depend/analysis.py", line 613, in initialize_modgraph graph.import_hook(m) File "/usr/lib/python3/dist-packages/PyInstaller/lib/modulegraph/modulegraph.py", line 1473, in import_hook target_package, target_module_partname = self._find_head_package( ^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/lib/python3/dist-packages/PyInstaller/lib/modulegraph/modulegraph.py", line 1657, in _find_head_package raise ImportError("No module named " + target_package_name) ImportError: No module named _bootlocale

0xAl1en commented 8 months ago

I had a similar issue and I fixed it by replacing my Linux distribution's package of pyinstaller (Kali) with the one from pip by running: sudo apt remove python3-pyinstaller -> remove outdated package sudo pip install pyinstaller -> replace system instance of pyinstaller with latest pip version (to avoid your package manager requesting to reinstall pyinstaller when run) I then could compile the lazagne script with pyinstaller laZagne.py which worked

Why this issue occurred? : the error is caused by an outdated pyinstaller running see (https://github.com/pyinstaller/pyinstaller/issues/7882) so even if you run --exclude-module _bootlocale you will continue to get errors Hope this helps!

AlessandroZ commented 4 months ago

If not resolved, check this issue: https://github.com/AlessandroZ/LaZagne/issues/642