The asterisk next to a cell [*]
indicates that the cell is currently executing. While Ipython provides each notebook with it’s own kernel, there is only one
kernel per notebook. When that kernel is busy executing code (either a cell, or a series of cells) it cannot accept or run any further code until what it is currently doing is finished. New executions sit in a queue, until the kernel isready.
If you wait long enough after trying to execute 2+2 you should find that it will eventually execute (assuming your main code everexits).
The solution to this depends on your code, and how long you’re willing to wait to get the results. As a general rule try thefollowing:
Use a smaller data set to test the algorithm, then scale up gradually noting the increase in time. Is it going to be feasible with your fulldataset? Is your algorithm reading/writing to the disk? Can you avoid it, or pre-load/post-savestate? Is it possible to split your data intobatches? If your algorithm is batchable, can you parallelize it to make best use of your CPU ?You can interrupt the kernel, however this will not work if the execution is currently out of the kernel’s hands e.g. in external C modules (a lot of numpy for example). In these cases you may need to restartcompletely.