Shiboken2
raw JSON → 5.15.2.1 verified Mon Apr 27 auth: no python maintenance
Shiboken2 is the Python binding generator and helper module for PySide2 (Qt for Python, Qt5). This package provides the `shiboken2` runtime module used by PySide2 to manage C++ object ownership and lifetime. Current version: 5.15.2.1 (final PySide2 release). Maintenance-only status; no new releases expected as the project focuses on PySide6.
pip install shiboken2 Common errors
error ModuleNotFoundError: No module named 'shiboken2' ↓
cause shiboken2 is not installed or PySide2 is missing.
fix
Install PySide2: pip install PySide2
error ImportError: cannot import name 'getCppPointer' from 'PySide2' ↓
cause Trying to import shiboken functions from the wrong package.
fix
Use: from shiboken2 import getCppPointer
error RuntimeError: shiboken2. Shiboken needs to be imported after PySide2 ↓
cause shiboken2 module imported before PySide2 initialises Qt.
fix
Always import shiboken2 after PySide2 (or any Qt module) has been imported in your application.
Warnings
breaking shiboken2 5.15.2.1 is the final release for Python 3.10 support. Python 3.11 and above are not supported. ↓
fix Upgrade to PySide6 / shiboken6 for Python 3.11+ support.
deprecated shiboken2 is deprecated in favor of shiboken6. No new features or bug fixes will be released. ↓
fix Migrate to PySide6 and use shiboken6 for new projects.
gotcha shiboken2 cannot be imported directly without PySide2 installed; it is a runtime dependency of PySide2 and lacks standalone wheels. ↓
fix Install PySide2 (e.g., pip install PySide2) which pulls in the correct shiboken2 version.
Imports
- Shiboken wrong
import shibokencorrectfrom shiboken2 import Shiboken - getCppPointer wrong
from PySide2 import getCppPointercorrectfrom shiboken2 import getCppPointer
Quickstart
from shiboken2 import Shiboken
from PySide2.QtWidgets import QWidget
widget = QWidget()
print(Shiboken.getCppPointer(widget))