When I use pyinstaller to convert my .py file to .exe, I got this error:-
IndexError: tuple index out of range
Python : 3.10
PyInstaller : 5.0 (development)
C:\Users\DELL\Desktop\Jarvis\DCJarvis>pyinstaller JarvisFEMALE.py
490 INFO: PyInstaller: 5.0.dev0
490 INFO: Python: 3.10.0
517 INFO: Platform: Windows-10-10.0.19043-SP0
520 INFO: wrote C:\Users\DELL\Desktop\Jarvis\DCJarvis\JarvisFEMALE.spec
527 INFO: UPX is not available.
533 INFO: Extending PYTHONPATH with paths
['C:\\Users\\DELL\\Desktop\\Jarvis\\DCJarvis']
2022 INFO: checking Analysis
2022 INFO: Building Analysis because Analysis-00.toc is non existent
2023 INFO: Initializing module dependency graph...
2037 INFO: Caching module graph hooks...
2152 INFO: Analyzing base_library.zip ...
23739 INFO: Processing pre-find module path hook distutils from 'C:\\Python310\\lib\\site-packages\\PyInstaller\\hooks\\pre_find_module_path\\hook-distutils.py'.
23741 INFO: distutils: retargeting to non-venv dir 'C:\\Python310\\lib'
29591 INFO: Caching module dependency graph...
30643 INFO: running Analysis Analysis-00.toc
30654 INFO: Adding Microsoft.Windows.Common-Controls to dependent assemblies of final executable
required by C:\Python310\python.exe
31022 INFO: Analyzing C:\Users\DELL\Desktop\Jarvis\DCJarvis\JarvisFEMALE.py
32116 INFO: Processing pre-safe import module hook urllib3.packages.six.moves from 'C:\\Python310\\lib\\site-packages\\PyInstaller\\hooks\\pre_safe_import_module\\hook-urllib3.packages.six.moves.py'.
42783 INFO: Processing pre-find module path hook site from 'C:\\Python310\\lib\\site-packages\\PyInstaller\\hooks\\pre_find_module_path\\hook-site.py'.
42803 INFO: site: retargeting to fake-dir 'C:\\Python310\\lib\\site-packages\\PyInstaller\\fake-modules'
Traceback (most recent call last):
File "C:\Python310\lib\runpy.py", line 196, in _run_module_as_main
return _run_code(code, main_globals, None,
File "C:\Python310\lib\runpy.py", line 86, in _run_code
exec(code, run_globals)
File "C:\Python310\Scripts\pyinstaller.exe\__main__.py", line 7, in <module>
File "C:\Python310\lib\site-packages\PyInstaller\__main__.py", line 124, in run
run_build(pyi_config, spec_file, **vars(args))
File "C:\Python310\lib\site-packages\PyInstaller\__main__.py", line 58, in run_build
PyInstaller.building.build_main.main(pyi_config, spec_file, **kwargs)
File "C:\Python310\lib\site-packages\PyInstaller\building\build_main.py", line 827, in main
build(specfile, kw.get('distpath'), kw.get('workpath'), kw.get('clean_build'))
File "C:\Python310\lib\site-packages\PyInstaller\building\build_main.py", line 759, in build
exec(code, spec_namespace)
File "C:\Users\DELL\Desktop\Jarvis\DCJarvis\JarvisFEMALE.spec", line 7, in <module>
a = Analysis(
File "C:\Python310\lib\site-packages\PyInstaller\building\build_main.py", line 311, in __init__
self.__postinit__()
File "C:\Python310\lib\site-packages\PyInstaller\building\datastruct.py", line 155, in __postinit__
self.assemble()
File "C:\Python310\lib\site-packages\PyInstaller\building\build_main.py", line 473, in assemble
priority_scripts.append(self.graph.add_script(script))
File "C:\Python310\lib\site-packages\PyInstaller\depend\analysis.py", line 265, in add_script
self._top_script_node = super().add_script(pathname)
File "C:\Python310\lib\site-packages\PyInstaller\lib\modulegraph\modulegraph.py", line 1433, in add_script
self._process_imports(n)
File "C:\Python310\lib\site-packages\PyInstaller\lib\modulegraph\modulegraph.py", line 2850, in _process_imports
target_module = self._safe_import_hook(*import_info, **kwargs)[0]
File "C:\Python310\lib\site-packages\PyInstaller\lib\modulegraph\modulegraph.py", line 2301, in _safe_import_hook
target_modules = self.import_hook(
File "C:\Python310\lib\site-packages\PyInstaller\lib\modulegraph\modulegraph.py", line 1505, in import_hook
target_package, target_module_partname = self._find_head_package(
File "C:\Python310\lib\site-packages\PyInstaller\lib\modulegraph\modulegraph.py", line 1684, in _find_head_package
target_package = self._safe_import_module(
File "C:\Python310\lib\site-packages\PyInstaller\depend\analysis.py", line 387, in _safe_import_module
return super()._safe_import_module(module_basename, module_name, parent_package)
File "C:\Python310\lib\site-packages\PyInstaller\lib\modulegraph\modulegraph.py", line 2062, in _safe_import_module
self._process_imports(n)
File "C:\Python310\lib\site-packages\PyInstaller\lib\modulegraph\modulegraph.py", line 2850, in _process_imports
target_module = self._safe_import_hook(*import_info, **kwargs)[0]
File "C:\Python310\lib\site-packages\PyInstaller\lib\modulegraph\modulegraph.py", line 2301, in _safe_import_hook
target_modules = self.import_hook(
File "C:\Python310\lib\site-packages\PyInstaller\lib\modulegraph\modulegraph.py", line 1505, in import_hook
target_package, target_module_partname = self._find_head_package(
File "C:\Python310\lib\site-packages\PyInstaller\lib\modulegraph\modulegraph.py", line 1684, in _find_head_package
target_package = self._safe_import_module(
File "C:\Python310\lib\site-packages\PyInstaller\depend\analysis.py", line 387, in _safe_import_module
return super()._safe_import_module(module_basename, module_name, parent_package)
File "C:\Python310\lib\site-packages\PyInstaller\lib\modulegraph\modulegraph.py", line 2062, in _safe_import_module
self._process_imports(n)
File "C:\Python310\lib\site-packages\PyInstaller\lib\modulegraph\modulegraph.py", line 2850, in _process_imports
target_module = self._safe_import_hook(*import_info, **kwargs)[0]
File "C:\Python310\lib\site-packages\PyInstaller\lib\modulegraph\modulegraph.py", line 2301, in _safe_import_hook
target_modules = self.import_hook(
File "C:\Python310\lib\site-packages\PyInstaller\lib\modulegraph\modulegraph.py", line 1505, in import_hook
target_package, target_module_partname = self._find_head_package(
File "C:\Python310\lib\site-packages\PyInstaller\lib\modulegraph\modulegraph.py", line 1684, in _find_head_package
target_package = self._safe_import_module(
File "C:\Python310\lib\site-packages\PyInstaller\depend\analysis.py", line 387, in _safe_import_module
return super()._safe_import_module(module_basename, module_name, parent_package)
File "C:\Python310\lib\site-packages\PyInstaller\lib\modulegraph\modulegraph.py", line 2062, in _safe_import_module
self._process_imports(n)
File "C:\Python310\lib\site-packages\PyInstaller\lib\modulegraph\modulegraph.py", line 2850, in _process_imports
target_module = self._safe_import_hook(*import_info, **kwargs)[0]
File "C:\Python310\lib\site-packages\PyInstaller\lib\modulegraph\modulegraph.py", line 2301, in _safe_import_hook
target_modules = self.import_hook(
File "C:\Python310\lib\site-packages\PyInstaller\lib\modulegraph\modulegraph.py", line 1518, in import_hook
submodule = self._safe_import_module(head, mname, submodule)
File "C:\Python310\lib\site-packages\PyInstaller\depend\analysis.py", line 387, in _safe_import_module
return super()._safe_import_module(module_basename, module_name, parent_package)
File "C:\Python310\lib\site-packages\PyInstaller\lib\modulegraph\modulegraph.py", line 2062, in _safe_import_module
self._process_imports(n)
File "C:\Python310\lib\site-packages\PyInstaller\lib\modulegraph\modulegraph.py", line 2850, in _process_imports
target_module = self._safe_import_hook(*import_info, **kwargs)[0]
File "C:\Python310\lib\site-packages\PyInstaller\lib\modulegraph\modulegraph.py", line 2301, in _safe_import_hook
target_modules = self.import_hook(
File "C:\Python310\lib\site-packages\PyInstaller\lib\modulegraph\modulegraph.py", line 1518, in import_hook
submodule = self._safe_import_module(head, mname, submodule)
File "C:\Python310\lib\site-packages\PyInstaller\depend\analysis.py", line 387, in _safe_import_module
return super()._safe_import_module(module_basename, module_name, parent_package)
File "C:\Python310\lib\site-packages\PyInstaller\lib\modulegraph\modulegraph.py", line 2062, in _safe_import_module
self._process_imports(n)
File "C:\Python310\lib\site-packages\PyInstaller\lib\modulegraph\modulegraph.py", line 2850, in _process_imports
target_module = self._safe_import_hook(*import_info, **kwargs)[0]
File "C:\Python310\lib\site-packages\PyInstaller\lib\modulegraph\modulegraph.py", line 2301, in _safe_import_hook
target_modules = self.import_hook(
File "C:\Python310\lib\site-packages\PyInstaller\lib\modulegraph\modulegraph.py", line 1518, in import_hook
submodule = self._safe_import_module(head, mname, submodule)
File "C:\Python310\lib\site-packages\PyInstaller\depend\analysis.py", line 387, in _safe_import_module
return super()._safe_import_module(module_basename, module_name, parent_package)
File "C:\Python310\lib\site-packages\PyInstaller\lib\modulegraph\modulegraph.py", line 2061, in _safe_import_module
n = self._scan_code(module, co, co_ast)
File "C:\Python310\lib\site-packages\PyInstaller\lib\modulegraph\modulegraph.py", line 2645, in _scan_code
self._scan_bytecode(
File "C:\Python310\lib\site-packages\PyInstaller\lib\modulegraph\modulegraph.py", line 2749, in _scan_bytecode
for inst in util.iterate_instructions(module_code_object):
File "C:\Python310\lib\site-packages\PyInstaller\lib\modulegraph\util.py", line 147, in iterate_instructions
yield from iterate_instructions(constant)
File "C:\Python310\lib\site-packages\PyInstaller\lib\modulegraph\util.py", line 139, in iterate_instructions
yield from get_instructions(code_object)
File "C:\Python310\lib\dis.py", line 338, in _get_instructions_bytes
argval, argrepr = _get_const_info(arg, constants)
File "C:\Python310\lib\dis.py", line 292, in _get_const_info
argval = const_list[const_index]
IndexError: tuple index out of range
How do I fix this ?
Plz help me, I tried to convert more than 4 project but I got this error in all!
Updating your Python version should fix the issue. I experienced the same problem until I updated to Python 3.10.2