PySide (shiboken) core dumps depending on script filename
-
My environment is Ubuntu 22.04, Python 3.10.6, Qt 5.15.3, all supplied with distro. I have added PyQt 5.15.6 and PySide2 5.15.2.1 and shiboken2 5.15.2.1. All is working well in general with Python/Qt/PyQt/PySide.
Today I created a script file named
signal.py
with the following content:from PySide2 import QtCore
That's it! Just that one line (or anything else which reads in PySide2).
Then attempting to run
python3 signal.py
core dumps with following:Problem importing shibokensupport: cannot import name 'VoidPtr' from partially initialized module 'shiboken2' (most likely due to a circular import) (/home/jon/.local/lib/python3.10/site-packages/shiboken2/__init__.py) Traceback (most recent call last): File "(builtin)", line 93, in ensure_shibokensupport File "(builtin)", line 133, in bootstrap File "/home/jon/.local/lib/python3.10/site-packages/shiboken2/files.dir/shibokensupport/signature/loader.py", line 222, in <module> move_into_pyside_package() File "/home/jon/.local/lib/python3.10/site-packages/shiboken2/files.dir/shibokensupport/signature/loader.py", line 196, in move_into_pyside_package import PySide2.support File "/home/jon/.local/lib/python3.10/site-packages/PySide2/support/__init__.py", line 40, in <module> from shiboken2 import VoidPtr ImportError: cannot import name 'VoidPtr' from partially initialized module 'shiboken2' (most likely due to a circular import) (/home/jon/.local/lib/python3.10/site-packages/shiboken2/__init__.py) sys.path: /home/jon/.local/lib/python3.10/site-packages/shiboken2/files.dir /home/jon/PySide2 /usr/lib/python310.zip /usr/lib/python3.10 /usr/lib/python3.10/lib-dynload /home/jon/.local/lib/python3.10/site-packages /usr/local/lib/python3.10/dist-packages /usr/lib/python3/dist-packages Traceback (most recent call last): File "(builtin)", line 93, in ensure_shibokensupport File "(builtin)", line 133, in bootstrap File "/home/jon/.local/lib/python3.10/site-packages/shiboken2/files.dir/shibokensupport/signature/loader.py", line 222, in <module> move_into_pyside_package() File "/home/jon/.local/lib/python3.10/site-packages/shiboken2/files.dir/shibokensupport/signature/loader.py", line 196, in move_into_pyside_package import PySide2.support File "/home/jon/.local/lib/python3.10/site-packages/PySide2/support/__init__.py", line 40, in <module> from shiboken2 import VoidPtr ImportError: cannot import name 'VoidPtr' from partially initialized module 'shiboken2' (most likely due to a circular import) (/home/jon/.local/lib/python3.10/site-packages/shiboken2/__init__.py) During handling of the above exception, another exception occurred: Traceback (most recent call last): File "(builtin)", line 132, in bootstrap File "/usr/lib/python3.10/contextlib.py", line 153, in __exit__ self.gen.throw(typ, value, traceback) 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 Fatal Python error: could not initialize part 2 Python runtime state: initialized Current thread 0x00007fad29c10000 (most recent call first): File "/usr/lib/python3.10/subprocess.py", line 450 in CompletedProcess File "/usr/lib/python3.10/subprocess.py", line 424 in <module> File "<frozen importlib._bootstrap>", line 241 in _call_with_frames_removed File "<frozen importlib._bootstrap_external>", line 883 in exec_module File "<frozen importlib._bootstrap>", line 688 in _load_unlocked File "<frozen importlib._bootstrap>", line 1006 in _find_and_load_unlocked File "<frozen importlib._bootstrap>", line 1027 in _find_and_load File "/usr/lib/python3.10/platform.py", line 119 in <module> File "<frozen importlib._bootstrap>", line 241 in _call_with_frames_removed File "<frozen importlib._bootstrap_external>", line 883 in exec_module File "<frozen importlib._bootstrap>", line 688 in _load_unlocked File "<frozen importlib._bootstrap>", line 1006 in _find_and_load_unlocked File "<frozen importlib._bootstrap>", line 1027 in _find_and_load File "/usr/lib/python3/dist-packages/numpy/core/_add_newdocs_scalars.py", line 9 in <module> File "<frozen importlib._bootstrap>", line 241 in _call_with_frames_removed File "<frozen importlib._bootstrap_external>", line 883 in exec_module File "<frozen importlib._bootstrap>", line 688 in _load_unlocked File "<frozen importlib._bootstrap>", line 1006 in _find_and_load_unlocked File "<frozen importlib._bootstrap>", line 1027 in _find_and_load File "<frozen importlib._bootstrap>", line 241 in _call_with_frames_removed File "<frozen importlib._bootstrap>", line 1078 in _handle_fromlist File "/usr/lib/python3/dist-packages/numpy/core/__init__.py", line 99 in <module> File "<frozen importlib._bootstrap>", line 241 in _call_with_frames_removed File "<frozen importlib._bootstrap_external>", line 883 in exec_module File "<frozen importlib._bootstrap>", line 688 in _load_unlocked File "<frozen importlib._bootstrap>", line 1006 in _find_and_load_unlocked File "<frozen importlib._bootstrap>", line 1027 in _find_and_load File "<frozen importlib._bootstrap>", line 241 in _call_with_frames_removed File "<frozen importlib._bootstrap>", line 1078 in _handle_fromlist File "/usr/lib/python3/dist-packages/numpy/__init__.py", line 150 in <module> File "<frozen importlib._bootstrap>", line 241 in _call_with_frames_removed File "<frozen importlib._bootstrap_external>", line 883 in exec_module File "<frozen importlib._bootstrap>", line 688 in _load_unlocked File "<frozen importlib._bootstrap>", line 1006 in _find_and_load_unlocked File "<frozen importlib._bootstrap>", line 1027 in _find_and_load File "<frozen importlib._bootstrap>", line 241 in _call_with_frames_removed File "<frozen importlib._bootstrap>", line 992 in _find_and_load_unlocked File "<frozen importlib._bootstrap>", line 1027 in _find_and_load File "<frozen importlib._bootstrap>", line 241 in _call_with_frames_removed File "<frozen importlib._bootstrap>", line 992 in _find_and_load_unlocked File "<frozen importlib._bootstrap>", line 1027 in _find_and_load File "<frozen importlib._bootstrap>", line 241 in _call_with_frames_removed File "<frozen importlib._bootstrap_external>", line 1176 in create_module File "<frozen importlib._bootstrap>", line 571 in module_from_spec File "<frozen importlib._bootstrap>", line 674 in _load_unlocked File "<frozen importlib._bootstrap>", line 1006 in _find_and_load_unlocked File "<frozen importlib._bootstrap>", line 1027 in _find_and_load File "/home/jon/.local/lib/python3.10/site-packages/shiboken2/__init__.py", line 27 in <module> File "<frozen importlib._bootstrap>", line 241 in _call_with_frames_removed File "<frozen importlib._bootstrap_external>", line 883 in exec_module File "<frozen importlib._bootstrap>", line 688 in _load_unlocked File "<frozen importlib._bootstrap>", line 1006 in _find_and_load_unlocked File "<frozen importlib._bootstrap>", line 1027 in _find_and_load File "/home/jon/.local/lib/python3.10/site-packages/PySide2/__init__.py", line 58 in _setupQtDirectories File "/home/jon/.local/lib/python3.10/site-packages/PySide2/__init__.py", line 107 in <module> File "<frozen importlib._bootstrap>", line 241 in _call_with_frames_removed File "<frozen importlib._bootstrap_external>", line 883 in exec_module File "<frozen importlib._bootstrap>", line 688 in _load_unlocked File "<frozen importlib._bootstrap>", line 1006 in _find_and_load_unlocked File "<frozen importlib._bootstrap>", line 1027 in _find_and_load File "/home/jon/PySide2/signal.py", line 1 in <module> Extension modules: numpy.core._multiarray_umath, numpy.core._multiarray_tests, xxsubtype, PySide2.QtCore, apt_pkg (total: 5) Aborted (core dumped)
Yep, that's what I get :(
If I change
from PySide2 import QtCore
tofrom PyQt5 import QtCore
all is well. So it's a PySide (or shiboken) issue.Sat for a while completely befuddled. Eventually totally on a hunch I renamed script file from
signal.py
toABCsignal.py
. Guess what, sure enough it works fine under PySide2....So that means something about PySide2 cannot cope correctly with certain filenames, doubtless which happen to be the same as supplied one. I note that my Python 3.10 comes with a
/usr/lib/python3.10/signal.py
, which I would guess is the issue. Goodness knows how many other filenames could potentially have similar behaviour.Sorry, but this is terrible, especially since PyQt5 has no problem!
I cannot test with Qt6/PySide6. Would somebody be so kind as to test:
- This one-line program with PySide2, perhaps under Linux. Do you get the same core dump?
- Test with PySide6. Does that work, or is it just as bad?
From this I will know whether/what to report as a PySide bug.
Thank you. -
My environment is Ubuntu 22.04, Python 3.10.6, Qt 5.15.3, all supplied with distro. I have added PyQt 5.15.6 and PySide2 5.15.2.1 and shiboken2 5.15.2.1. All is working well in general with Python/Qt/PyQt/PySide.
Today I created a script file named
signal.py
with the following content:from PySide2 import QtCore
That's it! Just that one line (or anything else which reads in PySide2).
Then attempting to run
python3 signal.py
core dumps with following:Problem importing shibokensupport: cannot import name 'VoidPtr' from partially initialized module 'shiboken2' (most likely due to a circular import) (/home/jon/.local/lib/python3.10/site-packages/shiboken2/__init__.py) Traceback (most recent call last): File "(builtin)", line 93, in ensure_shibokensupport File "(builtin)", line 133, in bootstrap File "/home/jon/.local/lib/python3.10/site-packages/shiboken2/files.dir/shibokensupport/signature/loader.py", line 222, in <module> move_into_pyside_package() File "/home/jon/.local/lib/python3.10/site-packages/shiboken2/files.dir/shibokensupport/signature/loader.py", line 196, in move_into_pyside_package import PySide2.support File "/home/jon/.local/lib/python3.10/site-packages/PySide2/support/__init__.py", line 40, in <module> from shiboken2 import VoidPtr ImportError: cannot import name 'VoidPtr' from partially initialized module 'shiboken2' (most likely due to a circular import) (/home/jon/.local/lib/python3.10/site-packages/shiboken2/__init__.py) sys.path: /home/jon/.local/lib/python3.10/site-packages/shiboken2/files.dir /home/jon/PySide2 /usr/lib/python310.zip /usr/lib/python3.10 /usr/lib/python3.10/lib-dynload /home/jon/.local/lib/python3.10/site-packages /usr/local/lib/python3.10/dist-packages /usr/lib/python3/dist-packages Traceback (most recent call last): File "(builtin)", line 93, in ensure_shibokensupport File "(builtin)", line 133, in bootstrap File "/home/jon/.local/lib/python3.10/site-packages/shiboken2/files.dir/shibokensupport/signature/loader.py", line 222, in <module> move_into_pyside_package() File "/home/jon/.local/lib/python3.10/site-packages/shiboken2/files.dir/shibokensupport/signature/loader.py", line 196, in move_into_pyside_package import PySide2.support File "/home/jon/.local/lib/python3.10/site-packages/PySide2/support/__init__.py", line 40, in <module> from shiboken2 import VoidPtr ImportError: cannot import name 'VoidPtr' from partially initialized module 'shiboken2' (most likely due to a circular import) (/home/jon/.local/lib/python3.10/site-packages/shiboken2/__init__.py) During handling of the above exception, another exception occurred: Traceback (most recent call last): File "(builtin)", line 132, in bootstrap File "/usr/lib/python3.10/contextlib.py", line 153, in __exit__ self.gen.throw(typ, value, traceback) 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 Fatal Python error: could not initialize part 2 Python runtime state: initialized Current thread 0x00007fad29c10000 (most recent call first): File "/usr/lib/python3.10/subprocess.py", line 450 in CompletedProcess File "/usr/lib/python3.10/subprocess.py", line 424 in <module> File "<frozen importlib._bootstrap>", line 241 in _call_with_frames_removed File "<frozen importlib._bootstrap_external>", line 883 in exec_module File "<frozen importlib._bootstrap>", line 688 in _load_unlocked File "<frozen importlib._bootstrap>", line 1006 in _find_and_load_unlocked File "<frozen importlib._bootstrap>", line 1027 in _find_and_load File "/usr/lib/python3.10/platform.py", line 119 in <module> File "<frozen importlib._bootstrap>", line 241 in _call_with_frames_removed File "<frozen importlib._bootstrap_external>", line 883 in exec_module File "<frozen importlib._bootstrap>", line 688 in _load_unlocked File "<frozen importlib._bootstrap>", line 1006 in _find_and_load_unlocked File "<frozen importlib._bootstrap>", line 1027 in _find_and_load File "/usr/lib/python3/dist-packages/numpy/core/_add_newdocs_scalars.py", line 9 in <module> File "<frozen importlib._bootstrap>", line 241 in _call_with_frames_removed File "<frozen importlib._bootstrap_external>", line 883 in exec_module File "<frozen importlib._bootstrap>", line 688 in _load_unlocked File "<frozen importlib._bootstrap>", line 1006 in _find_and_load_unlocked File "<frozen importlib._bootstrap>", line 1027 in _find_and_load File "<frozen importlib._bootstrap>", line 241 in _call_with_frames_removed File "<frozen importlib._bootstrap>", line 1078 in _handle_fromlist File "/usr/lib/python3/dist-packages/numpy/core/__init__.py", line 99 in <module> File "<frozen importlib._bootstrap>", line 241 in _call_with_frames_removed File "<frozen importlib._bootstrap_external>", line 883 in exec_module File "<frozen importlib._bootstrap>", line 688 in _load_unlocked File "<frozen importlib._bootstrap>", line 1006 in _find_and_load_unlocked File "<frozen importlib._bootstrap>", line 1027 in _find_and_load File "<frozen importlib._bootstrap>", line 241 in _call_with_frames_removed File "<frozen importlib._bootstrap>", line 1078 in _handle_fromlist File "/usr/lib/python3/dist-packages/numpy/__init__.py", line 150 in <module> File "<frozen importlib._bootstrap>", line 241 in _call_with_frames_removed File "<frozen importlib._bootstrap_external>", line 883 in exec_module File "<frozen importlib._bootstrap>", line 688 in _load_unlocked File "<frozen importlib._bootstrap>", line 1006 in _find_and_load_unlocked File "<frozen importlib._bootstrap>", line 1027 in _find_and_load File "<frozen importlib._bootstrap>", line 241 in _call_with_frames_removed File "<frozen importlib._bootstrap>", line 992 in _find_and_load_unlocked File "<frozen importlib._bootstrap>", line 1027 in _find_and_load File "<frozen importlib._bootstrap>", line 241 in _call_with_frames_removed File "<frozen importlib._bootstrap>", line 992 in _find_and_load_unlocked File "<frozen importlib._bootstrap>", line 1027 in _find_and_load File "<frozen importlib._bootstrap>", line 241 in _call_with_frames_removed File "<frozen importlib._bootstrap_external>", line 1176 in create_module File "<frozen importlib._bootstrap>", line 571 in module_from_spec File "<frozen importlib._bootstrap>", line 674 in _load_unlocked File "<frozen importlib._bootstrap>", line 1006 in _find_and_load_unlocked File "<frozen importlib._bootstrap>", line 1027 in _find_and_load File "/home/jon/.local/lib/python3.10/site-packages/shiboken2/__init__.py", line 27 in <module> File "<frozen importlib._bootstrap>", line 241 in _call_with_frames_removed File "<frozen importlib._bootstrap_external>", line 883 in exec_module File "<frozen importlib._bootstrap>", line 688 in _load_unlocked File "<frozen importlib._bootstrap>", line 1006 in _find_and_load_unlocked File "<frozen importlib._bootstrap>", line 1027 in _find_and_load File "/home/jon/.local/lib/python3.10/site-packages/PySide2/__init__.py", line 58 in _setupQtDirectories File "/home/jon/.local/lib/python3.10/site-packages/PySide2/__init__.py", line 107 in <module> File "<frozen importlib._bootstrap>", line 241 in _call_with_frames_removed File "<frozen importlib._bootstrap_external>", line 883 in exec_module File "<frozen importlib._bootstrap>", line 688 in _load_unlocked File "<frozen importlib._bootstrap>", line 1006 in _find_and_load_unlocked File "<frozen importlib._bootstrap>", line 1027 in _find_and_load File "/home/jon/PySide2/signal.py", line 1 in <module> Extension modules: numpy.core._multiarray_umath, numpy.core._multiarray_tests, xxsubtype, PySide2.QtCore, apt_pkg (total: 5) Aborted (core dumped)
Yep, that's what I get :(
If I change
from PySide2 import QtCore
tofrom PyQt5 import QtCore
all is well. So it's a PySide (or shiboken) issue.Sat for a while completely befuddled. Eventually totally on a hunch I renamed script file from
signal.py
toABCsignal.py
. Guess what, sure enough it works fine under PySide2....So that means something about PySide2 cannot cope correctly with certain filenames, doubtless which happen to be the same as supplied one. I note that my Python 3.10 comes with a
/usr/lib/python3.10/signal.py
, which I would guess is the issue. Goodness knows how many other filenames could potentially have similar behaviour.Sorry, but this is terrible, especially since PyQt5 has no problem!
I cannot test with Qt6/PySide6. Would somebody be so kind as to test:
- This one-line program with PySide2, perhaps under Linux. Do you get the same core dump?
- Test with PySide6. Does that work, or is it just as bad?
From this I will know whether/what to report as a PySide bug.
Thank you.Hi,
It did work with PySide6 and PyQt6 on macOS.
I currently don't have PySide2 at hand but will try when I have.
-
Hi,
It did work with PySide6 and PyQt6 on macOS.
I currently don't have PySide2 at hand but will try when I have.
-
@SGaist
Thank you, please try with PySide2 if you have the time.I keep forgetting you are MacOS, for some reason. I am told by Mac users that "everything just works, all the time", so maybe this is hardly surprising ;-)
@JonB It's more a question of architecture. PySide2 is, to the best of my knowledge, not available pre-built for Apple's M series of processor.
As for everything always working, well, that's not absolutely completely true ;-)