Notebook: Jupyter Notebook so slow and not executing cell sometimes(1 time out of 2 times)

Created on 5 Feb 2018  路  22Comments  路  Source: jupyter/notebook

Hi everyone, I encountered a problem: When I run a cell, it is so slow to run. However, if I try it again, it is working regularly. Empirically, I reached an idea: 1 times running , 1 times not running. I removed jupyter and reinstalled it. Before yesterday, there was no problem in Jupyter. The code(it is just a comment) below took 30 seconds to run.(Note: I amn't using Anaconda distribution. I installed Jupyter via Command line 'pip install jupyter')
jupyter
In addition to this, it is giving output but the star in brackets is still existent.
jupyter2

Most helpful comment

This solved the problem for me:
#3224 (comment)

Turning off Variable inspector seems to work, thanks

All 22 comments

What browser are you using, and do you see the same if you try it in a different browser?

Thanks for your response. I am using Google Chrome. My antivirus is Kaspersky Total Security.

Does turning off the antivirus make any difference? We've had problems with security software in the past.

Also, try it in Firefox and see if the same problem occurs.

Hi, the problem is continuing. I tried it on Firefox and it isn't still running the code. For example, for the screenshot below, If I stop it and re-run it, it is working perfectly. However, in the first trial, it isn't working properly.
jupyter3

I think the problem is because of jupyter's overloading. The code I executed above is 115th cell of Jupyter notebook. I run the same code at the beginning of the notebook and it worked properly. My data has 2 million rows(1.4m train, 0.6 million test). The problem is due to overloading.The code is running properly after I deleted some cells. I think the developers of jupyter notebook, which is a great tool, should find a solution to this. Moreover, when the code wasn't working, the tab completion property wasn't working properly
jupyter4

I am experiencing the same issue

Same issue. I load 700 mb of images to RAM (I have 16GB). There is still 5GB of free RAM left. After that a cell with the code 2+2 takes minutes to execute.

ps. running win10 64 eng, chrome latest, i7 6700K.

i think you'll want to try restart kernel and run all cell to show faster the result.
i did and it's worked on my Jupiter notebook which run on chrome
Did you see IN [] in this input what your code. This () is to refer the large number of line so it can't show this number. We need to restart kernel to give this IN[1] line and it'll run faster

This solved the problem for me:
https://github.com/jupyter/notebook/issues/3224#issuecomment-382300098

This solved the problem for me:
#3224 (comment)

Turning off Variable inspector seems to work, thanks

restarting the kernel solved this for me.

This solved the problem for me:
#3224 (comment)

Thanks. Turning off the Variable inspector also worked for me. Wahoo.

@ashleykuttler, restarting kernel is not the option. For once its fine to restart kernel but if it occurs many times then?

This solved the problem for me:
#3224 (comment)

Thanks. Turning off the Variable inspector also worked for me. Wahoo.

@aloosley Thank you for your comment. It worked for me too after turning off the variable inspector.

This solved the problem for me:
#3224 (comment)

Worked for me!

This solved the problem for me:
#3224 (comment)

Turning off Variable inspector seems to work, thanks

Indeed Variable inspector was the culprit.

I am facing a similar issue. I don't have the variable inspector installed, but still, the notebook is too slow to execute.

This solved the problem for me:
#3224 (comment)

THANK YOU ! It just save me

As mentioned in above comments Jupyter NBExtensions we use are the culprits most of the times. It is worth a try to turn off the extensions one by one and check if it's works for you.

Cheers

As mentioned in above comments Extensions we use are the culprits most of the times. It is worth a try to turn off the extensions one by one and check if it's works for you.

Cheers

I am new to github and cant understand clearly that what are you talking about...Are you talking about this file

import json
from sys import getsizeof

from IPython import get_ipython
from IPython.core.magics.namespace import NamespaceMagics
_nms = NamespaceMagics()
_Jupyter = get_ipython()
_nms.shell = _Jupyter.kernel.shell

try:
import numpy as np
except ImportError:
pass

def _getsizeof(x):

return the size of variable x. Amended version of sys.getsizeof

which also supports ndarray, Series and DataFrame

if type(x).name in ['ndarray', 'Series']:
return x.nbytes
elif type(x).name == 'DataFrame':
return x.memory_usage().sum()
else:
return getsizeof(x)

def _getshapeof(x):

returns the shape of x if it has one

returns None otherwise - might want to return an empty string for an empty column

try:
return x.shape
except AttributeError: #x does not have a shape
return None

def _getcontentof(x):
length = 150
if type(x).name == 'DataFrame':
colnames = ', '.join(x.columns.map(str))
content = "Column names: %s" % colnames
elif type(x).name == 'Series':
content = "Series [%d rows]" % x.shape
elif type(x).name == 'ndarray':
content = x.repr()
else:
if hasattr(x, 'len'):
if len(x) > length:
content = str(x[:length])
else:
content = str(x)
if len(content) > 150:
return content[:150] + " ..."
return content

def var_dic_list():
types_to_exclude = ['module', 'function', 'builtin_function_or_method',
'instance', '_Feature', 'type', 'ufunc']
values = _nms.who_ls()
vardic = [{'varName': v, 'varType': type(eval(v)).name, 'varSize': str(_getsizeof(eval(v))), 'varShape': str(_getshapeof(eval(v))) if _getshapeof(eval(v)) else '', 'varContent': _getcontentof(eval(v)) } # noqa

for v in values if (v not in ['_html', '_nms', 'NamespaceMagics', '_Jupyter']) & (type(eval(v)).__name__ not in types_to_exclude)] # noqa
return json.dumps(vardic)
command to refresh the list of variables
print(var_dic_list())

Yes..what do you mean? Make it more clear!

This solved the problem for me:
#3224 (comment)

thank, it works for me too. Variable Inspector has some problems

Was this page helpful?
0 / 5 - 0 ratings