I have a working python(3.6.8) and Pyside(5.12.0) application.
Previously I was able to create one file exe and its run fine.
But after updating Pyside to 5.12.2 I am not able to run app. there is ModuleNotFoundError: No module named 'typing'
I already have typing module installed(pip install typing). I tried to uninstall pyside(5.12.2) and reinstall pyside(5.12.0)
but still i am getting same error. Here is the error.
Problem importing shibokensupport:
No module named 'typing'
Traceback (most recent call last):
File "(builtin)", line 93, in ensure_shibokensupport
File "(builtin)", line 133, in bootstrap
File "C:\Users\LS0020\AppData\Local\Temp\embedded.u2j069ui.zip\shibokensupport\signature\loader.py", line 156, in <module>
import typing
ModuleNotFoundError: No module named 'typing'
sys.path:
C:\Users\LS0020\AppData\Local\Temp\embedded.u2j069ui.zip
C:\Users\LS0020\AppData\Local\Temp\_MEI101642\base_library.zip
C:\Users\LS0020\AppData\Local\Temp\_MEI101642
Traceback (most recent call last):
File "(builtin)", line 93, in ensure_shibokensupport
File "(builtin)", line 133, in bootstrap
File "C:\Users\LS0020\AppData\Local\Temp\embedded.u2j069ui.zip\shibokensupport\signature\loader.py", line 156, in <module>
ModuleNotFoundError: No module named 'typing'
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "(builtin)", line 133, in bootstrap
File "contextlib.py", line 99, in __exit__
File "(builtin)", line 102, in ensure_shibokensupport
SystemExit: -1
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "(builtin)", line 147, in bootstrap
UnboundLocalError: local variable 'loader' referenced before assignment
SystemError: could not initialize part 2
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "demo.py", line 1, in <module>
File "<frozen importlib._bootstrap>", line 971, in _find_and_load
File "<frozen importlib._bootstrap>", line 955, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 665, in _load_unlocked
File "c:\program files\python36\lib\site-packages\PyInstaller\loader\pyimod03_importers.py", line 627, in exec_module
exec(bytecode, module.__dict__)
File "site-packages\PySide2\__init__.py", line 51, in <module>
File "site-packages\PySide2\__init__.py", line 21, in _setupQtDirectories
File "<frozen importlib._bootstrap>", line 971, in _find_and_load
File "<frozen importlib._bootstrap>", line 955, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 665, in _load_unlocked
File "c:\program files\python36\lib\site-packages\PyInstaller\loader\pyimod03_importers.py", line 627, in exec_module
exec(bytecode, module.__dict__)
SystemError: PyEval_EvalFrameEx returned a result with an error set
[7584] Failed to execute script demo
I had exactly the same problem with cx_freeze. After the build of the cx_freeze application and running I got the error:
Problem importing shibokensupport:
No module named 'typing'
Traceback (most recent call last):
File "(builtin)", line 93, in ensure_shibokensupport
File "(builtin)", line 133, in bootstrap
File "/tmp/embedded.mp0z2vy0.zip/shibokensupport/signature/loader.py", line 156, in <module>
import typing
I added typing
manually to the packages which need's to be included in the cx_freeze setup.py
:
# -*- coding: utf-8 -*-
import sys
from cx_Freeze import setup, Executable
options = {
'build_exe': {
'packages': [
'os',
'typing'
],
'excludes': [
'tkinter'
]
}
}
base = None
if sys.platform == 'win32':
base = 'Win32GUI'
executables = [
Executable('qt_test1.py', base=base)
]
setup(
name='qt_test1',
version='0.1',
description='My GUI application!',
options=options,
executables=executables
)
This does it. It run's now.
It means for PyInstaller you have to call it in this way:
$ pyinstaller your_app.py --hidden-import="typing"
Actually, I do not know if there is a better way for PyInstaller to explicit add modules to the building process.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.