86

My code was running fine before I did not change anything and I ran it again. Now it doesn't return anything not even an error. It is just stuck on "In [*]".

See problem visually here

OneCricketeer
  • 179,855
  • 19
  • 132
  • 245
tedd
  • 907
  • 1
  • 6
  • 4
  • 4
    You're running an infinite loop. Are you incrementing `count`? Probably not... – cs95 Sep 23 '17 at 19:16
  • 2
    What I did was to quit the Notebook, and I started all over again. That is the proper solution. Restarting the Kernel really did not really help. But quitting did so try quitting and start again – Goatie Jan 25 '19 at 20:40
  • just FYI in my case I had not started my mongo server... so ... in reality it was timing out but it would take a long time to timeout... it could be something that you forgot to start. – FernandoZ Mar 26 '23 at 16:26

18 Answers18

40

This means that Jupyter is still running the kernel. It is possible that you are running an infinite loop within the kernel and that is why it can't complete the execution.

Try manually stopping the kernel by pressing the stop button at the top. If that doesn't work, interrupt it and restart it by going to the "Kernel" menu. This should disconnect it.

Otherwise, I would recommend closing and reopening the notebook. The problem may also be with your code.

SioSMac
  • 409
  • 4
  • 2
25

updating ipykernel did it for me. it seems arch linux's ipykernel package had been outdated for some time

just do pip install --upgrade ipykernel

reference here: github solution

Itachi
  • 2,817
  • 27
  • 35
9

I have installed jupyter with command pip3 install jupyter and have the same problem. when instead I used the command pip3 install jupyter ipython the problem was fixed.

Afshin Amiri
  • 3,438
  • 1
  • 20
  • 21
5
pip install ipykernel --upgrade

https://github.com/jupyter/notebook/issues/1133

hercmulligan
  • 71
  • 1
  • 2
2

enter image description here

This is mean your program is still running in background, you need to click shutdown (Shown in attached Image).

*** Shutdown the Running cell and again run your program.

2

I had the same problem and not any of the above mentioned solutions worked.

Until I updated conda packages:

 conda update conda
 conda update anaconda

and ... Voila! It all works!

Ali Bakhshandeh
  • 433
  • 6
  • 10
2

The answers that state that your kernel is still executing the code in the cell are correct. You can see that by the small circle in the top right. If it is filled with a black/grey color, then it means it is still running.

I just want to add that I experienced a problem in JupyterHub where the code in the cell would just not execute. I stopped and restarted the kernel, shutdown and reloaded the notebook, but it still did not run.

What worked for me was literally copy pasting the same code to a new cell and deleting the old one. It then ran from the new cell.

Filippos Zofakis
  • 561
  • 6
  • 12
2

I fixed this issue

just only type this command: jupyter notebook --no-browser

It will show you the path then copy and paste on Jupyter Notebook browser

The code will be executed in IPython Notebook Python 3

halfer
  • 19,824
  • 17
  • 99
  • 186
1

Usually, stopping and restarting that particular cell fixes this issue.

1

I had the same issue now:

Solved it by:

Just reloading the local weblink in which the Python is running

http://localhost:8888/notebooks/sec%201/Untitled.ipynb
Dharman
  • 30,962
  • 25
  • 85
  • 135
karthik
  • 528
  • 4
  • 19
1

Upgrading ipykernel, notebook and then downgrading tornado to 4.2.0 solved the issue for me.

My current package versions related to jupyter:

jupyter==1.0.0
jupyter-client==5.2.2
jupyter-console==6.1.0
jupyter-core==4.4.0
jupyterlab==2.2.5
jupyterlab-server==1.2.0
ipykernel==5.3.4
notebook==5.2.2
tornado==4.2
pyparsing==2.4.2
ipython==5.5.0
ipython-genutils==0.2.0
prompt-toolkit==1.0.15

Github

Doğuş
  • 1,887
  • 1
  • 16
  • 24
  • I did the upgrading of ipykernel and notebook. It seems that tornado was also my problem. But I had to install the latest version. This is how you uninstall tornado: "pip3 uninstall tornado" and to install it "pip3 install tornado" . If you want to install a particular version, say 4.2.0, type pip3 install tornado==4.2.0. – Mariav Mar 03 '21 at 02:59
1

Anaconda environments might cause this. I had to deactivate all conda environments and launch the notebook from root.

conda deactivate

To do so, cd into the directory in your terminal, run conda deactivate until there is nothing in the parantheses that precede your computer name and username. In the example below, I had to run conda deactivate twice.

(base) Your-Computer:~ Your-Username$ conda deactivate

(/Users/jw1/opt/anaconda3) Your-Computer:~ Your-Username$ conda deactivate

Your-Computer:~ Your-Username$ jupyter notebook

Then I was able to run jupyter notebook, and the code ran as expected.

Joshua Wolff
  • 2,687
  • 1
  • 25
  • 42
0

I had the same issue. I found that ipython must be running for jupyter notebook to execute. Do the following:

  • Go to the folder where you have your ipython notebook(.ipynb)
  • Press shift and right click on the empty space then select "open command window here". This will open a command prompt window.
  • Type ipython. This will start ipython.
  • Open another command prompt window and open jupyter notebook.
  • Open your file again and go to cell>>>run cell.

This should work. It worked for me. Cheers!

Claire Nielsen
  • 1,881
  • 1
  • 14
  • 31
0

This is because when we run a loop until it's termination the Kernel is in busy state and so IN [*] is shown up. Since Kernel is busy and if we just leave that cell to execute completely and switch to another cell to run, the corresponding cell will get busy and so again for that cell IN[*] is shown. In that case you just need to restart your jupyter notebook and all is fine then.

But be sure that your loop will terminate this time or else again this error will turn up.

gal242
  • 589
  • 6
  • 13
0

I have uninstalled jupyter, notebook and ipython, and installed jupyterlab. It is working for now (with just a few libraries installed and Python 3.6.8.


Something to discard: Uninstalling Python 3.7 completely with his libraries and reverting to 3.6 doesn't fix it, although it improves it, it works intermittently now (but once sth doesn't work properly, things start to get worse and worse, so I did the above).

Martin
  • 414
  • 7
  • 21
  • Thanks for the suggestion @Machavity, I'm going to edit it a little, I think it is valid to discard solutions (actually more useful than having several answers that doesn't work). On the other hand situation is intermitent now at least. – Martin Apr 05 '19 at 20:04
0

Check the output on the server environment from which jupyter notebook was launched if you can. You'll probably find error messages and print() results.

gherson
  • 169
  • 2
  • 9
-1

The reason why it is happening is you are still talking to the same kernel instance in the second run, the variables from first run still exist and haven't been cleared.

This can be solved by adding this command before each run

%reset -f
thisisyuu
  • 27
  • 1
  • 6
-1

I have also faced this problem number of times. I simply click the small square button (interrupt the kernel) beside Run button and click on Restart the kernel(with dialog) button (just beside square box) to run my program when struck on in [*].

Sheetal
  • 52
  • 1
  • 6