How to open an IPython console connected to a running running kernel in PyCharm

Is there a way to open the IPython interactive console in pycharm that is connected to an existing running kernel (similar to "python --existing")?

btw: in case it matters, in my case, the running kernel has Jupiter's notepad ...

EDIT: To clarify, my question is NOT about how to open an interactive console in PyCharm. It's about how to connect this interactive console to an existing kernel (Jupiter notebook).

+7
pycharm ipython
source share
2 answers

( tl; dr : use jupyter console --existing in the PyCharm "Terminal" tool window (and not in the Python console tool window) to connect to an existing iPython kernel running on the server’s local Jupyter laptop.)

I can confirm that the @ john-moutafis comment suggesting ipython console --existing is the right idea. The command gives "WARNING | You probably want to use the jupyter console in the future", so I tried this.

  • I have a project using conda as an interpreter. Jupyter Notebook is installed in the conda environment.
  • I open a terminal window. It automatically activates the conda environment.
  • I am typing jupyter notebook . The laptop server starts and a browser window opens.
  • I create a laptop in a browser and execute a cell containing foo = "bar" .
  • In PyCharm, I open another terminal tool window by clicking the plus sign to the left of the terminal panel.
  • In the new terminal, I type jupyter console --existing and start the ipython console session.
  • At the command prompt, enter dir() , and foo is among the results confirming that I am attached to the same kernel as the laptop.

I don’t know how he chooses which kernel to connect to if there are several cores on the laptop server.

Do not enter exit in an iPython session; if you plan to continue using the laptop, it shuts down the kernel.

Unfortunately, tools such as Debug and Execute Line / Selection in Console, which are available for the Python Console tool window, are not available for the Terminal tool window. In fact, since the Terminal tool window is a simple tool, and that when I run my commands, this solution is not very integrated with PyCharm. The terminal opens in the project directory and activates the conda environment and is conveniently located next to the editors and IDE tools, but otherwise there is no connection with the PyCharm tools.

If someone can successfully connect the integrated PyDev PyCharm debugger to the running kernel, please log in.

I am using PyCharm 2016.3 for macOS 10.12.3.

+3
source share

The easiest way is to simply type% qtconsole in the jupyter laptop cell and run it. The qt console will open already connected to a running nursery. No PyCharm is involved.

0
source share

All Articles