【发布时间】:2016-08-28 10:39:24
【问题描述】:
我可以使用 Anaconda 在我的 PC 上的 Jupyter notebook (Python 3.5) 中运行以下代码,并且运行良好。但是当我在 Azure ML 笔记本中运行相同的代码时,我得到了情节,但也得到了下面描述的错误消息。有谁知道如何在 Azure ML 笔记本中使用 Bokeh?有没有办法导入看似缺失的模块'ipykernel'
from bokeh.plotting import figure, show, output_notebook
from bokeh.sampledata.iris import flowers
colormap = {'setosa': 'red', 'versicolor': 'green', 'virginica': 'blue'}
colors = [colormap[x] for x in flowers['species']]
p = figure(title = "Iris Morphology")
p.xaxis.axis_label = 'Petal Length'
p.yaxis.axis_label = 'Petal Width'
p.circle(flowers["petal_length"], flowers["petal_width"],
color=colors, fill_alpha=0.2, size=10)
output_notebook()
show(p)
产生情节,但也会出现以下错误
---------------------------------------------------------------------------
ImportError Traceback (most recent call last)
<ipython-input-17-c50d1a94007e> in <module>()
13
14 output_notebook()
---> 15 show(p)
/home/nbuser/env3/lib/python3.4/site-packages/bokeh/io.py in show(obj, browser, new)
299
300 '''
--> 301 return _show_with_state(obj, _state, browser, new)
302
303 def _show_with_state(obj, state, browser, new):
/home/nbuser/env3/lib/python3.4/site-packages/bokeh/io.py in _show_with_state(obj, state, browser, new)
307
308 if state.notebook:
--> 309 comms_handle = _show_notebook_with_state(obj, state)
310
311 elif state.server_enabled:
/home/nbuser/env3/lib/python3.4/site-packages/bokeh/io.py in _show_notebook_with_state(obj, state)
329 comms_target = make_id()
330 publish_display_data({'text/html': notebook_div(obj, comms_target)})
--> 331 handle = _CommsHandle(get_comms(comms_target), state.document, state.document.to_json())
332 state.last_comms_handle = handle
333 return handle
/home/nbuser/env3/lib/python3.4/site-packages/bokeh/util/notebook.py in get_comms(target_name)
109
110 '''
--> 111 from ipykernel.comm import Comm
112 return Comm(target_name=target_name, data={})
113
ImportError: No module named 'ipykernel'
In [16]:
【问题讨论】:
标签: python azure jupyter-notebook bokeh azure-machine-learning-studio