木星笔记本没有运行代码。卡在[ * ]

在我没有更改任何内容并再次运行它之前,我的代码运行良好。现在它不会返回任何东西,甚至不会返回错误。只是卡在“ In [ * ]”上了。

See problem visually here

214607 次浏览

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

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.

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

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.

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!

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.

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.

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!

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

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

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.

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.

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

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

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

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.

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 [*].