notebook icon indicating copy to clipboard operation
notebook copied to clipboard

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

Open MuhammedBuyukkinaci opened this issue 7 years ago • 23 comments
trafficstars

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

MuhammedBuyukkinaci avatar Feb 05 '18 08:02 MuhammedBuyukkinaci

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

takluyver avatar Feb 05 '18 10:02 takluyver

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

MuhammedBuyukkinaci avatar Feb 05 '18 10:02 MuhammedBuyukkinaci

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.

takluyver avatar Feb 05 '18 11:02 takluyver

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

MuhammedBuyukkinaci avatar Feb 05 '18 16:02 MuhammedBuyukkinaci

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

MuhammedBuyukkinaci avatar Feb 05 '18 20:02 MuhammedBuyukkinaci

I am experiencing the same issue

quertenmont avatar Jun 09 '18 06:06 quertenmont

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.

roboserg avatar Jun 25 '18 13:06 roboserg

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

dinhthengoc2021998 avatar Jul 10 '18 02:07 dinhthengoc2021998

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

ihopethiswillfi avatar Nov 20 '18 09:11 ihopethiswillfi

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

Turning off Variable inspector seems to work, thanks

sk7711 avatar Dec 19 '18 08:12 sk7711

restarting the kernel solved this for me.

ashleykuttler avatar Feb 27 '19 21:02 ashleykuttler

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

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

aloosley avatar Feb 28 '19 15:02 aloosley

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

prasadkalangi avatar Jun 24 '19 05:06 prasadkalangi

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.

Abhishekmamidi123 avatar Jul 11 '19 02:07 Abhishekmamidi123

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

Worked for me!

gertjandemulder avatar Jul 15 '19 18:07 gertjandemulder

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

Turning off Variable inspector seems to work, thanks

Indeed Variable inspector was the culprit.

pankaj-kvhld avatar Aug 14 '19 13:08 pankaj-kvhld

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

udyadityadeo avatar Oct 12 '19 15:10 udyadityadeo

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

THANK YOU ! It just save me

Lrakotoson avatar Nov 26 '19 12:11 Lrakotoson

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

veluribharath avatar Jan 29 '20 05:01 veluribharath

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

m-jatin avatar Feb 09 '20 14:02 m-jatin

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

CarolynMassa avatar May 01 '20 19:05 CarolynMassa

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

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

kwlwman2 avatar Jun 12 '20 01:06 kwlwman2

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

Thanks

ZohanStv avatar Aug 11 '22 15:08 ZohanStv

when the code wasn't working, the tab completion property wasn't working properly

Same problem with jupyter lab. The execution of some cells at random moments is very slow like getting stuck. I do not use the variable inspector extension. Any idea how to fix the issue?

seralouk avatar Aug 02 '23 20:08 seralouk