Is it possible to show a console in a Jupyter notebook?

29,359

Solution 1

You can fire up a Jupyter qt console that is connected to the same IPython kernel http://jupyter-notebook.readthedocs.io/en/latest/examples/Notebook/Connecting%20with%20the%20Qt%20Console.html

Solution 2

From the documentation there are two alternatives and steps are the followings:

First alternative

  1. In your jupyter notebook run the following magic command in a cell:

    %qtconsole

It will start a new ipython qtconsole.

Second alternative

  1. In your jupyter notebook run the following magic command in a cell:

    %connect_info

The output will be something like this:

{
  "stdin_port": 234, 
  "ip": "127.0.0.1", 
  "control_port": 324234 , 
  "hb_port": 50698, 
  "signature_scheme": "hasgd6", 
  "key": "8d91ba69-fasdfasdgadga6e34", 
  "kernel_name": "", 
  "shell_port": 6****9, 
  "transport": "tcp", 
  "iopub_port": 3***0
}

Paste the above JSON into a file, and connect with:
    $> jupyter <app> --existing <file>
or, if you are local, you can connect with just:
    $> jupyter <app> --existing kernel-773f517f-bf26-4102-9329-888a2dac0f4e.json
or even just:
    $> jupyter <app> --existing
if this is the most recent Jupyter kernel you have started.
  1. Write in your terminal the solution that fits your needs. For example, I'm using it locally and I want a qtconsole:

    jupyter qtconsole --existing kernel-773f517f-bf26-4102-9329-888a2dac0f4e.json

This will open a qtconsole using the same kernel, so you will have access to all the variables.

Solution 3

You can use JupyterLab.

This brings notebook, console, terminal together in a single interface just like R-Studio. JupyterLab

Solution 4

I don't know about a terminal in a cell, but you can open a new tab that has (only) a terminal in it. There is an option in the upper right menu of the file browser:

enter image description here

You have to install the package terminado, and it only works on unix.

Share:
29,359
Danderssen
Author by

Danderssen

Updated on July 11, 2022

Comments

  • Danderssen
    Danderssen almost 2 years

    I would like to be able to fiddle around in the environment using a console in a Jupyter notebook. Adding an additional cell means that I always have to scroll to the very bottom or create new cells wherever I want a 'console-like' text field. Is it possible to have a permanent console window, e.g. at the bottom of the window?

    Thanks!