No module named ipykernel.comm

Hi,

I am getting an ImportError when I try to use the bokeh.charts.Bar or Line methods in a Jupyter notebook.

It actually displays the plot properly, but then the ImportError pops up.

I am on IPython 3.2.0 I believe.

Any idea what might be going wrong?


<details class='elided'>
<summary title='Show trimmed content'>&#183;&#183;&#183;</summary>

---------------------------------------------------------------------------
ImportError                               Traceback (most recent call last)
<ipython-input-10-5de224ebbcca> in <module>()
      1 b = Bar(df, label='LOCATION', values='WAFERQTY', stack='STATE', agg='sum', width=450,       2         tooltips=[('Location', '@LOCATION'), ('State', '@STATE'), ('Qty', '$y')])
----> 3 show(b)

C:\Program Files\Anaconda\lib\site-packages\bokeh\io.pyc in show(obj, browser, new)
    277
    278     '''
--> 279     return _show_with_state(obj, _state, browser, new)
    280
    281 def _show_with_state(obj, state, browser, new):

C:\Program Files\Anaconda\lib\site-packages\bokeh\io.pyc in _show_with_state(obj, state, browser, new)
    285
    286     if state.notebook:
--> 287         comms_handle = _show_notebook_with_state(obj, state)
    288
    289     elif state.server_enabled:

C:\Program Files\Anaconda\lib\site-packages\bokeh\io.pyc in _show_notebook_with_state(obj, state)
    307         comms_target = str(uuid.uuid4())
    308         publish_display_data({'text/html': notebook_div(obj, comms_target)})
--> 309         handle = _CommsHandle(get_comms(comms_target), state.document, state.document.to_json())
    310         state.last_comms_handle = handle
    311         return handle

C:\Program Files\Anaconda\lib\site-packages\bokeh\util\notebook.pyc in get_comms(target_name)
    105
    106     '''
--> 107     from ipykernel.comm import Comm
    108     return Comm(target_name=target_name, data={})
    109

ImportError: No module named ipykernel.comm

Hi Adrian,

Not doing anything wrong, but I guess IPython 3.2 is too old for the new notebook comms feature. There might be a way to make it work on older versions, but it's unlikely that supporting that one feature for older IPython can be ascribed a high priority. The quickest solution would just be to wrap the code in the last backtrace frame at the bottom in a try...except block, and return None if there is an import error. I think that would suffice to have everything except notebooks comms work on older IPython. Can you try that out / submit a PR? I don't have an older IPython set up, and it would be much more efficient for someone who already do have to test it out.

Thanks,

Bryan

···

On Jan 15, 2016, at 7:53 AM, [email protected] wrote:

Hi,

I am getting an ImportError when I try to use the bokeh.charts.Bar or Line methods in a Jupyter notebook.

It actually displays the plot properly, but then the ImportError pops up.

I am on IPython 3.2.0 I believe.

Any idea what might be going wrong?

---------------------------------------------------------------------------
ImportError
                               Traceback (most recent call last)

<ipython-input-10-5de224ebbcca> in <module>()
      1
b = Bar(df, label='LOCATION', values='WAFERQTY', stack='STATE', agg='sum', width=450,

      2
         tooltips=[('Location', '@LOCATION'), ('State', '@STATE'), ('Qty', '$y')])

----> 3 show(b)

C:\Program Files\Anaconda\lib\site-packages\bokeh\io.pyc in show(obj, browser, new)
    277
    278
     '''

--> 279 return _show_with_state(obj, _state, browser, new)
    280
    281 def _show_with_state(obj, state, browser, new):

C:\Program Files\Anaconda\lib\site-packages\bokeh\io.pyc in _show_with_state(obj, state, browser, new)
    285
    286 if state.notebook:
--> 287 comms_handle = _show_notebook_with_state(obj, state)
    288
    289 elif state.server_enabled:

C:\Program Files\Anaconda\lib\site-packages\bokeh\io.pyc in _show_notebook_with_state(obj, state)
    307 comms_target = str(uuid.uuid4())
    308 publish_display_data({'text/html': notebook_div(obj, comms_target)})
--> 309 handle = _CommsHandle(get_comms(comms_target), state.document, state.document.to_json())
    310 state.last_comms_handle = handle
    311 return handle

C:\Program Files\Anaconda\lib\site-packages\bokeh\util\notebook.pyc in get_comms(target_name)
    105
    106
     '''

--> 107 from ipykernel.comm import Comm
    108 return Comm(target_name=target_name, data={})
    109

ImportError
: No module named ipykernel.comm

--
You received this message because you are subscribed to the Google Groups "Bokeh Discussion - Public" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit https://groups.google.com/a/continuum.io/d/msgid/bokeh/23b331aa-e4fa-4151-98c9-3220d33524a8%40continuum.io.
For more options, visit https://groups.google.com/a/continuum.io/d/optout.

Thanks Bryan, I will look at migrating to a newer version of IPython.