r/Python • • Nov 08 '15

Make Jupyter even more magical (notebook from #pyconca2015)

https://github.com/nicolaskruchten/pyconca/blob/master/jupyter_magic.ipynb
40 Upvotes

6 comments sorted by

3

u/[deleted] Nov 08 '15

Here's the rendered version and hopefully we don't still get 503 errors.

3

u/nkruchten Nov 08 '15

(author here) Just as an FYI: this notebook was used to give a talk, and is probably not great in statically-rendered mode. Look out for the video of the talk for the full experience! :)

2

u/malice8691 Nov 08 '15

Jupyter look cool but I cant think of a single reason to use it.

5

u/nkruchten Nov 08 '15

The main reason I use Jupyter is that it makes the data analysis loop faster than alternative tools. This loop is basically code/execute/look at output/repeat where the "output" can be graphs or tables. Jupyter provides a single environment where I can type code in a cell, execute it (shift-enter) and see the table or graph inline. No need to switch to a shell which pops up a window or anything. Then I can walk someone through what I did by just explaining the notebook, they can see the code and the output in the same place, I can share it by checking it into Github etc.

And if I want to see the effect of changing a small number of variables, then the @interact decorator automatically pops up a slider or whatever so I can see the effect of changing that variable live before my eyes.

This advantage is fairly specific to data-analysis work, to be sure, so if you don't do this kind of work, I can totally understand your comment :)

2

u/nkruchten Dec 01 '15

The video from this talk is now available so the notebook will make a lot more sense in context: https://www.youtube.com/watch?v=zxkdO07L29Q

1

u/stickystuffremover Nov 08 '15 edited Nov 09 '15

I did this and now IPython has stopped working: "Kernel Error" (64bit Windows m/c, running py3.5-64bit. Any ideas on how to uninstall?

[E 21:15:55.638 NotebookApp] Unhandled error in API request
    Traceback (most recent call last):
      File "c:\python35\lib\site-packages\notebook\base\handlers.py", line 436, in wrapper
        result = yield gen.maybe_future(method(self, *args, **kwargs))
      File "c:\python35\lib\site-packages\notebook\services\sessions\handlers.py", line 56, in post
        model = sm.create_session(path=path, kernel_name=kernel_name)
      File "c:\python35\lib\site-packages\notebook\services\sessions\sessionmanager.py", line 66, in create_session
        kernel_name=kernel_name)
      File "c:\python35\lib\site-packages\notebook\services\kernels\kernelmanager.py", line 84, in start_kernel
        **kwargs)
      File "c:\python35\lib\site-packages\jupyter_client\multikernelmanager.py", line 109, in start_kernel
        km.start_kernel(**kwargs)
      File "c:\python35\lib\site-packages\jupyter_client\manager.py", line 244, in start_kernel
        **kw)
      File "c:\python35\lib\site-packages\jupyter_client\manager.py", line 190, in _launch_kernel
        return launch_kernel(kernel_cmd, **kw)
      File "c:\python35\lib\site-packages\jupyter_client\launcher.py", line 108, in launch_kernel
        proc = Popen(cmd, **kwargs)
      File "c:\python35\lib\subprocess.py", line 950, in __init__
        restore_signals, start_new_session)
      File "c:\python35\lib\subprocess.py", line 1220, in _execute_child
        startupinfo)
    FileNotFoundError: [WinError 2] The system cannot find the file specified[E 21:15:55.638 NotebookApp] Unhandled error in API request
    Traceback (most recent call last):
      File "c:\python35\lib\site-packages\notebook\base\handlers.py", line 436, in wrapper
        result = yield gen.maybe_future(method(self, *args, **kwargs))
      File "c:\python35\lib\site-packages\notebook\services\sessions\handlers.py", line 56, in post
        model = sm.create_session(path=path, kernel_name=kernel_name)
      File "c:\python35\lib\site-packages\notebook\services\sessions\sessionmanager.py", line 66, in create_session
        kernel_name=kernel_name)
      File "c:\python35\lib\site-packages\notebook\services\kernels\kernelmanager.py", line 84, in start_kernel
        **kwargs)
      File "c:\python35\lib\site-packages\jupyter_client\multikernelmanager.py", line 109, in start_kernel
        km.start_kernel(**kwargs)
      File "c:\python35\lib\site-packages\jupyter_client\manager.py", line 244, in start_kernel
        **kw)
      File "c:\python35\lib\site-packages\jupyter_client\manager.py", line 190, in _launch_kernel
        return launch_kernel(kernel_cmd, **kw)
      File "c:\python35\lib\site-packages\jupyter_client\launcher.py", line 108, in launch_kernel
        proc = Popen(cmd, **kwargs)
      File "c:\python35\lib\subprocess.py", line 950, in __init__
        restore_signals, start_new_session)
      File "c:\python35\lib\subprocess.py", line 1220, in _execute_child
        startupinfo)
    FileNotFoundError: [WinError 2] The system cannot find the file specified

edit: I solved this problem by switch from python3.5 to python3.4