{"id":2253,"library":"qtconsole","title":"Jupyter Qt console","description":"The Qtconsole is a rich Qt-based application providing an interactive console for Jupyter kernels. It largely feels like a terminal but offers graphical user interface enhancements such as inline figures, proper multiline editing with syntax highlighting, and graphical calltips. It is currently at version 5.7.2, maintained by the Spyder development team, and is part of the broader Project Jupyter ecosystem, with a consistent release cadence for features and bug fixes.","status":"active","version":"5.7.2","language":"en","source_language":"en","source_url":"https://github.com/spyder-ide/qtconsole","tags":["jupyter","qt","console","gui","ide","terminal","ipython"],"install":[{"cmd":"pip install qtconsole","lang":"bash","label":"Via pip (Qt bindings need separate installation)"},{"cmd":"conda install qtconsole","lang":"bash","label":"Via Conda (includes Qt bindings)"}],"dependencies":[{"reason":"Runtime environment","package":"python","version":">=3.9","optional":false},{"reason":"Required to connect to a Jupyter kernel, especially for embedded use or rich features.","package":"ipykernel","optional":false},{"reason":"Interface to Jupyter protocol, managing kernels.","package":"jupyter_client","optional":false},{"reason":"Syntax highlighting.","package":"pygments","optional":false},{"reason":"Qt binding abstraction layer used internally.","package":"qtpy","optional":false},{"reason":"Python bindings for Qt GUI toolkit. One of PyQt6, PySide6, PyQt5, or PySide2 is required.","package":"PyQt6","optional":true},{"reason":"Python bindings for Qt GUI toolkit. One of PyQt6, PySide6, PyQt5, or PySide2 is required.","package":"PySide6","optional":true},{"reason":"Python bindings for Qt GUI toolkit. One of PyQt6, PySide6, PyQt5, or PySide2 is required.","package":"PyQt5","optional":true},{"reason":"Python bindings for Qt GUI toolkit. One of PyQt6, PySide6, PyQt5, or PySide2 is required.","package":"PySide2","optional":true}],"imports":[{"symbol":"RichJupyterWidget","correct":"from qtconsole.rich_jupyter_widget import RichJupyterWidget"},{"symbol":"QtInProcessKernelManager","correct":"from qtconsole.inprocess import QtInProcessKernelManager"}],"quickstart":{"code":"import sys\nfrom qtconsole.rich_jupyter_widget import RichJupyterWidget\nfrom qtconsole.inprocess import QtInProcessKernelManager\nfrom PyQt5.QtWidgets import QApplication\n\ndef main():\n    app = QApplication([])\n    \n    # Create a kernel manager and start a kernel\n    kernel_manager = QtInProcessKernelManager()\n    kernel_manager.start_kernel(show_banner=False)\n    kernel_client = kernel_manager.client()\n    kernel_client.start_channels()\n\n    # Create the Qt console widget\n    console = RichJupyterWidget()\n    console.kernel_manager = kernel_manager\n    console.kernel_client = kernel_client\n    \n    # Execute some code programmatically\n    console.execute('print(\"Hello from embedded QtConsole!\")')\n    console.execute('import matplotlib.pyplot as plt')\n    console.execute('plt.plot([1,2,3], [4,5,6])')\n    console.execute('plt.show()')\n\n    console.show()\n    sys.exit(app.exec_())\n\nif __name__ == '__main__':\n    # To run this example, ensure you have:\n    # pip install qtconsole ipykernel PyQt5\n    main()","lang":"python","description":"The simplest way to start the Qt console is by running `jupyter qtconsole` from your terminal. For embedding it into a custom Qt application, you can use `RichJupyterWidget` to host a Jupyter kernel in-process. This example demonstrates launching an in-process kernel and executing commands."},"warnings":[{"fix":"After `pip install qtconsole`, also run `pip install PyQt5` (or PySide2/6/PyQt6) or use `conda install qtconsole`.","message":"When installing via `pip`, Qt bindings (e.g., PyQt5, PySide2) are *not* automatically installed. These must be installed separately. Using `conda install qtconsole` typically handles this dependency automatically.","severity":"gotcha","affected_versions":"All versions"},{"fix":"Update any code referencing `ConsoleWidget.width` or `ConsoleWidget.height` to use `console_width` or `console_height`.","message":"In version 4.3, the `ConsoleWidget.width` and `ConsoleWidget.height` traits were renamed to `console_width` and `console_height` respectively to avoid clashes with `QWidget` properties.","severity":"breaking","affected_versions":">=4.3"},{"fix":"Design your embedded application to handle the separation of processes for kernel execution and frontend GUI. Avoid attempting direct cross-process Qt object manipulation.","message":"When embedding `qtconsole` in a custom Qt application, user code executed in the kernel runs in a separate process from the frontend. This means you cannot directly access the `QtApplication` instance of the `QtConsole` itself from within the kernel's executed code.","severity":"gotcha","affected_versions":"All versions"},{"fix":"Check for official patches or workarounds on the `qtconsole` GitHub issues page. For `input()` issues, consider alternative input methods if possible within your application context. For Matplotlib, explicitly set a non-'auto' backend.","message":"Users have reported issues with the `qtconsole` freezing and throwing `QTextCursor::setPosition: out of range` errors after calling `input()`, and crashes when using the 'auto' backend with Matplotlib.","severity":"gotcha","affected_versions":"Recent versions (e.g., 5.x)"},{"fix":"If encountering segfaults, consider using a slightly older, known-compatible combination of Python, Qt, and `qtconsole` versions, or monitor the GitHub repository for official fixes.","message":"There are reports of `Segfault on import` when running `qtconsole` against Qt 6.7 on 64-bit Windows 11 with Python 3.12, indicating potential compatibility issues with newer Qt or Python versions.","severity":"gotcha","affected_versions":"5.x with Qt 6.7 / Python 3.12"}],"env_vars":null,"last_verified":"2026-04-09T00:00:00.000Z","next_check":"2026-07-08T00:00:00.000Z"}