lgpage / nbtutor

Visualize Python code execution (line-by-line) in Jupyter Notebook cells.
Other
458 stars 41 forks source link

Can't seem to get the visualizations to appear #29

Open hschilling opened 7 years ago

hschilling commented 7 years ago

I can't seem to get any of the visualization show up. I think I am doing as shown in the screencast but it doesn't work. Plus I get this when I try to turn on Memory or Timeline. What am I doing wrong? Thanks. screen shot 2016-12-26 at 3 38 13 pm

lgpage commented 7 years ago

Hmmm that is strange. Can you post the code snippet here please. What happens if you simply run the code cell with the %%nbtutor magic? Does the visualisation just not pop up?

lgpage commented 7 years ago

Also if you can run the code cell with %%nbtutor --debug and let me know if there is any traceback if will be helpful.

hschilling commented 7 years ago

Thanks for the speedy response! Just something simple to try things with:

def fib(n): a,b = 1,1 for i in range(n-1): a,b = b,a+b return a print fib(5)

The visualization just doesn't pop up. So here is my notebook. I just ran the two cells. image

Nothing popped up

hschilling commented 7 years ago

`--------------------------------------------------------------------------- BdbQuit Traceback (most recent call last)

in () ----> 1 get_ipython().run_cell_magic(u'nbtutor', u'--debug', u'def fib(n):\n a,b = 1,1\n for i in range(n-1):\n a,b = b,a+b\n return a\nprint fib(5)') /Users/hschilli/anaconda/envs/blue/lib/python2.7/site-packages/IPython/core/interactiveshell.pyc in run_cell_magic(self, magic_name, line, cell) 2113 magic_arg_s = self.var_expand(line, stack_depth) 2114 with self.builtin_trap: -> 2115 result = fn(magic_arg_s, cell) 2116 return result 2117 in nbtutor(self, line, cell) /Users/hschilli/anaconda/envs/blue/lib/python2.7/site-packages/IPython/core/magic.pyc in (f, *a, **k) 186 # but it's overkill for just that one bit of state. 187 def magic_deco(arg): --> 188 call = lambda f, *a, **k: f(*a, **k) 189 190 if callable(arg): /Users/hschilli/anaconda/envs/blue/lib/python2.7/site-packages/nbtutor/ipython/magic.pyc in nbtutor(self, line, cell) 68 69 bdb = Bdb(self.shell, opts) ---> 70 bdb.run_cell(cell) 71 72 self.shell.run_cell(cell) /Users/hschilli/anaconda/envs/blue/lib/python2.7/site-packages/nbtutor/ipython/debugger.pyc in run_cell(self, cell) 50 self.code_error = True 51 if self.options.debug: ---> 52 raise BdbQuit 53 finally: 54 self.finalize() BdbQuit: `
lgpage commented 7 years ago

I'll look into this in the morning for you. For some reason the nbtutor debugger is failing and failing back to ipython to run the cell. It could possible be the 2 space indentation (instead of 4) its not happy with.

Are you able to visualize any of the examples in the repo?

hschilling commented 7 years ago

Oh! I didn't even think of that. I just tried the first cell from primitives and it works fine. Will try another one with some indenting. BTW, I did try playing with the indenting in my example but it didn't help

hschilling commented 7 years ago

the functions examples work too!

lgpage commented 7 years ago

Cool, thanks for letting me know. I will try improve this.

Mr-Ruben commented 5 years ago

In my case I was using a python2 kernel. I don't know if it happens with python3 too.

My solution was: Do not use any print statement in the code. If you do, you get the pop up saying ...

No visualization data was found for this cell. Please include the following magic at the start of the cell and run the code again %%nbtutor

I hope this helps others, as I have been banging my head for some time trying to figure out what was wrong with my installation.

Suggestion/Request: On the documentation, my lack of knowledge does not allow me to understand what is: frames, primitive objects, user namespace. I am sure you can rephrase those lines to make them a bit clearer.

Thanks to the creator of this tool. I think it is quite handy.

With print image

Without print image

samm-github commented 5 years ago

Hi, can someone help with this error "UsageError: Line magic function %%nbtutor not found." giving below a brief code of what I am doing: ​

!jupyter nbextension enable nbtutor --py --sys-prefix

%reload_ext nbtutor

%%nbtutor -r -f

%%ipythontutor

a= 1 a

Enabling notebook extension nbtutor/js/nbtutor.min...

samm-github commented 5 years ago

using below seems to have worked for me import sys !{sys.executable} -m pip install nbtutor # this command seems to have fixed the error

test_1

%lsmagic # shows list of all line magics

test_2 %nbtutor -r -f UsageError: Line magic function %nbtutor not found (But cell magic %%nbtutor exists, did you mean that instead?)