Skip to content
Advertisement

Pyinstaller Error when try to create exe file

When i try to create the executable for my program using pyinstaller --onefile gui.py it gives me this error. pyqt5 and all the required packages are installed for the program but when i tried to create the executable it gives me this error what is wrong with the process

Traceback (most recent call last):
  File "<string>", line 1, in <module>
  File "C:Usersoshada.iAppDataLocalProgramsPythonPython310libsite-packagessqlalchemy__init__.py", line 8, in <module>
    from . import util as _util
  File "C:Usersoshada.iAppDataLocalProgramsPythonPython310libsite-packagessqlalchemyutil__init__.py", line 103, in <module>
    from .concurrency import asyncio
  File "C:Usersoshada.iAppDataLocalProgramsPythonPython310libsite-packagessqlalchemyutilconcurrency.py", line 20, in <module>
    from ._concurrency_py3k import await_only
  File "C:Usersoshada.iAppDataLocalProgramsPythonPython310libsite-packagessqlalchemyutil_concurrency_py3k.py", line 8, in <module>
    import asyncio
  File "C:Usersoshada.iAppDataLocalProgramsPythonPython310libsite-packagesasyncio__init__.py", line 21, in <module>
    from .base_events import *
  File "C:Usersoshada.iAppDataLocalProgramsPythonPython310libsite-packagesasynciobase_events.py", line 296
    future = tasks.async(future, loop=self)
                   ^^^^^
SyntaxError: invalid syntax
Traceback (most recent call last):
  File "C:Usersoshada.iAppDataLocalProgramsPythonPython310librunpy.py", line 196, in _run_module_as_main
    return _run_code(code, main_globals, None,
  File "C:Usersoshada.iAppDataLocalProgramsPythonPython310librunpy.py", line 86, in _run_code
    exec(code, run_globals)
  File "C:Usersoshada.iAppDataLocalProgramsPythonPython310Scriptspyinstaller.exe__main__.py", line 7, in <module>
  File "C:Usersoshada.iAppDataLocalProgramsPythonPython310libsite-packagesPyInstaller__main__.py", line 178, in run
    run_build(pyi_config, spec_file, **vars(args))
  File "C:Usersoshada.iAppDataLocalProgramsPythonPython310libsite-packagesPyInstaller__main__.py", line 59, in run_build
    PyInstaller.building.build_main.main(pyi_config, spec_file, **kwargs)
  File "C:Usersoshada.iAppDataLocalProgramsPythonPython310libsite-packagesPyInstallerbuildingbuild_main.py", line 845, in main
    build(specfile, distpath, workpath, clean_build)
  File "C:Usersoshada.iAppDataLocalProgramsPythonPython310libsite-packagesPyInstallerbuildingbuild_main.py", line 767, in build
    exec(code, spec_namespace)
  File "E:ImalkaVarCheckgui.spec", line 7, in <module>
    a = Analysis(
  File "C:Usersoshada.iAppDataLocalProgramsPythonPython310libsite-packagesPyInstallerbuildingbuild_main.py", line 319, in __init__
    self.__postinit__()
  File "C:Usersoshada.iAppDataLocalProgramsPythonPython310libsite-packagesPyInstallerbuildingdatastruct.py", line 173, in __postinit__
    self.assemble()
  File "C:Usersoshada.iAppDataLocalProgramsPythonPython310libsite-packagesPyInstallerbuildingbuild_main.py", line 487, in assemble
    self.graph.process_post_graph_hooks(self)
  File "C:Usersoshada.iAppDataLocalProgramsPythonPython310libsite-packagesPyInstallerdependanalysis.py", line 326, in process_post_graph_hooks
    module_hook.post_graph(analysis)
  File "C:Usersoshada.iAppDataLocalProgramsPythonPython310libsite-packagesPyInstallerdependimphook.py", line 398, in post_graph
    self._load_hook_module()
  File "C:Usersoshada.iAppDataLocalProgramsPythonPython310libsite-packagesPyInstallerdependimphook.py", line 361, in _load_hook_module
    self._hook_module = importlib_load_source(self.hook_module_name, self.hook_filename)
  File "C:Usersoshada.iAppDataLocalProgramsPythonPython310libsite-packagesPyInstallercompat.py", line 620, in importlib_load_source
    return mod_loader.load_module()
  File "<frozen importlib._bootstrap_external>", line 548, in _check_name_wrapper
  File "<frozen importlib._bootstrap_external>", line 1063, in load_module
  File "<frozen importlib._bootstrap_external>", line 888, in load_module
  File "<frozen importlib._bootstrap>", line 290, in _load_module_shim
  File "<frozen importlib._bootstrap>", line 719, in _load
  File "<frozen importlib._bootstrap>", line 688, in _load_unlocked
  File "<frozen importlib._bootstrap_external>", line 883, in exec_module
  File "<frozen importlib._bootstrap>", line 241, in _call_with_frames_removed
  File "C:Usersoshada.iAppDataLocalProgramsPythonPython310libsite-packagesPyInstallerhookshook-sqlalchemy.py", line 31, in <module>
    dialects = eval(dialects.strip())
  File "<string>", line 0
    
SyntaxError: invalid syntax

Advertisement

Answer

Finally i found a solution to fix the error. it because of the asyncio package remove the package using pip uninstall asyncio and run the pyinstaller it will compile the .exe file

User contributions licensed under: CC BY-SA
9 People found this is helpful
Advertisement