Problem generating a .exe with PyInstaller and Matplotlib - python

I generate a .exe before importing matplotlib and it works.
After import matplotlib like this:
import matplotlib as plt
from matplotlib.backends.backend_tkagg import FigureCanvasTkAgg
from matplotlib.figure import Figure
And try a simple:
pyinstaller main.py
Console show me this:
249 INFO: PyInstaller: 5.7.0
249 INFO: Python: 3.10.0
265 INFO: Platform: Windows-10-10.0.19045-SP0
265 INFO: wrote C:\Program Files (x86)\Proyectos\Farmacia Stone\Farmacia Karen Choque\main.spec
265 INFO: UPX is not available.
265 INFO: Extending PYTHONPATH with paths
['C:\\Program Files (x86)\\Proyectos\\Farmacia Stone\\Farmacia Karen Choque']
999 INFO: checking Analysis
1015 INFO: Building because inputs changed
1015 INFO: Initializing module dependency graph...
1015 INFO: Caching module graph hooks...
1031 WARNING: Several hooks defined for module 'numpy'. Please take care they do not conflict.
1046 INFO: Analyzing base_library.zip ...
3093 INFO: Loading module hook 'hook-heapq.py' from 'C:\\Users\\pay-7\\AppData\\Local\\Programs\\Python\\Python310\\lib\\site-packages\\PyInstaller\\hooks'...
3218 INFO: Loading module hook 'hook-encodings.py' from 'C:\\Users\\pay-7\\AppData\\Local\\Programs\\Python\\Python310\\lib\\site-packages\\PyInstaller\\hooks'...
5327 INFO: Loading module hook 'hook-pickle.py' from 'C:\\Users\\pay-7\\AppData\\Local\\Programs\\Python\\Python310\\lib\\site-packages\\PyInstaller\\hooks'...
7374 INFO: Caching module dependency graph...
7609 INFO: running Analysis Analysis-00.toc
7640 INFO: Adding Microsoft.Windows.Common-Controls to dependent assemblies of final executable
required by C:\Users\pay-7\AppData\Local\Programs\Python\Python310\python.exe
7921 INFO: Analyzing C:\Program Files (x86)\Proyectos\Farmacia Stone\Farmacia Karen Choque\main.py
8155 INFO: Loading module hook 'hook-PIL.py' from 'C:\\Users\\pay-7\\AppData\\Local\\Programs\\Python\\Python310\\lib\\site-packages\\PyInstaller\\hooks'...
8280 INFO: Loading module hook 'hook-PIL.Image.py' from 'C:\\Users\\pay-7\\AppData\\Local\\Programs\\Python\\Python310\\lib\\site-packages\\PyInstaller\\hooks'...
9046 INFO: Loading module hook 'hook-pycparser.py' from 'C:\\Users\\pay-7\\AppData\\Local\\Programs\\Python\\Python310\\lib\\site-packages\\_pyinstaller_hooks_contrib\\hooks\\stdhooks'...
9593 INFO: Processing pre-find module path hook distutils from 'C:\\Users\\pay-7\\AppData\\Local\\Programs\\Python\\Python310\\lib\\site-packages\\PyInstaller\\hooks\\pre_find_module_path\\hook-distutils.py'.
9609 INFO: Loading module hook 'hook-distutils.py' from 'C:\\Users\\pay-7\\AppData\\Local\\Programs\\Python\\Python310\\lib\\site-packages\\PyInstaller\\hooks'...
9687 INFO: Loading module hook 'hook-distutils.util.py' from 'C:\\Users\\pay-7\\AppData\\Local\\Programs\\Python\\Python310\\lib\\site-packages\\PyInstaller\\hooks'...
9734 INFO: Loading module hook 'hook-sysconfig.py' from 'C:\\Users\\pay-7\\AppData\\Local\\Programs\\Python\\Python310\\lib\\site-packages\\PyInstaller\\hooks'...
10046 INFO: Loading module hook 'hook-setuptools.py' from 'C:\\Users\\pay-7\\AppData\\Local\\Programs\\Python\\Python310\\lib\\site-packages\\PyInstaller\\hooks'...
11280 INFO: Loading module hook 'hook-pkg_resources.py' from 'C:\\Users\\pay-7\\AppData\\Local\\Programs\\Python\\Python310\\lib\\site-packages\\PyInstaller\\hooks'...
12905 INFO: Loading module hook 'hook-platform.py' from 'C:\\Users\\pay-7\\AppData\\Local\\Programs\\Python\\Python310\\lib\\site-packages\\PyInstaller\\hooks'...
12983 INFO: Loading module hook 'hook-xml.py' from 'C:\\Users\\pay-7\\AppData\\Local\\Programs\\Python\\Python310\\lib\\site-packages\\PyInstaller\\hooks'...
13999 INFO: Loading module hook 'hook-multiprocessing.util.py' from 'C:\\Users\\pay-7\\AppData\\Local\\Programs\\Python\\Python310\\lib\\site-packages\\PyInstaller\\hooks'...
14827 INFO: Loading module hook 'hook-numpy.py' from 'C:\\Users\\pay-7\\AppData\\Local\\Programs\\Python\\Python310\\Lib\\site-packages\\numpy\\_pyinstaller'...
15421 INFO: Loading module hook 'hook-numpy._pytesttester.py' from 'C:\\Users\\pay-7\\AppData\\Local\\Programs\\Python\\Python310\\lib\\site-packages\\PyInstaller\\hooks'...
15811 INFO: Loading module hook 'hook-difflib.py' from 'C:\\Users\\pay-7\\AppData\\Local\\Programs\\Python\\Python310\\lib\\site-packages\\PyInstaller\\hooks'...
17858 INFO: Loading module hook 'hook-packaging.py' from 'C:\\Users\\pay-7\\AppData\\Local\\Programs\\Python\\Python310\\lib\\site-packages\\PyInstaller\\hooks'...
17921 INFO: Loading module hook 'hook-PIL.ImageFilter.py' from 'C:\\Users\\pay-7\\AppData\\Local\\Programs\\Python\\Python310\\lib\\site-packages\\PyInstaller\\hooks'...
17999 INFO: Loading module hook 'hook-cryptography.py' from 'C:\\Users\\pay-7\\AppData\\Local\\Programs\\Python\\Python310\\lib\\site-packages\\_pyinstaller_hooks_contrib\\hooks\\stdhooks'...
20452 INFO: Loading module hook 'hook-sqlite3.py' from 'C:\\Users\\pay-7\\AppData\\Local\\Programs\\Python\\Python310\\lib\\site-packages\\PyInstaller\\hooks'...
21264 INFO: Loading module hook 'hook-matplotlib.py' from 'C:\\Users\\pay-7\\AppData\\Local\\Programs\\Python\\Python310\\lib\\site-packages\\PyInstaller\\hooks'...
21905 INFO: Processing pre-safe import module hook gi from 'C:\\Users\\pay-7\\AppData\\Local\\Programs\\Python\\Python310\\lib\\site-packages\\PyInstaller\\hooks\\pre_safe_import_module\\hook-gi.py'.
22811 INFO: Loading module hook 'hook-jinja2.py' from 'C:\\Users\\pay-7\\AppData\\Local\\Programs\\Python\\Python310\\lib\\site-packages\\_pyinstaller_hooks_contrib\\hooks\\stdhooks'...
Traceback (most recent call last):
File "C:\Users\pay-7\AppData\Local\Programs\Python\Python310\lib\runpy.py", line 196, in _run_module_as_main
return _run_code(code, main_globals, None,
File "C:\Users\pay-7\AppData\Local\Programs\Python\Python310\lib\runpy.py", line 86, in _run_code
exec(code, run_globals)
File "C:\Users\pay-7\AppData\Local\Programs\Python\Python310\Scripts\pyinstaller.exe\__main__.py", line 7, in <module>
File "C:\Users\pay-7\AppData\Local\Programs\Python\Python310\lib\site-packages\PyInstaller\__main__.py", line 194, in _console_script_run
run()
File "C:\Users\pay-7\AppData\Local\Programs\Python\Python310\lib\site-packages\PyInstaller\__main__.py", line 180, in run
run_build(pyi_config, spec_file, **vars(args))
File "C:\Users\pay-7\AppData\Local\Programs\Python\Python310\lib\site-packages\PyInstaller\__main__.py", line 61, in run_build
PyInstaller.building.build_main.main(pyi_config, spec_file, **kwargs)
File "C:\Users\pay-7\AppData\Local\Programs\Python\Python310\lib\site-packages\PyInstaller\building\build_main.py", line 972, in main
build(specfile, distpath, workpath, clean_build)
File "C:\Users\pay-7\AppData\Local\Programs\Python\Python310\lib\site-packages\PyInstaller\building\build_main.py", line 894, in build
exec(code, spec_namespace)
File "C:\Program Files (x86)\Proyectos\Farmacia Stone\Farmacia Karen Choque\main.spec", line 7, in <module>
a = Analysis(
File "C:\Users\pay-7\AppData\Local\Programs\Python\Python310\lib\site-packages\PyInstaller\building\build_main.py", line 411, in __init__
self.__postinit__()
File "C:\Users\pay-7\AppData\Local\Programs\Python\Python310\lib\site-packages\PyInstaller\building\datastruct.py", line 173, in __postinit__
self.assemble()
File "C:\Users\pay-7\AppData\Local\Programs\Python\Python310\lib\site-packages\PyInstaller\building\build_main.py", line 574, in assemble
priority_scripts.append(self.graph.add_script(script))
File "C:\Users\pay-7\AppData\Local\Programs\Python\Python310\lib\site-packages\PyInstaller\depend\analysis.py", line 269, in add_script
self._top_script_node = super().add_script(pathname)
File "C:\Users\pay-7\AppData\Local\Programs\Python\Python310\lib\site-packages\PyInstaller\lib\modulegraph\modulegraph.py", line 1433, in add_script
self._process_imports(n)
File "C:\Users\pay-7\AppData\Local\Programs\Python\Python310\lib\site-packages\PyInstaller\lib\modulegraph\modulegraph.py", line 2850, in _process_imports
target_modules = self._safe_import_hook(*import_info, **kwargs)
File "C:\Users\pay-7\AppData\Local\Programs\Python\Python310\lib\site-packages\PyInstaller\depend\analysis.py", line 382, in _safe_import_hook
return super()._safe_import_hook(target_module_partname, source_module, target_attr_names, level, edge_attr)
File "C:\Users\pay-7\AppData\Local\Programs\Python\Python310\lib\site-packages\PyInstaller\lib\modulegraph\modulegraph.py", line 2301, in _safe_import_hook
target_modules = self.import_hook(
File "C:\Users\pay-7\AppData\Local\Programs\Python\Python310\lib\site-packages\PyInstaller\lib\modulegraph\modulegraph.py", line 1518, in import_hook
submodule = self._safe_import_module(head, mname, submodule)
File "C:\Users\pay-7\AppData\Local\Programs\Python\Python310\lib\site-packages\PyInstaller\depend\analysis.py", line 429, in _safe_import_module
return super()._safe_import_module(module_basename, module_name, parent_package)
File "C:\Users\pay-7\AppData\Local\Programs\Python\Python310\lib\site-packages\PyInstaller\lib\modulegraph\modulegraph.py", line 2062, in _safe_import_module
self._process_imports(n)
File "C:\Users\pay-7\AppData\Local\Programs\Python\Python310\lib\site-packages\PyInstaller\lib\modulegraph\modulegraph.py", line 2850, in _process_imports
target_modules = self._safe_import_hook(*import_info, **kwargs)
File "C:\Users\pay-7\AppData\Local\Programs\Python\Python310\lib\site-packages\PyInstaller\depend\analysis.py", line 382, in _safe_import_hook
return super()._safe_import_hook(target_module_partname, source_module, target_attr_names, level, edge_attr)
File "C:\Users\pay-7\AppData\Local\Programs\Python\Python310\lib\site-packages\PyInstaller\lib\modulegraph\modulegraph.py", line 2301, in _safe_import_hook
target_modules = self.import_hook(
File "C:\Users\pay-7\AppData\Local\Programs\Python\Python310\lib\site-packages\PyInstaller\lib\modulegraph\modulegraph.py", line 1518, in import_hook
submodule = self._safe_import_module(head, mname, submodule)
File "C:\Users\pay-7\AppData\Local\Programs\Python\Python310\lib\site-packages\PyInstaller\depend\analysis.py", line 429, in _safe_import_module
return super()._safe_import_module(module_basename, module_name, parent_package)
File "C:\Users\pay-7\AppData\Local\Programs\Python\Python310\lib\site-packages\PyInstaller\lib\modulegraph\modulegraph.py", line 2062, in _safe_import_module
self._process_imports(n)
File "C:\Users\pay-7\AppData\Local\Programs\Python\Python310\lib\site-packages\PyInstaller\lib\modulegraph\modulegraph.py", line 2850, in _process_imports
target_modules = self._safe_import_hook(*import_info, **kwargs)
File "C:\Users\pay-7\AppData\Local\Programs\Python\Python310\lib\site-packages\PyInstaller\depend\analysis.py", line 382, in _safe_import_hook
return super()._safe_import_hook(target_module_partname, source_module, target_attr_names, level, edge_attr)
File "C:\Users\pay-7\AppData\Local\Programs\Python\Python310\lib\site-packages\PyInstaller\lib\modulegraph\modulegraph.py", line 2301, in _safe_import_hook
target_modules = self.import_hook(
File "C:\Users\pay-7\AppData\Local\Programs\Python\Python310\lib\site-packages\PyInstaller\lib\modulegraph\modulegraph.py", line 1518, in import_hook
submodule = self._safe_import_module(head, mname, submodule)
File "C:\Users\pay-7\AppData\Local\Programs\Python\Python310\lib\site-packages\PyInstaller\depend\analysis.py", line 429, in _safe_import_module
return super()._safe_import_module(module_basename, module_name, parent_package)
File "C:\Users\pay-7\AppData\Local\Programs\Python\Python310\lib\site-packages\PyInstaller\lib\modulegraph\modulegraph.py", line 2062, in _safe_import_module
self._process_imports(n)
File "C:\Users\pay-7\AppData\Local\Programs\Python\Python310\lib\site-packages\PyInstaller\lib\modulegraph\modulegraph.py", line 2850, in _process_imports
target_modules = self._safe_import_hook(*import_info, **kwargs)
File "C:\Users\pay-7\AppData\Local\Programs\Python\Python310\lib\site-packages\PyInstaller\depend\analysis.py", line 382, in _safe_import_hook
return super()._safe_import_hook(target_module_partname, source_module, target_attr_names, level, edge_attr)
File "C:\Users\pay-7\AppData\Local\Programs\Python\Python310\lib\site-packages\PyInstaller\lib\modulegraph\modulegraph.py", line 2301, in _safe_import_hook
target_modules = self.import_hook(
File "C:\Users\pay-7\AppData\Local\Programs\Python\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:\Users\pay-7\AppData\Local\Programs\Python\Python310\lib\site-packages\PyInstaller\lib\modulegraph\modulegraph.py", line 1684, in _find_head_package
target_package = self._safe_import_module(
File "C:\Users\pay-7\AppData\Local\Programs\Python\Python310\lib\site-packages\PyInstaller\depend\analysis.py", line 429, in _safe_import_module
return super()._safe_import_module(module_basename, module_name, parent_package)
File "C:\Users\pay-7\AppData\Local\Programs\Python\Python310\lib\site-packages\PyInstaller\lib\modulegraph\modulegraph.py", line 2062, in _safe_import_module
self._process_imports(n)
File "C:\Users\pay-7\AppData\Local\Programs\Python\Python310\lib\site-packages\PyInstaller\lib\modulegraph\modulegraph.py", line 2850, in _process_imports
target_modules = self._safe_import_hook(*import_info, **kwargs)
File "C:\Users\pay-7\AppData\Local\Programs\Python\Python310\lib\site-packages\PyInstaller\depend\analysis.py", line 382, in _safe_import_hook
return super()._safe_import_hook(target_module_partname, source_module, target_attr_names, level, edge_attr)
File "C:\Users\pay-7\AppData\Local\Programs\Python\Python310\lib\site-packages\PyInstaller\lib\modulegraph\modulegraph.py", line 2510, in _safe_import_hook
self.import_hook(
File "C:\Users\pay-7\AppData\Local\Programs\Python\Python310\lib\site-packages\PyInstaller\lib\modulegraph\modulegraph.py", line 1544, in import_hook
for target_submodule in self._import_importable_package_submodules(
File "C:\Users\pay-7\AppData\Local\Programs\Python\Python310\lib\site-packages\PyInstaller\lib\modulegraph\modulegraph.py", line 1794, in _import_importable_package_submodules
submodule = self._safe_import_module(
File "C:\Users\pay-7\AppData\Local\Programs\Python\Python310\lib\site-packages\PyInstaller\depend\analysis.py", line 429, in _safe_import_module
return super()._safe_import_module(module_basename, module_name, parent_package)
File "C:\Users\pay-7\AppData\Local\Programs\Python\Python310\lib\site-packages\PyInstaller\lib\modulegraph\modulegraph.py", line 2062, in _safe_import_module
self._process_imports(n)
File "C:\Users\pay-7\AppData\Local\Programs\Python\Python310\lib\site-packages\PyInstaller\lib\modulegraph\modulegraph.py", line 2850, in _process_imports
target_modules = self._safe_import_hook(*import_info, **kwargs)
File "C:\Users\pay-7\AppData\Local\Programs\Python\Python310\lib\site-packages\PyInstaller\depend\analysis.py", line 382, in _safe_import_hook
return super()._safe_import_hook(target_module_partname, source_module, target_attr_names, level, edge_attr)
File "C:\Users\pay-7\AppData\Local\Programs\Python\Python310\lib\site-packages\PyInstaller\lib\modulegraph\modulegraph.py", line 2301, in _safe_import_hook
target_modules = self.import_hook(
File "C:\Users\pay-7\AppData\Local\Programs\Python\Python310\lib\site-packages\PyInstaller\lib\modulegraph\modulegraph.py", line 1518, in import_hook
submodule = self._safe_import_module(head, mname, submodule)
File "C:\Users\pay-7\AppData\Local\Programs\Python\Python310\lib\site-packages\PyInstaller\depend\analysis.py", line 429, in _safe_import_module
return super()._safe_import_module(module_basename, module_name, parent_package)
File "C:\Users\pay-7\AppData\Local\Programs\Python\Python310\lib\site-packages\PyInstaller\lib\modulegraph\modulegraph.py", line 2062, in _safe_import_module
self._process_imports(n)
File "C:\Users\pay-7\AppData\Local\Programs\Python\Python310\lib\site-packages\PyInstaller\lib\modulegraph\modulegraph.py", line 2850, in _process_imports
target_modules = self._safe_import_hook(*import_info, **kwargs)
File "C:\Users\pay-7\AppData\Local\Programs\Python\Python310\lib\site-packages\PyInstaller\depend\analysis.py", line 382, in _safe_import_hook
return super()._safe_import_hook(target_module_partname, source_module, target_attr_names, level, edge_attr)
File "C:\Users\pay-7\AppData\Local\Programs\Python\Python310\lib\site-packages\PyInstaller\lib\modulegraph\modulegraph.py", line 2301, in _safe_import_hook
target_modules = self.import_hook(
File "C:\Users\pay-7\AppData\Local\Programs\Python\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:\Users\pay-7\AppData\Local\Programs\Python\Python310\lib\site-packages\PyInstaller\lib\modulegraph\modulegraph.py", line 1684, in _find_head_package
target_package = self._safe_import_module(
File "C:\Users\pay-7\AppData\Local\Programs\Python\Python310\lib\site-packages\PyInstaller\depend\analysis.py", line 429, in _safe_import_module
return super()._safe_import_module(module_basename, module_name, parent_package)
File "C:\Users\pay-7\AppData\Local\Programs\Python\Python310\lib\site-packages\PyInstaller\lib\modulegraph\modulegraph.py", line 2062, in _safe_import_module
self._process_imports(n)
File "C:\Users\pay-7\AppData\Local\Programs\Python\Python310\lib\site-packages\PyInstaller\lib\modulegraph\modulegraph.py", line 2850, in _process_imports
target_modules = self._safe_import_hook(*import_info, **kwargs)
File "C:\Users\pay-7\AppData\Local\Programs\Python\Python310\lib\site-packages\PyInstaller\depend\analysis.py", line 382, in _safe_import_hook
return super()._safe_import_hook(target_module_partname, source_module, target_attr_names, level, edge_attr)
File "C:\Users\pay-7\AppData\Local\Programs\Python\Python310\lib\site-packages\PyInstaller\lib\modulegraph\modulegraph.py", line 2510, in _safe_import_hook
self.import_hook(
File "C:\Users\pay-7\AppData\Local\Programs\Python\Python310\lib\site-packages\PyInstaller\lib\modulegraph\modulegraph.py", line 1544, in import_hook
for target_submodule in self._import_importable_package_submodules(
File "C:\Users\pay-7\AppData\Local\Programs\Python\Python310\lib\site-packages\PyInstaller\lib\modulegraph\modulegraph.py", line 1794, in _import_importable_package_submodules
submodule = self._safe_import_module(
File "C:\Users\pay-7\AppData\Local\Programs\Python\Python310\lib\site-packages\PyInstaller\depend\analysis.py", line 429, in _safe_import_module
return super()._safe_import_module(module_basename, module_name, parent_package)
File "C:\Users\pay-7\AppData\Local\Programs\Python\Python310\lib\site-packages\PyInstaller\lib\modulegraph\modulegraph.py", line 2062, in _safe_import_module
self._process_imports(n)
File "C:\Users\pay-7\AppData\Local\Programs\Python\Python310\lib\site-packages\PyInstaller\lib\modulegraph\modulegraph.py", line 2850, in _process_imports
target_modules = self._safe_import_hook(*import_info, **kwargs)
File "C:\Users\pay-7\AppData\Local\Programs\Python\Python310\lib\site-packages\PyInstaller\depend\analysis.py", line 382, in _safe_import_hook
return super()._safe_import_hook(target_module_partname, source_module, target_attr_names, level, edge_attr)
File "C:\Users\pay-7\AppData\Local\Programs\Python\Python310\lib\site-packages\PyInstaller\lib\modulegraph\modulegraph.py", line 2301, in _safe_import_hook
target_modules = self.import_hook(
File "C:\Users\pay-7\AppData\Local\Programs\Python\Python310\lib\site-packages\PyInstaller\lib\modulegraph\modulegraph.py", line 1518, in import_hook
submodule = self._safe_import_module(head, mname, submodule)
File "C:\Users\pay-7\AppData\Local\Programs\Python\Python310\lib\site-packages\PyInstaller\depend\analysis.py", line 429, in _safe_import_module
return super()._safe_import_module(module_basename, module_name, parent_package)
File "C:\Users\pay-7\AppData\Local\Programs\Python\Python310\lib\site-packages\PyInstaller\lib\modulegraph\modulegraph.py", line 2062, in _safe_import_module
self._process_imports(n)
File "C:\Users\pay-7\AppData\Local\Programs\Python\Python310\lib\site-packages\PyInstaller\lib\modulegraph\modulegraph.py", line 2850, in _process_imports
target_modules = self._safe_import_hook(*import_info, **kwargs)
File "C:\Users\pay-7\AppData\Local\Programs\Python\Python310\lib\site-packages\PyInstaller\depend\analysis.py", line 382, in _safe_import_hook
return super()._safe_import_hook(target_module_partname, source_module, target_attr_names, level, edge_attr)
File "C:\Users\pay-7\AppData\Local\Programs\Python\Python310\lib\site-packages\PyInstaller\lib\modulegraph\modulegraph.py", line 2510, in _safe_import_hook
self.import_hook(
File "C:\Users\pay-7\AppData\Local\Programs\Python\Python310\lib\site-packages\PyInstaller\lib\modulegraph\modulegraph.py", line 1544, in import_hook
for target_submodule in self._import_importable_package_submodules(
File "C:\Users\pay-7\AppData\Local\Programs\Python\Python310\lib\site-packages\PyInstaller\lib\modulegraph\modulegraph.py", line 1794, in _import_importable_package_submodules
submodule = self._safe_import_module(
File "C:\Users\pay-7\AppData\Local\Programs\Python\Python310\lib\site-packages\PyInstaller\depend\analysis.py", line 429, in _safe_import_module
return super()._safe_import_module(module_basename, module_name, parent_package)
File "C:\Users\pay-7\AppData\Local\Programs\Python\Python310\lib\site-packages\PyInstaller\lib\modulegraph\modulegraph.py", line 2062, in _safe_import_module
self._process_imports(n)
File "C:\Users\pay-7\AppData\Local\Programs\Python\Python310\lib\site-packages\PyInstaller\lib\modulegraph\modulegraph.py", line 2850, in _process_imports
target_modules = self._safe_import_hook(*import_info, **kwargs)
File "C:\Users\pay-7\AppData\Local\Programs\Python\Python310\lib\site-packages\PyInstaller\depend\analysis.py", line 382, in _safe_import_hook
return super()._safe_import_hook(target_module_partname, source_module, target_attr_names, level, edge_attr)
File "C:\Users\pay-7\AppData\Local\Programs\Python\Python310\lib\site-packages\PyInstaller\lib\modulegraph\modulegraph.py", line 2301, in _safe_import_hook
target_modules = self.import_hook(
File "C:\Users\pay-7\AppData\Local\Programs\Python\Python310\lib\site-packages\PyInstaller\lib\modulegraph\modulegraph.py", line 1518, in import_hook
submodule = self._safe_import_module(head, mname, submodule)
File "C:\Users\pay-7\AppData\Local\Programs\Python\Python310\lib\site-packages\PyInstaller\depend\analysis.py", line 429, in _safe_import_module
return super()._safe_import_module(module_basename, module_name, parent_package)
File "C:\Users\pay-7\AppData\Local\Programs\Python\Python310\lib\site-packages\PyInstaller\lib\modulegraph\modulegraph.py", line 2062, in _safe_import_module
self._process_imports(n)
File "C:\Users\pay-7\AppData\Local\Programs\Python\Python310\lib\site-packages\PyInstaller\lib\modulegraph\modulegraph.py", line 2850, in _process_imports
target_modules = self._safe_import_hook(*import_info, **kwargs)
File "C:\Users\pay-7\AppData\Local\Programs\Python\Python310\lib\site-packages\PyInstaller\depend\analysis.py", line 382, in _safe_import_hook
return super()._safe_import_hook(target_module_partname, source_module, target_attr_names, level, edge_attr)
File "C:\Users\pay-7\AppData\Local\Programs\Python\Python310\lib\site-packages\PyInstaller\lib\modulegraph\modulegraph.py", line 2301, in _safe_import_hook
target_modules = self.import_hook(
File "C:\Users\pay-7\AppData\Local\Programs\Python\Python310\lib\site-packages\PyInstaller\lib\modulegraph\modulegraph.py", line 1518, in import_hook
submodule = self._safe_import_module(head, mname, submodule)
File "C:\Users\pay-7\AppData\Local\Programs\Python\Python310\lib\site-packages\PyInstaller\depend\analysis.py", line 429, in _safe_import_module
return super()._safe_import_module(module_basename, module_name, parent_package)
File "C:\Users\pay-7\AppData\Local\Programs\Python\Python310\lib\site-packages\PyInstaller\lib\modulegraph\modulegraph.py", line 2062, in _safe_import_module
self._process_imports(n)
File "C:\Users\pay-7\AppData\Local\Programs\Python\Python310\lib\site-packages\PyInstaller\lib\modulegraph\modulegraph.py", line 2850, in _process_imports
target_modules = self._safe_import_hook(*import_info, **kwargs)
File "C:\Users\pay-7\AppData\Local\Programs\Python\Python310\lib\site-packages\PyInstaller\depend\analysis.py", line 382, in _safe_import_hook
return super()._safe_import_hook(target_module_partname, source_module, target_attr_names, level, edge_attr)
File "C:\Users\pay-7\AppData\Local\Programs\Python\Python310\lib\site-packages\PyInstaller\lib\modulegraph\modulegraph.py", line 2301, in _safe_import_hook
target_modules = self.import_hook(
File "C:\Users\pay-7\AppData\Local\Programs\Python\Python310\lib\site-packages\PyInstaller\lib\modulegraph\modulegraph.py", line 1518, in import_hook
submodule = self._safe_import_module(head, mname, submodule)
File "C:\Users\pay-7\AppData\Local\Programs\Python\Python310\lib\site-packages\PyInstaller\depend\analysis.py", line 429, in _safe_import_module
return super()._safe_import_module(module_basename, module_name, parent_package)
File "C:\Users\pay-7\AppData\Local\Programs\Python\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:\Users\pay-7\AppData\Local\Programs\Python\Python310\lib\site-packages\PyInstaller\lib\modulegraph\modulegraph.py", line 2645, in _scan_code
self._scan_bytecode(
File "C:\Users\pay-7\AppData\Local\Programs\Python\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:\Users\pay-7\AppData\Local\Programs\Python\Python310\lib\site-packages\PyInstaller\lib\modulegraph\util.py", line 141, in iterate_instructions
yield from (i for i in get_instructions(code_object) if i.opname != "EXTENDED_ARG")
File "C:\Users\pay-7\AppData\Local\Programs\Python\Python310\lib\site-packages\PyInstaller\lib\modulegraph\util.py", line 141, in <genexpr>
yield from (i for i in get_instructions(code_object) if i.opname != "EXTENDED_ARG")
File "C:\Users\pay-7\AppData\Local\Programs\Python\Python310\lib\dis.py", line 338, in _get_instructions_bytes
argval, argrepr = _get_const_info(arg, constants)
File "C:\Users\pay-7\AppData\Local\Programs\Python\Python310\lib\dis.py", line 292, in _get_const_info
argval = const_list[const_index]
IndexError: tuple index out of range
I cant find fix, only that Matplotlib had problems with PIL and PyInstaller.
And i see in terminal that "Jinja2" had problems, i dont what was JinJa2
I try add --hidden-import with Matplotlib and PIL, but dosnt work
I try use other versions of Python, PyInstaller,MatPlotLib and Pillow, but dosnt work
I dont know what more i can try
Help me please.
I cant find fix, only that Matplotlib had problems with PIL and PyInstaller.
Help me fix this please.

Related

RuntimeError: reentrant call inside <_io.BufferedWriter name='<stderr>'>

Im running Nginx + Gunicorn + FastAPI application. I have rather simple ML application in my file main.py.
I used this manual to set (Russian translate):
[Развертывайте приложение Fastapi на Ubuntu с Nginx, Gunicorn и UVicorn][1]
When I'm trying to check
gunicorn -w 4 -k uvicorn.workers.UvicornWorker main:app
I see this error
File "/var/www/ste/venv/lib/python3.8/site-packages/gunicorn/arbiter.py", line 211, in run
self.manage_workers()
File "/var/www/ste/venv/lib/python3.8/site-packages/gunicorn/arbiter.py", line 551, in manage_workers
self.spawn_workers()
File "/var/www/ste/venv/lib/python3.8/site-packages/gunicorn/arbiter.py", line 623, in spawn_workers
time.sleep(0.1 * random.random())
File "/var/www/ste/venv/lib/python3.8/site-packages/gunicorn/arbiter.py", line 242, in handle_chld
self.reap_workers()
File "/var/www/ste/venv/lib/python3.8/site-packages/gunicorn/arbiter.py", line 530, in reap_workers
self.log.warning(
File "/var/www/ste/venv/lib/python3.8/site-packages/gunicorn/glogging.py", line 261, in warning
self.error_log.warning(msg, *args, **kwargs)
File "/usr/lib/python3.8/logging/__init__.py", line 1458, in warning
self._log(WARNING, msg, args, **kwargs)
File "/usr/lib/python3.8/logging/__init__.py", line 1589, in _log
self.handle(record)
File "/usr/lib/python3.8/logging/__init__.py", line 1599, in handle
self.callHandlers(record)
File "/usr/lib/python3.8/logging/__init__.py", line 1661, in callHandlers
hdlr.handle(record)
File "/usr/lib/python3.8/logging/__init__.py", line 954, in handle
self.emit(record)
File "/usr/lib/python3.8/logging/__init__.py", line 1093, in emit
self.handleError(record)
File "/usr/lib/python3.8/logging/__init__.py", line 1007, in handleError
traceback.print_exception(t, v, tb, None, sys.stderr)
File "/usr/lib/python3.8/traceback.py", line 105, in print_exception
print(line, file=file, end="")
File "/var/www/ste/venv/lib/python3.8/site-packages/gunicorn/arbiter.py", line 242, in handle_chld
self.reap_workers()
File "/var/www/ste/venv/lib/python3.8/site-packages/gunicorn/arbiter.py", line 530, in reap_workers
self.log.warning(
File "/var/www/ste/venv/lib/python3.8/site-packages/gunicorn/glogging.py", line 261, in warning
self.error_log.warning(msg, *args, **kwargs)
File "/usr/lib/python3.8/logging/__init__.py", line 1458, in warning
self._log(WARNING, msg, args, **kwargs)
File "/usr/lib/python3.8/logging/__init__.py", line 1589, in _log
self.handle(record)
File "/usr/lib/python3.8/logging/__init__.py", line 1599, in handle
self.callHandlers(record)
File "/usr/lib/python3.8/logging/__init__.py", line 1661, in callHandlers
hdlr.handle(record)
File "/usr/lib/python3.8/logging/__init__.py", line 954, in handle
self.emit(record)
File "/usr/lib/python3.8/logging/__init__.py", line 1093, in emit
self.handleError(record)
File "/usr/lib/python3.8/logging/__init__.py", line 1006, in handleError
sys.stderr.write('--- Logging error ---\n')
RuntimeError: reentrant call inside <_io.BufferedWriter name='<stderr>'>
[2022-02-21 21:02:44 +0300] [650] [WARNING] Worker with pid 656 was terminated due to signal 4 ```
I have file main.py and app in it. Any ideas how to handle this error?
[1]: https://pythobyte.com/deploy-fastapi-application-on-ubuntu-with-nginx-gunicorn-and-uvicorn-3mbl-f789b2df/

IndexError: tuple index out of range when I try to create an executable from a python script using auto-py-to-exe

I have been trying out an open-sourced personal AI assistant script. The script works fine but I want to create an executable so that I can gift the executable to one of my friends. However, when I try to create the executable using the auto-py-to-exe, it states the below error:
Running auto-py-to-exe v2.10.1
Building directory: C:\Users\Tarun\AppData\Local\Temp\tmpjaw1ky1x
Provided command: pyinstaller --noconfirm --onedir --console --no-embed-manifest "C:/Users/Tarun/AppData/Local/Programs/Python/Python310/AI_Ass.py"
Recursion Limit is set to 5000
Executing: pyinstaller --noconfirm --onedir --console --no-embed-manifest C:/Users/Tarun/AppData/Local/Programs/Python/Python310/AI_Ass.py --distpath C:\Users\Tarun\AppData\Local\Temp\tmpjaw1ky1x\application --workpath C:\Users\Tarun\AppData\Local\Temp\tmpjaw1ky1x\build --specpath C:\Users\Tarun\AppData\Local\Temp\tmpjaw1ky1x
42681 INFO: PyInstaller: 4.6
42690 INFO: Python: 3.10.0
42732 INFO: Platform: Windows-10-10.0.19042-SP0
42744 INFO: wrote C:\Users\Tarun\AppData\Local\Temp\tmpjaw1ky1x\AI_Ass.spec
42764 INFO: UPX is not available.
42772 INFO: Extending PYTHONPATH with paths
['C:\\Users\\Tarun\\AppData\\Local\\Programs\\Python\\Python310']
43887 INFO: checking Analysis
43891 INFO: Building Analysis because Analysis-00.toc is non existent
43895 INFO: Initializing module dependency graph...
43915 INFO: Caching module graph hooks...
43975 INFO: Analyzing base_library.zip ...
54298 INFO: Processing pre-find module path hook distutils from 'C:\\Users\\Tarun\\AppData\\Local\\Programs\\Python\\Python310\\lib\\site-packages\\PyInstaller\\hooks\\pre_find_module_path\\hook-distutils.py'.
54306 INFO: distutils: retargeting to non-venv dir 'C:\\Users\\Tarun\\AppData\\Local\\Programs\\Python\\Python310\\lib'
57474 INFO: Caching module dependency graph...
58088 INFO: running Analysis Analysis-00.toc
58132 INFO: Adding Microsoft.Windows.Common-Controls to dependent assemblies of final executable
required by C:\Users\Tarun\AppData\Local\Programs\Python\Python310\python.exe
58365 INFO: Analyzing C:\Users\Tarun\AppData\Local\Programs\Python\Python310\AI_Ass.py
59641 INFO: Processing pre-safe import module hook urllib3.packages.six.moves from 'C:\\Users\\Tarun\\AppData\\Local\\Programs\\Python\\Python310\\lib\\site-packages\\PyInstaller\\hooks\\pre_safe_import_module\\hook-urllib3.packages.six.moves.py'.
An error occurred while packaging
Traceback (most recent call last):
File "C:\Users\Tarun\AppData\Local\Programs\Python\Python310\lib\site-packages\auto_py_to_exe\packaging.py", line 131, in package
run_pyinstaller()
File "C:\Users\Tarun\AppData\Local\Programs\Python\Python310\lib\site-packages\PyInstaller\__main__.py", line 124, in run
run_build(pyi_config, spec_file, **vars(args))
File "C:\Users\Tarun\AppData\Local\Programs\Python\Python310\lib\site-packages\PyInstaller\__main__.py", line 58, in run_build
PyInstaller.building.build_main.main(pyi_config, spec_file, **kwargs)
File "C:\Users\Tarun\AppData\Local\Programs\Python\Python310\lib\site-packages\PyInstaller\building\build_main.py", line 782, in main
build(specfile, kw.get('distpath'), kw.get('workpath'), kw.get('clean_build'))
File "C:\Users\Tarun\AppData\Local\Programs\Python\Python310\lib\site-packages\PyInstaller\building\build_main.py", line 714, in build
exec(code, spec_namespace)
File "C:\Users\Tarun\AppData\Local\Temp\tmpjaw1ky1x\AI_Ass.spec", line 7, in <module>
a = Analysis(['C:/Users/Tarun/AppData/Local/Programs/Python/Python310/AI_Ass.py'],
File "C:\Users\Tarun\AppData\Local\Programs\Python\Python310\lib\site-packages\PyInstaller\building\build_main.py", line 277, in __init__
self.__postinit__()
File "C:\Users\Tarun\AppData\Local\Programs\Python\Python310\lib\site-packages\PyInstaller\building\datastruct.py", line 155, in __postinit__
self.assemble()
File "C:\Users\Tarun\AppData\Local\Programs\Python\Python310\lib\site-packages\PyInstaller\building\build_main.py", line 439, in assemble
priority_scripts.append(self.graph.add_script(script))
File "C:\Users\Tarun\AppData\Local\Programs\Python\Python310\lib\site-packages\PyInstaller\depend\analysis.py", line 265, in add_script
self._top_script_node = super().add_script(pathname)
File "C:\Users\Tarun\AppData\Local\Programs\Python\Python310\lib\site-packages\PyInstaller\lib\modulegraph\modulegraph.py", line 1433, in add_script
self._process_imports(n)
File "C:\Users\Tarun\AppData\Local\Programs\Python\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:\Users\Tarun\AppData\Local\Programs\Python\Python310\lib\site-packages\PyInstaller\lib\modulegraph\modulegraph.py", line 2301, in _safe_import_hook
target_modules = self.import_hook(
File "C:\Users\Tarun\AppData\Local\Programs\Python\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:\Users\Tarun\AppData\Local\Programs\Python\Python310\lib\site-packages\PyInstaller\lib\modulegraph\modulegraph.py", line 1684, in _find_head_package
target_package = self._safe_import_module(
File "C:\Users\Tarun\AppData\Local\Programs\Python\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:\Users\Tarun\AppData\Local\Programs\Python\Python310\lib\site-packages\PyInstaller\lib\modulegraph\modulegraph.py", line 2062, in _safe_import_module
self._process_imports(n)
File "C:\Users\Tarun\AppData\Local\Programs\Python\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:\Users\Tarun\AppData\Local\Programs\Python\Python310\lib\site-packages\PyInstaller\lib\modulegraph\modulegraph.py", line 2301, in _safe_import_hook
target_modules = self.import_hook(
File "C:\Users\Tarun\AppData\Local\Programs\Python\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:\Users\Tarun\AppData\Local\Programs\Python\Python310\lib\site-packages\PyInstaller\lib\modulegraph\modulegraph.py", line 1684, in _find_head_package
target_package = self._safe_import_module(
File "C:\Users\Tarun\AppData\Local\Programs\Python\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:\Users\Tarun\AppData\Local\Programs\Python\Python310\lib\site-packages\PyInstaller\lib\modulegraph\modulegraph.py", line 2062, in _safe_import_module
self._process_imports(n)
File "C:\Users\Tarun\AppData\Local\Programs\Python\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:\Users\Tarun\AppData\Local\Programs\Python\Python310\lib\site-packages\PyInstaller\lib\modulegraph\modulegraph.py", line 2301, in _safe_import_hook
target_modules = self.import_hook(
File "C:\Users\Tarun\AppData\Local\Programs\Python\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:\Users\Tarun\AppData\Local\Programs\Python\Python310\lib\site-packages\PyInstaller\lib\modulegraph\modulegraph.py", line 1684, in _find_head_package
target_package = self._safe_import_module(
File "C:\Users\Tarun\AppData\Local\Programs\Python\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:\Users\Tarun\AppData\Local\Programs\Python\Python310\lib\site-packages\PyInstaller\lib\modulegraph\modulegraph.py", line 2062, in _safe_import_module
self._process_imports(n)
File "C:\Users\Tarun\AppData\Local\Programs\Python\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:\Users\Tarun\AppData\Local\Programs\Python\Python310\lib\site-packages\PyInstaller\lib\modulegraph\modulegraph.py", line 2301, in _safe_import_hook
target_modules = self.import_hook(
File "C:\Users\Tarun\AppData\Local\Programs\Python\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:\Users\Tarun\AppData\Local\Programs\Python\Python310\lib\site-packages\PyInstaller\lib\modulegraph\modulegraph.py", line 1684, in _find_head_package
target_package = self._safe_import_module(
File "C:\Users\Tarun\AppData\Local\Programs\Python\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:\Users\Tarun\AppData\Local\Programs\Python\Python310\lib\site-packages\PyInstaller\lib\modulegraph\modulegraph.py", line 2062, in _safe_import_module
self._process_imports(n)
File "C:\Users\Tarun\AppData\Local\Programs\Python\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:\Users\Tarun\AppData\Local\Programs\Python\Python310\lib\site-packages\PyInstaller\lib\modulegraph\modulegraph.py", line 2301, in _safe_import_hook
target_modules = self.import_hook(
File "C:\Users\Tarun\AppData\Local\Programs\Python\Python310\lib\site-packages\PyInstaller\lib\modulegraph\modulegraph.py", line 1518, in import_hook
submodule = self._safe_import_module(head, mname, submodule)
File "C:\Users\Tarun\AppData\Local\Programs\Python\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:\Users\Tarun\AppData\Local\Programs\Python\Python310\lib\site-packages\PyInstaller\lib\modulegraph\modulegraph.py", line 2062, in _safe_import_module
self._process_imports(n)
File "C:\Users\Tarun\AppData\Local\Programs\Python\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:\Users\Tarun\AppData\Local\Programs\Python\Python310\lib\site-packages\PyInstaller\lib\modulegraph\modulegraph.py", line 2301, in _safe_import_hook
target_modules = self.import_hook(
File "C:\Users\Tarun\AppData\Local\Programs\Python\Python310\lib\site-packages\PyInstaller\lib\modulegraph\modulegraph.py", line 1518, in import_hook
submodule = self._safe_import_module(head, mname, submodule)
File "C:\Users\Tarun\AppData\Local\Programs\Python\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:\Users\Tarun\AppData\Local\Programs\Python\Python310\lib\site-packages\PyInstaller\lib\modulegraph\modulegraph.py", line 2062, in _safe_import_module
self._process_imports(n)
File "C:\Users\Tarun\AppData\Local\Programs\Python\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:\Users\Tarun\AppData\Local\Programs\Python\Python310\lib\site-packages\PyInstaller\lib\modulegraph\modulegraph.py", line 2301, in _safe_import_hook
target_modules = self.import_hook(
File "C:\Users\Tarun\AppData\Local\Programs\Python\Python310\lib\site-packages\PyInstaller\lib\modulegraph\modulegraph.py", line 1518, in import_hook
submodule = self._safe_import_module(head, mname, submodule)
File "C:\Users\Tarun\AppData\Local\Programs\Python\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:\Users\Tarun\AppData\Local\Programs\Python\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:\Users\Tarun\AppData\Local\Programs\Python\Python310\lib\site-packages\PyInstaller\lib\modulegraph\modulegraph.py", line 2645, in _scan_code
self._scan_bytecode(
File "C:\Users\Tarun\AppData\Local\Programs\Python\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:\Users\Tarun\AppData\Local\Programs\Python\Python310\lib\site-packages\PyInstaller\lib\modulegraph\util.py", line 147, in iterate_instructions
yield from iterate_instructions(constant)
File "C:\Users\Tarun\AppData\Local\Programs\Python\Python310\lib\site-packages\PyInstaller\lib\modulegraph\util.py", line 139, in iterate_instructions
yield from get_instructions(code_object)
File "C:\Users\Tarun\AppData\Local\Programs\Python\Python310\lib\dis.py", line 338, in _get_instructions_bytes
argval, argrepr = _get_const_info(arg, constants)
File "C:\Users\Tarun\AppData\Local\Programs\Python\Python310\lib\dis.py", line 292, in _get_const_info
argval = const_list[const_index]
IndexError: tuple index out of range
Project output will not be moved to output folder
Complete.
I understand that there is a thread already about similar issue but it still doesn't solve the issue. Hence seeking out help
I really have no idea why is the error occurring and how to resolve it. I am pasting the script below for your reference. Can some one please help? Thank you in advance
#importing libraries
import speech_recognition as sr
import pyttsx3
import datetime
import wikipedia
import webbrowser
import os
import time
import subprocess
from ecapture import ecapture as ec
import wolframalpha
import json
import requests
#setting up speech engine
engine=pyttsx3.init('sapi5')
voices=engine.getProperty('voices')
engine.setProperty('voice','voices[1].id')
def speak(text):
engine.say(text)
engine.runAndWait()
#Greet user
def wishMe():
hour=datetime.datetime.now().hour
if hour>=0 and hour<12:
speak("Hello,Good Morning")
print("Hello,Good Morning")
elif hour>=12 and hour<18:
speak("Hello,Good Afternoon")
print("Hello,Good Afternoon")
else:
speak("Hello,Good Evening")
print("Hello,Good Evening")
#Setting up the command function for your AI assistant
def takeCommand():
r=sr.Recognizer()
with sr.Microphone() as source:
print("Listening...")
audio=r.listen(source)
try:
statement=r.recognize_google(audio,language='en-in')
print(f"user said:{statement}\n")
except Exception as e:
speak("Pardon me, please say that again")
return "None"
return statement
print("Loading your AI personal assistant Friday")
speak("Loading your AI personal assistant Friday")
wishMe()
#main function
if __name__=='__main__':
while True:
speak("Tell me how can I help you now?")
statement = takeCommand().lower()
if statement==0:
continue
if "good bye" in statement or "ok bye" in statement or "stop" in statement:
speak('your personal assistant Friday is shutting down,Good bye')
print('your personal assistant Friday is shutting down,Good bye')
break
if 'wikipedia' in statement:
speak('Searching Wikipedia...')
statement =statement.replace("wikipedia", "")
results = wikipedia.summary(statement, sentences=10)
webbrowser.open_new_tab("https://en.wikipedia.org/wiki/"+ statement)
speak("According to Wikipedia")
print(results)
speak(results)
elif 'open youtube' in statement:
webbrowser.register('chrome', None,
webbrowser.BackgroundBrowser("C://Program Files (x86)//Google//Chrome//Application//chrome.exe"))
webbrowser.get('chrome').open_new_tab("https://www.youtube.com")
#webbrowser.open_new_tab("https://www.youtube.com")
speak("youtube is open now")
time.sleep(5)
elif 'open google' in statement:
webbrowser.open_new_tab("https://www.google.com")
speak("Google chrome is open now")
time.sleep(5)
elif 'open gmail' in statement:
webbrowser.open_new_tab("gmail.com")
speak("Google Mail open now")
time.sleep(5)
elif 'time' in statement:
strTime=datetime.datetime.now().strftime("%H:%M:%S")
speak(f"the time is {strTime}")
elif 'news' in statement:
news = webbrowser.open_new_tab("https://timesofindia.indiatimes.com/home/headlines")
speak('Here are some headlines from the Times of India,Happy reading')
time.sleep(6)
elif "camera" in statement or "take a photo" in statement:
ec.capture(0,"robo camera","img.jpg")
elif 'search' in statement:
statement = statement.replace("search", "")
webbrowser.open_new_tab(statement)
time.sleep(5)
elif 'who are you' in statement or 'what can you do' in statement:
speak('I am Friday version 1 point O your personal assistant. I am programmed to minor tasks like'
'opening youtube,google chrome, gmail and stackoverflow ,predict time,take a photo,search wikipedia,predict weather'
'In different cities, get top headline news from times of india and you can ask me computational or geographical questions too!')
elif "who made you" in statement or "who created you" in statement or "who discovered you" in statement:
speak("I was built by Mirthula")
print("I was built by Mirthula")
elif "log off" in statement or "sign out" in statement:
speak("Ok , your pc will log off in 10 sec make sure you exit from all applications")
subprocess.call(["shutdown", "/l"])
time.sleep(3)
This is a Python 3.10 issue.
To fix it:
You have to go to the folder "Python310\Lib" and edit the file 'dis.py'.
In the 'dis.py' file you have to find this "def _unpack_opargs" and inside the else statement write a new line with this: "extended_arg = 0", then save the file.
I did something like that:
else:
arg = None
extended_arg = 0
yield (i, op, arg)
and everything is working fine now.
I found the solution here:
https://bugs.python.org/issue45757
https://github.com/pyinstaller/pyinstaller/issues/6301
Python 3.10.2+ will fix your issue. If you can't wait, add extended_arg = 0 to line 431 in the dis.py module as seen below.
https://github.com/python/cpython/commit/c5bfb88eb6f82111bb1603ae9d78d0476b552d66#
If you are like me and installed Python 3.10 from an older version, you may face some other issues due to installing packages at the system level and at the user level. Make sure packages are installed to the intended location.
42681 INFO: PyInstaller: 4.6
42690 INFO: Python: 3.10.0
There's the issue. Python 3.10.0 has a bug with PyInstaller 4.6. The problem isn't you or PyInstaller. Try converting it using Python 3.9.7 instead. Ironic, considering 3.10.0 was suppose to be a bugfix update.
you need to add
extended_arg = 0
on line number 431 in Lib/dis.py file
please refer
https://github.com/python/cpython/commit/c5bfb88eb6f82111bb1603ae9d78d0476b552d66#
use py2exe as an alternate may work sometimes
pip install py2exe
write the following code and save it in somename.py with your file name that needs to be converted as exe in the same file location
from distutils.core import setup
import py2exe
setup(console=['yourfilename.py'])
now go to cmd in the same location and run somename.py file as python somename.py py2exe

in process NameError: name 'monitoring_v3' is not defined [while running 'PubSub Unread Messages-ptransform-32']

Not able to run the dataflow for streaming and getting the count of unread messages
I needed a streaming dataflow to monitor the unread messagaes
Is there any issue in my code.
import logging
import datetime
import argparse
import yaml
import apache_beam as beam
from apache_beam import Pipeline, ParDo, DoFn
from apache_beam.options.pipeline_options import PipelineOptions
from google.cloud import monitoring_v3
from google.cloud.monitoring_v3 import query
class unread(DoFn):
def __init__(self, project, pubsub_subscription):
self.project = project
self.pubsub_subscription = pubsub_subscription
def process(self, key_value):
logging.info("Key_value {}".format(key_value))
client = monitoring_v3.MetricServiceClient()
result = query.Query(
client,
project,
'pubsub.googleapis.com/subscription/num_undelivered_messages',
end_time=datetime.datetime.now(),
minutes=2,
).as_dataframe()
if result.empty:
logging.info("All Messages Read")
else:
logging.info(result['pubsub_subscription'][self.project][self.pubsub_subscription][0])
return result
def run():
pipeline_args = [arguments passed
]
logging.info("Pipeline Arguments: {}".format(pipeline_args))
try:
# Set `save_main_session` to True so DoFns can access globally imported modules.
pipeline_options = PipelineOptions(
pipeline_args, streaming=True, save_main_session=True
)
with Pipeline(options=pipeline_options) as pipeline:
(
pipeline
| 'Initializing ' >> beam.Create(['1'])
| 'PubSub Unread Messages' >> ParDo(unread(project, pubsub_subscription))
)
except Exception as e:
logging.error("Failed to Deploy DataFlow Pipeline. Error {}".format(e))
if __name__ == "__main__":
with open("input.yaml", 'r') as yamlfile:
cfg = yaml.load(yamlfile, Loader=yaml.BaseLoader)
logging.basicConfig(format='%(asctime)s %(levelname)s - %(message)s', datefmt='%y-%m-%d %H:%M:%S', level=logging.INFO)
parser = argparse.ArgumentParser()
known_args, pipeline_args = parser.parse_known_args()
run()
Error message:
Error message from worker: generic::unknown: Traceback (most recent call last): File "apache_beam/runners/common.py", line 1233, in apache_beam.runners.common.DoFnRunner.process File "apache_beam/runners/common.py", line 582, in apache_beam.runners.common.SimpleInvoker.invoke_process File "unread.py", line 18, in process NameError: name 'monitoring_v3' is not defined During handling of the above exception, another exception occurred: Traceback (most recent call last): File "/usr/local/lib/python3.7/site-packages/apache_beam/runners/worker/sdk_worker.py", line 289, in _execute response = task() File "/usr/local/lib/python3.7/site-packages/apache_beam/runners/worker/sdk_worker.py", line 362, in lambda: self.create_worker().do_instruction(request), request) File "/usr/local/lib/python3.7/site-packages/apache_beam/runners/worker/sdk_worker.py", line 607, in do_instruction getattr(request, request_type), request.instruction_id) File "/usr/local/lib/python3.7/site-packages/apache_beam/runners/worker/sdk_worker.py", line 644, in process_bundle bundle_processor.process_bundle(instruction_id)) File "/usr/local/lib/python3.7/site-packages/apache_beam/runners/worker/bundle_processor.py", line 1001, in process_bundle element.data) File "/usr/local/lib/python3.7/site-packages/apache_beam/runners/worker/bundle_processor.py", line 229, in process_encoded self.output(decoded_value) File "apache_beam/runners/worker/operations.py", line 356, in apache_beam.runners.worker.operations.Operation.output File "apache_beam/runners/worker/operations.py", line 358, in apache_beam.runners.worker.operations.Operation.output File "apache_beam/runners/worker/operations.py", line 220, in apache_beam.runners.worker.operations.SingletonConsumerSet.receive File "apache_beam/runners/worker/operations.py", line 717, in apache_beam.runners.worker.operations.DoOperation.process File "apache_beam/runners/worker/operations.py", line 718, in apache_beam.runners.worker.operations.DoOperation.process File "apache_beam/runners/common.py", line 1235, in apache_beam.runners.common.DoFnRunner.process File "apache_beam/runners/common.py", line 1300, in apache_beam.runners.common.DoFnRunner._reraise_augmented File "apache_beam/runners/common.py", line 1233, in apache_beam.runners.common.DoFnRunner.process File "apache_beam/runners/common.py", line 581, in apache_beam.runners.common.SimpleInvoker.invoke_process File "apache_beam/runners/common.py", line 1395, in apache_beam.runners.common._OutputProcessor.process_outputs File "apache_beam/runners/worker/operations.py", line 220, in apache_beam.runners.worker.operations.SingletonConsumerSet.receive File "apache_beam/runners/worker/operations.py", line 717, in apache_beam.runners.worker.operations.DoOperation.process File "apache_beam/runners/worker/operations.py", line 718, in apache_beam.runners.worker.operations.DoOperation.process File "apache_beam/runners/common.py", line 1235, in apache_beam.runners.common.DoFnRunner.process File "apache_beam/runners/common.py", line 1300, in apache_beam.runners.common.DoFnRunner._reraise_augmented File "apache_beam/runners/common.py", line 1233, in apache_beam.runners.common.DoFnRunner.process File "apache_beam/runners/common.py", line 581, in apache_beam.runners.common.SimpleInvoker.invoke_process File "apache_beam/runners/common.py", line 1395, in apache_beam.runners.common._OutputProcessor.process_outputs File "apache_beam/runners/worker/operations.py", line 220, in apache_beam.runners.worker.operations.SingletonConsumerSet.receive File "apache_beam/runners/worker/operations.py", line 717, in apache_beam.runners.worker.operations.DoOperation.process File "apache_beam/runners/worker/operations.py", line 718, in apache_beam.runners.worker.operations.DoOperation.process File "apache_beam/runners/common.py", line 1235, in apache_beam.runners.common.DoFnRunner.process File "apache_beam/runners/common.py", line 1315, in apache_beam.runners.common.DoFnRunner._reraise_augmented File "/usr/local/lib/python3.7/site-packages/future/utils/init.py", line 446, in raise_with_traceback raise exc.with_traceback(traceback) File "apache_beam/runners/common.py", line 1233, in apache_beam.runners.common.DoFnRunner.process File "apache_beam/runners/common.py", line 582, in apache_beam.runners.common.SimpleInvoker.invoke_process File "unread.py", line 18, in process NameError: name 'monitoring_v3' is not defined [while running 'PubSub Unread Messages-ptransform-32']
See how to handle name error here.
Try importing the module inside the function, or enable the --save_main_session pipeline option.
The default python dependencies that are installed on the workers are lister here -
https://cloud.google.com/dataflow/docs/concepts/sdk-worker-dependencies#python-3.7.10
To install additional packages please follow the steps as mentioned here - https://beam.apache.org/documentation/sdks/python-pipeline-dependencies/

PyInstaller Error when converting Python 3.6 code to .exe

I made a script with Python 3.6 and I´m trying to convert it to an .exe. I already install everything I need, but Im showing a weird error. Im using python-docx, but it does not say anything about it in the official supported packages documentation. I just want to know whats wrong and how to fix it. This is the error.
Sorry if it is a bit long. The script consist of a main file and several others, is to long to post here and also Im using threading.
C:\Users\barrerakj\Desktop\Jarvis>pyinstaller.exe busqueda.py 180
INFO: PyInstaller: 3.2.1 180 INFO: Python: 3.6.1 181 INFO: Platform:
Windows-7-6.1.7601-SP1 182 INFO: wrote
C:\Users\barrerakj\Desktop\Jarvis\busqueda.spec 185 INFO: UPX is not
available. 189 INFO: Extending PYTHONPATH with paths
['C:\Users\barrerakj\Desktop\Jarvis',
'C:\Users\barrerakj\Desktop\Jarvis'] 189 INFO: checking Analysis
189 INFO: Building Analysis because out00-Analysis.toc is non existent
190 INFO: Initializing module dependency graph... 195 INFO:
Initializing module graph hooks... 199 INFO: Analyzing
base_library.zip ... Traceback (most recent call last): File
"C:\Users\barrerakj\AppData\Local\Programs\Python\Python36-32\Scripts\pyi
nstaller-script.py", line 11, in
load_entry_point('PyInstaller==3.2.1', 'console_scripts', 'pyinstaller')() File
"C:\Users\barrerakj\AppData\Local\Programs\Python\Python36-32\lib\site-pa
ckages\pyinstaller-3.2.1-py3.6.egg\PyInstaller__main__.py", line 90,
in run
run_build(pyi_config, spec_file, **vars(args)) File "C:\Users\barrerakj\AppData\Local\Programs\Python\Python36-32\lib\site-pa
ckages\pyinstaller-3.2.1-py3.6.egg\PyInstaller__main__.py", line 46,
in run_bui ld
PyInstaller.building.build_main.main(pyi_config, spec_file, **kwargs) File "C:\Users\barrerakj\AppData\Local\Programs\Python\Python36-32\lib\site-pa
ckages\pyinstaller-3.2.1-py3.6.egg\PyInstaller\building\build_main.py",
line 788 , in main
build(specfile, kw.get('distpath'), kw.get('workpath'), kw.get('clean_build' )) File
"C:\Users\barrerakj\AppData\Local\Programs\Python\Python36-32\lib\site-pa
ckages\pyinstaller-3.2.1-py3.6.egg\PyInstaller\building\build_main.py",
line 734 , in build
exec(text, spec_namespace) File "", line 16, in File
"C:\Users\barrerakj\AppData\Local\Programs\Python\Python36-32\lib\site-pa
ckages\pyinstaller-3.2.1-py3.6.egg\PyInstaller\building\build_main.py",
line 212 , in init
self.postinit() File "C:\Users\barrerakj\AppData\Local\Programs\Python\Python36-32\lib\site-pa
ckages\pyinstaller-3.2.1-py3.6.egg\PyInstaller\building\datastruct.py",
line 161 , in postinit
self.assemble() File "C:\Users\barrerakj\AppData\Local\Programs\Python\Python36-32\lib\site-pa
ckages\pyinstaller-3.2.1-py3.6.egg\PyInstaller\building\build_main.py",
line 317 , in assemble
excludes=self.excludes, user_hook_dirs=self.hookspath) File "C:\Users\barrerakj\AppData\Local\Programs\Python\Python36-32\lib\site-pa
ckages\pyinstaller-3.2.1-py3.6.egg\PyInstaller\depend\analysis.py",
line 560, in initialize_modgraph
graph.import_hook(m) File "C:\Users\barrerakj\AppData\Local\Programs\Python\Python36-32\lib\site-pa
ckages\pyinstaller-3.2.1-py3.6.egg\PyInstaller\lib\modulegraph\modulegraph.py",
line 1509, in import_hook
source_package, target_module_partname, level) File "C:\Users\barrerakj\AppData\Local\Programs\Python\Python36-32\lib\site-pa
ckages\pyinstaller-3.2.1-py3.6.egg\PyInstaller\lib\modulegraph\modulegraph.py",
line 1661, in _find_head_package
target_module_headname, target_package_name, source_package) File
"C:\Users\barrerakj\AppData\Local\Programs\Python\Python36-32\lib\site-pa
ckages\pyinstaller-3.2.1-py3.6.egg\PyInstaller\depend\analysis.py",
line 209, in _safe_import_module
module_basename, module_name, parent_package) File "C:\Users\barrerakj\AppData\Local\Programs\Python\Python36-32\lib\site-pa
ckages\pyinstaller-3.2.1-py3.6.egg\PyInstaller\lib\modulegraph\modulegraph.py",
line 2077, in _safe_import_module
module_name, file_handle, pathname, metadata) File "C:\Users\barrerakj\AppData\Local\Programs\Python\Python36-32\lib\site-pa
ckages\pyinstaller-3.2.1-py3.6.egg\PyInstaller\lib\modulegraph\modulegraph.py",
line 2115, in _load_module
m = self._load_package(fqname, pathname, packagepath) File "C:\Users\barrerakj\AppData\Local\Programs\Python\Python36-32\lib\site-pa
ckages\pyinstaller-3.2.1-py3.6.egg\PyInstaller\lib\modulegraph\modulegraph.py",
line 2951, in _load_package
self._load_module(fqname, fp, buf, stuff) File "C:\Users\barrerakj\AppData\Local\Programs\Python\Python36-32\lib\site-pa
ckages\pyinstaller-3.2.1-py3.6.egg\PyInstaller\lib\modulegraph\modulegraph.py",
line 2167, in _load_module
self._scan_code(m, co, co_ast) File "C:\Users\barrerakj\AppData\Local\Programs\Python\Python36-32\lib\site-pa
ckages\pyinstaller-3.2.1-py3.6.egg\PyInstaller\lib\modulegraph\modulegraph.py",
line 2585, in _scan_code
module, module_code_object, is_scanning_imports=False) File "C:\Users\barrerakj\AppData\Local\Programs\Python\Python36-32\lib\site-pa
ckages\pyinstaller-3.2.1-py3.6.egg\PyInstaller\lib\modulegraph\modulegraph.py",
line 2831, in _scan_bytecode
global_attr_name = get_operation_arg_name() File "C:\Users\barrerakj\AppData\Local\Programs\Python\Python36-32\lib\site-pa
ckages\pyinstaller-3.2.1-py3.6.egg\PyInstaller\lib\modulegraph\modulegraph.py",
line 2731, in get_operation_arg_name
return module_code_object.co_names[co_names_index] IndexError: tuple index out of range

Pylons Google App Engine installation raise an error

I used latest version of GAE.
I try install Pylons v1.0 with this help article:
http://countergram.com/pylons-google-app-engine
paster serve --reload development.ini
work fine
Apache2+wsgi work fine
But: dev_appserver.py pylons
I have got error message:
INFO:root:Starting admin server at: [Link to localhost:8000 ERROR]
2013-07-11 11:55:07,816 cgi.py:121] Traceback (most recent call last):
File "/home/evgeny/PycharmProjects/pylons/app.py", line 41, in
run_wsgi_app(loadapp('config:development.ini',
relative_to=appdir)) File
"lib/python2.7/site-packages/paste/deploy/loadwsgi.py", line 247, in
loadapp ret*emphasized text*urn loadobj(APP, uri, name=name, **kw) File
"lib/python2.7/site-packages/paste/deploy/loadwsgi.py", line 271, in
loadobj global_conf=global_conf) File
"lib/python2.7/site-packages/paste/deploy/loadwsgi.py", line 296, in
loadcontext global_conf=global_conf) File
"lib/python2.7/site-packages/paste/deploy/loadwsgi.py", line 320, in
_loadconfig return loader.get_context(object_type, name, global_conf) File "lib/python2.7/site-packages/paste/deploy/loadwsgi.py", line 454,
in get_context section) File
"lib/python2.7/site-packages/paste/deploy/loadwsgi.py", line 476, in
_context_from_use object_type, name=use, global_conf=global_conf) File "lib/python2.7/site-packages/paste/deploy/loadwsgi.py", line 406,
in get_context global_conf=global_conf) File
"lib/python2.7/site-packages/paste/deploy/loadwsgi.py", line 296, in
loadcontext global_conf=global_conf) File
"lib/python2.7/site-packages/paste/deploy/loadwsgi.py", line 328, in
_loadegg return loader.get_context(object_type, name, global_conf) File "lib/python2.7/site-packages/paste/deploy/loadwsgi.py", line 620,
in get_context object_type, name=name) File
"lib/python2.7/site-packages/paste/deploy/loadwsgi.py", line 646, in
find_egg_entry_point possible.append((entry.load(), protocol,
entry.name)) File
"lib/python2.7/site-packages/distribute-0.6.19-py2.7.egg/pkg_resources.py",
line 1991, in load entry = import(self.module_name,
globals(),globals(), ['name']) File
"project/project/config/middleware.py", line 9, in from
routes.middleware import RoutesMiddleware File
"lib/python2.7/site-packages/routes/init.py", line 140, in
from routes.mapper import Mapper File
"lib/python2.7/site-packages/routes/mapper.py", line 7, in
from repoze.lru import LRUCache ImportError: No module named
repoze.lru
It's really simple decision.
At virtualenv path:
touch lib/python2.7/site-packages/repoze/__init__.py

Categories

Resources