{"id":9969,"library":"napari-console","title":"napari-console Plugin","description":"napari-console is a napari plugin that integrates an interactive Python console (powered by `qtconsole`) directly into the napari viewer. It allows users to programmatically interact with the currently active napari viewer and its layers, widgets, and data. The current version is 0.1.4, with a release cadence tied to napari's development and specific feature/bug fix needs for the console functionality.","status":"active","version":"0.1.4","language":"en","source_language":"en","source_url":"https://github.com/napari/napari-console","tags":["napari","plugin","console","gui","interactive"],"install":[{"cmd":"pip install napari-console","lang":"bash","label":"Install napari-console"},{"cmd":"pip install napari napari-console","lang":"bash","label":"Install napari and plugin"}],"dependencies":[{"reason":"Core dependency for the plugin to function within the napari ecosystem. Requires napari>=0.4.17.","package":"napari","optional":false},{"reason":"Powers the interactive console functionality. Requires qtconsole>=5.3.0.","package":"qtconsole","optional":false}],"imports":[{"note":"napari-console is primarily a GUI plugin; direct programmatic imports for end-user interaction are rare beyond ensuring the package is available. Its functionality is exposed via the napari UI.","symbol":"napari_console","correct":"import napari_console"}],"quickstart":{"code":"import napari\n\n# Ensure both napari and napari-console are installed:\n# pip install napari napari-console\n\n# 1. Start the napari viewer\nviewer = napari.Viewer()\n\n# 2. To open the console, in the running napari application:\n#    Go to 'Plugins' in the top menu bar.\n#    Select 'napari-console: Console'.\n# A new console widget will appear, automatically providing access to the 'viewer' object.\n\n# Example commands to type directly into the napari console:\n# print(viewer)\n# viewer.add_points([[0, 0], [10, 10], [5, 5]], text='Hello')\n\n# Keep napari running (essential for GUI interaction)\nnapari.run()","lang":"python","description":"This quickstart demonstrates how to launch napari and then access the napari-console plugin through the GUI. The plugin integrates directly into the napari environment, providing an interactive Python shell with the `viewer` object pre-injected into its namespace."},"warnings":[{"fix":"Upgrade napari-console and ensure all dependencies are up-to-date: `pip install --upgrade napari-console napari qtconsole`.","message":"napari-console requires specific versions of `napari` and `qtconsole`. Ensure your environment satisfies `napari>=0.4.17` and `qtconsole>=5.3.0` to avoid display issues or errors.","severity":"gotcha","affected_versions":"<0.1.1 (napari-console) with older napari"},{"fix":"After launching napari, navigate to `Plugins > napari-console: Console` in the napari menu bar to open the console window.","message":"The console is a GUI element and must be explicitly opened via the 'Plugins' menu in the napari application. It does not automatically appear on napari startup.","severity":"gotcha","affected_versions":"All versions"},{"fix":"To access external variables or modules, import them directly within the console session (e.g., `import numpy as np`) or pass objects to the napari viewer's namespace if you're embedding (advanced use case).","message":"The console operates within the context of the running napari viewer. While `viewer` is automatically available, other Python objects or variables defined in scripts *outside* the napari process will not be accessible unless explicitly imported or redefined within the console.","severity":"gotcha","affected_versions":"All versions"},{"fix":"Verify your `qtconsole` installation and its dependencies are working correctly. Try running `jupyter qtconsole` directly from your terminal to diagnose `qtconsole`-specific issues. Ensure `pip install --upgrade qtconsole` is run.","message":"Issues with `qtconsole` (e.g., version conflicts with other packages, missing `ipython` kernels, or display issues on specific Qt backends) can directly impact napari-console's functionality or prevent it from launching.","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 package using pip: `pip install napari-console` (and `pip install napari` if napari is also missing).","cause":"The `napari-console` package (or `napari` itself) is not installed in the active Python environment.","error":"ModuleNotFoundError: No module named 'napari_console'"},{"fix":"Ensure all related packages are up-to-date and compatible: `pip install --upgrade napari napari-console qtconsole`. Check the napari console output for specific error messages.","cause":"Possible compatibility issues between `napari-console`, `napari`, or `qtconsole`, or a corrupted installation.","error":"Console window does not appear after selecting 'Plugins > napari-console: Console'"},{"fix":"Redefine or import the variable within the napari-console session, or ensure it's part of the `viewer`'s namespace if intended for interaction with napari objects.","cause":"The variable `my_variable` was defined in a script or another scope outside the napari-console's current interactive session.","error":"NameError: name 'my_variable' is not defined (when using a variable in the console)"}]}