Jupyter notebook not running code. Stuck on In [*]

PythonJupyter NotebookJupyter

Python Problem Overview


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

Python Solutions


Solution 1 - Python

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.

Solution 2 - Python

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

Solution 3 - Python

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.

Solution 4 - Python

pip install ipykernel --upgrade

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

Solution 5 - Python

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.

Solution 6 - Python

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.

Solution 7 - Python

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

Solution 8 - Python

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

Solution 9 - Python

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!

Solution 10 - Python

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

Solution 11 - Python

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

Solution 12 - Python

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!

Solution 13 - Python

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.

Solution 14 - Python

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

Solution 15 - Python

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.

Solution 16 - Python

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

Solution 17 - Python

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.

Attributions

All content for this solution is sourced from the original question on Stackoverflow.

The content on this page is licensed under the Attribution-ShareAlike 4.0 International (CC BY-SA 4.0) license.

Content TypeOriginal AuthorOriginal Content on Stackoverflow
QuestionteddView Question on Stackoverflow
Solution 1 - PythonSioSMacView Answer on Stackoverflow
Solution 2 - PythonItachiView Answer on Stackoverflow
Solution 3 - PythonAfshin AmiriView Answer on Stackoverflow
Solution 4 - PythonhercmulliganView Answer on Stackoverflow
Solution 5 - PythonAnand KumarView Answer on Stackoverflow
Solution 6 - PythonFilippos ZofakisView Answer on Stackoverflow
Solution 7 - Pythonuser13101981View Answer on Stackoverflow
Solution 8 - PythonRodrigo PereiraView Answer on Stackoverflow
Solution 9 - PythonAli BakhshandehView Answer on Stackoverflow
Solution 10 - PythonDoğuşView Answer on Stackoverflow
Solution 11 - Pythonkartar katView Answer on Stackoverflow
Solution 12 - Pythonuser10446843View Answer on Stackoverflow
Solution 13 - PythonHello WorldView Answer on Stackoverflow
Solution 14 - PythonMartinView Answer on Stackoverflow
Solution 15 - PythonghersonView Answer on Stackoverflow
Solution 16 - PythonthisisyuuView Answer on Stackoverflow
Solution 17 - PythonJoshua WolffView Answer on Stackoverflow