如何让HoloViews显示在Google Colabs笔记本中? [英] How do I get HoloViews to display in Google Colabs notebooks?

查看:127
本文介绍了如何让HoloViews显示在Google Colabs笔记本中?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我无法在任何 Google Colabs 笔记本.

例如,即使是简单的Bokeh示例,也可以直接从 HoloViews简介

For example even the simple Bokeh example right out fo the HoloViews introduction

points = hv.Points(np.random.randn(500,2))
points.hist(num_bins=51, dimension=['x','y'])

无法显示任何内容,没有报告任何错误,而相同的代码(以及来自HoloViews的所有示例代码)在本地Jupyter笔记本中正常工作.

fails to show anything, without any error being reported, while the same code (and all example code from HoloViews) works fine in local Jupyter notebooks.

如果我在本地下载Colabs笔记本并打开它,则会看到以下内容,在Colabs中什么也没说:

If I download the Colabs notebook locally and open it, I see the following where I say nothing for output in Colabs:

找不到输出的(安全)渲染器.它具有以下MIME类型:application/javascript,application/vnd.bokehjs_load.v0 + json

No (safe) renderer could be found for output. It has the following MIME types: application/javascript, application/vnd.bokehjs_load.v0+json

如何使Bokeh HoloViews显示在Google Colabs笔记本中?

How do I get Bokeh HoloViews to display in Google Colabs notebooks?

推荐答案

请参见 https://github .com/pyviz/holoviews/issues/3551 . Colaboratory在处理笔记本电脑方面有一些严重的限制,现在您必须执行一次:

See https://github.com/pyviz/holoviews/issues/3551 . Colaboratory has some serious limitations on how it handles notebooks, and for now you have to do this once:

import os, holoviews as hv
os.environ['HV_DOC_HTML'] = 'true'

然后,对于其中包含绘图的每个单元格,必须重新加载JS:

Then for every single cell with a plot in it you have to re-load the JS:

hv.extension('bokeh')

hv.Curve([1, 2, 3])

如果Google可以解决此问题,那将是非常好的,因为我认为这是行不通的.

It would be great if Google could fix that, as it's unworkable in my opinion.

这篇关于如何让HoloViews显示在Google Colabs笔记本中?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆