Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

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?

like image 265
Isak La Fleur Avatar asked May 24 '15 08:05

Isak La Fleur


People also ask

What does [*] mean in Jupyter Notebook?

This means that your kernel is busy. If you want to interrupt/stop the execution, go to the menu Kernel and click Interrupt. If it doesn't work, click Restart. You need to go in a new cell and press Shift + Enter to see if it worked. Follow this answer to receive notifications.

What does in NUM mean in Jupyter Notebook?

Simply speaking it is the total number of times you have runned the cells and that number on a particular cell in "In[num]" is the number at which you runned that cell latest.

How do you stop a code running in Jupyter Notebook?

To interrupt a cell execution, you can click the ■ “stop” button in the ribbon above the notebook, or select “Interrupt Kernel” from the Kernel menue.

Why is there an asterisk in my Jupyter Notebook?

When a cell is displayed as "busy" with an asterisk, it can mean one of several things: The cell is currently executing. An "execute" command was sent to the cell, but another cell is currently executing. The cell will execute when its turn comes.


2 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.

like image 70
Mike Müller Avatar answered Sep 20 '22 20:09

Mike Müller


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.

like image 37
Elle Avatar answered Sep 21 '22 20:09

Elle