Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

jupyter notebook takes forever to open and then pages unresponsive - [MathJax] issue

I'm trying to open a jupyter notebook and it takes a long time and I see at the bottom it's trying to load various [MathJax] extension, e.g. at the bottom left of the chrome browser it says:

Loading [MathJax]/extensions/safe.js

Eventually, the notebook loads, but it's frozen and then at the bottom left it keeps showing that it's trying to load other [MathJax] .js files.

Meanwhile, the "pages unresponsive do you want to kill them" pop up keeps popping up.

I have no equations or plots in my notebook so I can't understand what is going on. My notebook never did this before.

I googled this and some people said to delete the ipython checkpoints. Where would those be? I'm on Mac OS and using Anaconda.

like image 374
profhoff Avatar asked Feb 05 '18 03:02

profhoff


People also ask

Why is my Jupyter Notebook unresponsive?

Jupyter doesn't load or doesn't work in the browserTry in another browser (e.g. if you normally use Firefox, try with Chrome). This helps pin down where the problem is. Try disabling any browser extensions and/or any Jupyter extensions you have installed. Some internet security software can interfere with Jupyter.

What's wrong with jupyter notebooks?

It is almost impossible to enable good code versioning Due to the fact that jupyter notebooks are stored as big JSON files merging two notebooks is virtually impossible. This is bad because we cannot apply tools for software teams like a good git workflow will pull requests and reviews.

How do you unfreeze a Jupyter Notebook?

To restart the kernel,press Esc to enter command mode, then press 0 0 (zero) to restart the kernel, now your program will run.


3 Answers

I had a feeling that the program in my Jupyter notebook was stuck trying to produce some output, so I restarted the kernel and cleared output and that seemed to do the trick!

If Jupyter crashes while opening the ipynb file, try "using nbstripout to clear output directly from the .ipynb file via command line"(bndwang). Install with pip install nbstripout

like image 70
profhoff Avatar answered Oct 14 '22 06:10

profhoff


  1. conda install -c conda-forge nbstripout

  2. nbstripout filename.ipynb. Make sure that there is no whitespace in the filename.

like image 24
Anas Avatar answered Oct 14 '22 05:10

Anas


I was having the same problem with jupyter notebook. My recommendations to you are as follows:

First, check the size of the .ipynb file you are trying to open. Probably the file size is in MB and is large. One of the reasons for this might be the output of a dataset that you previously displayed all rows.

For example; In order to check the dataset, sometimes I use pd.set_option('display.max_rows', None) instead of the .head() function. And so I view all the rows in the data set. The large number of outputs increases the file size, making the notebook slower. Try to delete such outputs.

I think this will solve your problem.

like image 11
baligoyem Avatar answered Oct 14 '22 05:10

baligoyem