{"id":10125,"library":"pyqt6-qt","title":"PyQt6-Qt Core Components","description":"The `pyqt6-qt` package is a crucial runtime dependency for `PyQt6`, providing the necessary compiled Qt binaries and libraries. It is not intended for direct import or use by application developers but is automatically installed and utilized by the `PyQt6` package to enable GUI functionality. The current version is 6.0.1, reflecting its close tie to the PyQt6 release cycle.","status":"active","version":"6.0.1","language":"en","source_language":"en","source_url":"https://www.riverbankcomputing.com/software/pyqt/intro","tags":["GUI","Qt","toolkit","dependency","frontend"],"install":[{"cmd":"pip install pyqt6-qt","lang":"bash","label":"Install pyqt6-qt (runtime backend)"},{"cmd":"pip install PyQt6","lang":"bash","label":"Install PyQt6 (frontend, pulls pyqt6-qt)"}],"dependencies":[],"imports":[{"note":"pyqt6-qt provides the underlying Qt shared libraries (binaries) that PyQt6 uses. Application code directly imports from the PyQt6 package (e.g., PyQt6.QtWidgets), not from pyqt6-qt. pyqt6-qt is a backend dependency that enables these imports to function.","symbol":"QApplication (enabled by pyqt6-qt)","correct":"from PyQt6.QtWidgets import QApplication"}],"quickstart":{"code":"import sys\nfrom PyQt6.QtWidgets import QApplication, QLabel, QWidget\n\n# Note: pyqt6-qt provides the underlying Qt libraries,\n# enabling the functionality imported from PyQt6.\n\ndef main():\n    app = QApplication(sys.argv)\n    \n    window = QWidget()\n    window.setWindowTitle('PyQt6-Qt Enabled App')\n    window.setGeometry(100, 100, 280, 80)\n    \n    hello_label = QLabel('Hello, PyQt6!', parent=window)\n    hello_label.move(60, 15)\n    \n    window.show()\n    sys.exit(app.exec())\n\nif __name__ == '__main__':\n    main()","lang":"python","description":"This quickstart demonstrates a basic PyQt6 application. While `pyqt6-qt` is not directly imported, it is a mandatory runtime dependency that provides the underlying Qt shared libraries, making the `PyQt6` imports and functionality possible. You typically install `PyQt6` which then pulls in `pyqt6-qt`."},"warnings":[{"fix":"Always import from `PyQt6` (e.g., `PyQt6.QtWidgets`, `PyQt6.QtCore`) in your application code. `pyqt6-qt` is a backend dependency, not an API layer.","message":"Confusion between 'pyqt6-qt' and 'PyQt6'. Users often mistake `pyqt6-qt` for the main Python-facing library and attempt to import directly from it.","severity":"gotcha","affected_versions":"All versions"},{"fix":"Refer to the documentation of your chosen bundling tool (e.g., PyInstaller's `datas` option, or specific PySide/PyQt hooks). Ensure all necessary Qt plugins (platform, image formats, etc.) are included. This often requires running the bundling tool on the target OS or ensuring cross-platform compatibility.","message":"Deployment challenges with bundled applications. When creating standalone executables (e.g., with PyInstaller), the Qt shared libraries provided by `pyqt6-qt` must be correctly bundled for the application to run on other machines.","severity":"gotcha","affected_versions":"All versions"},{"fix":"Ensure the `platforms` directory containing the `qwindows.dll` (or `libqxcb.so` on Linux) is discoverable. For standard installations, this is handled, but in custom environments or deployments, you might need to manually set `QT_QPA_PLATFORM_PLUGIN_PATH` to the correct directory (e.g., `path/to/venv/Lib/site-packages/PyQt6/Qt6/plugins`).","message":"Environment variable QT_QPA_PLATFORM_PLUGIN_PATH not set or pointing to incorrect location, leading to 'Could not find the Qt platform plugin' errors.","severity":"gotcha","affected_versions":"All versions"}],"env_vars":null,"last_verified":"2026-04-17T00:00:00.000Z","next_check":"2026-07-16T00:00:00.000Z","problems":[{"fix":"Install the `PyQt6` package: `pip install PyQt6`. This will automatically install `pyqt6-qt` as a dependency if needed.","cause":"The user installed `pyqt6-qt` but forgot to install the `PyQt6` package itself. `pyqt6-qt` only provides the Qt binaries, not the Python bindings.","error":"ModuleNotFoundError: No module named 'PyQt6'"},{"fix":"Ensure the `platforms` folder within your PyQt6 installation's Qt6 directory is accessible. For deployment, ensure this folder is bundled. In development, try setting the `QT_QPA_PLATFORM_PLUGIN_PATH` environment variable to point to the `PyQt6/Qt6/plugins` directory within your site-packages.","cause":"The Qt runtime cannot locate its platform plugins, which are essential for GUI rendering. This often happens in custom environments, virtual environments, or deployed applications where the paths are not correctly resolved.","error":"qt.qpa.plugin: Could not find the Qt platform plugin \"windows\" in \"\""},{"fix":"Try reinstalling `PyQt6` and `pyqt6-qt` to ensure consistency: `pip uninstall PyQt6 pyqt6-qt -y && pip install PyQt6`. Check your Python environment for conflicts or partial installations.","cause":"This usually indicates that the `PyQt6` package is either not fully installed, corrupted, or there's a version mismatch between `PyQt6` and its `pyqt6-qt` backend.","error":"AttributeError: module 'PyQt6' has no attribute 'QtWidgets'"}]}