Issue
I am using SSH
to connect to a linux-base remote server and in that server I have run ipython
from the terminal that it has brought to me. The point is that I want to interrupt the current operation but I can not do that at all. I have tried pressing double i
or the information that have been provided in this web site but did not work (using Ctrl + m i).
I have seen here and here but were useless.
Solution
There seem to be some confusion in your question – clarified in the comments – as to whether you refer to the Terminal IPython or IPython Notebook. The two are quite different beasts and do not have the same shortcuts/capabilities.
The docs you point to are old, and the up-to-date version for the notebook interface is here, i,i
and Ctrl-m,i
are shortcut for the Classic Notebook interface (now there is also a JupyterLab interface), when ran in a browser. Almost None of the shortcut of the notebook interface apply to the terminal. The notebook interface is a 2-to-3 process system, you are not asking you computer to kill directly the computation, you are asking the interface to stop it.
When you run IPython at the terminal you are directly executing the CLI-Interface and your code in the same process, so Many shortcut will actually be shortcuts of your terminal IPython have limited control over. Thus the way to interrupt a computation is Ctrl-C
(soft terminate) or Ctrl-\
forcibly terminal. (And actually when you press i,i
i na notebook, it sends a network request to send Ctrl-C
to your computation)
Now if you have a computation done in C (like in NumPy for example) it cannot be easily interrupted. Python will receive a "please stop as soon as you can" but will have the first occasion to do so only when numpy (or your C routine) has finished. The only solution is to kill the process using the kill <pid>
command. But this will not only stop your computation but most likely kill the all IPython session itself.
You may also try Ctrl-Z
(if your terminal support it) that should pause the process and put it in background. Not sure how that would behave in an SSH session though.
Answered By - Matt
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.