What does In [*] in IPython Notebook mean and how to turn it off?

Question:

I use Windows 7, Python 2.7.9 plus latest version of IPython 3.1.

I ran %python inside an IPython Notebook and ran the cell, instead of returning the Python version, it did not run and jumped to a new line and printed a In [*] instead of a line number. Now no line is running in ipython everything is ignored when I try to run a cell value.

Anyone know what has happen?

Asked By: Isak La Fleur

||

Answers:

The kernel is busy. Go to the menu Kernel and click Interrupt. If this does not work click Restart. You need to go in a new cell and press Shift + Enter to see if it worked.

Answered By: Mike Müller

For me to resolve this issue, I had to stop my anti-virus program.

Answered By: Chirag

The issue causing your kernel to be busy can be a specific line of code. If that is the case, your computer may just need time to work through that line.

To find out which line or lines are taking so long, as mentioned by Mike Muller you need to restart the program or interrupt the kernel. Then go through carefully running one line at a time until you reach the first one with the asterisk.

If you do not restart or interrupt your busy program, you will not be able to tell which line is the problem line and which line is not, because it will just stay busy while it works on that problem line. It will continue to give you the asterisk on every line until it finishes running that one line of code even if you start back at the beginning. This is extremely confusing, because lines that have run and produced output suddenly lose their output when you run them on the second pass. Also confusing is the fact that you can make changes to your code while the kernel is busy, but you just can’t get any new output until it is free again.

Your code does not have to be wrong to cause this. You may just have included a time-consuming command. Bootstrapping has caused this for me.

If your code is what it needs to be, it doesn’t actually matter which line is the problem line, and you just need to give all of your code time to run. The main reasons to find out which is the problem line would be if some lines were expendable, or in case you were getting the asterisk for some other reason and needed to rule this one out.

If you are writing code on an internet service that times out when you aren’t giving it input, your code might not have enough time to finish running if you just wait on it. Scrolling every few minutes is usually enough to keep those pages from timing out.

Answered By: Elle
Categories: questions Tags: , ,
Answers are sorted by their score. The answer accepted by the question owner as the best is marked with
at the top-right corner.