如何在 Jupyterhub 上用 ipycanvas 显示 Canvas?
How to display Canvas with ipycanvas on Jupyterhub?
以下代码在我的本地 machine/environment:
上运行良好
from ipycanvas import Canvas
canvas = Canvas(width=300, height=300)
display(canvas)
但是使用安装在 GCP VM 上的 jupyterhub
它不再显示 canvas。
缺少什么?
ipycanvas是一个包,需要和jupyterlab实例安装在同一个环境中。此外,您需要安装 nodejs,并且需要启用 jupyterlab ipycanvas 小部件。
这些都包含在ipycanvas installation instructions:
Using conda
conda install -c conda-forge ipycanvas
JupyterLab extension
If you have JupyterLab, you will also need to install the JupyterLab extension. In order to install the JupyterLab extension, you will need npm to be installed. You can easily install npm with conda:
conda install -c conda-forge nodejs
Then you can install the JupyterLab extension:
jupyter labextension install @jupyter-widgets/jupyterlab-manager ipycanvas
既然你提到你在 jupyterhub 上,如果你在集群上并且你不是管理员,那么你可能没有执行此操作的权限。如果是这种情况,请联系您的集群管理员 - 他们可能不允许用户启用扩展。
以下代码在我的本地 machine/environment:
上运行良好from ipycanvas import Canvas
canvas = Canvas(width=300, height=300)
display(canvas)
但是使用安装在 GCP VM 上的 jupyterhub
它不再显示 canvas。
缺少什么?
ipycanvas是一个包,需要和jupyterlab实例安装在同一个环境中。此外,您需要安装 nodejs,并且需要启用 jupyterlab ipycanvas 小部件。
这些都包含在ipycanvas installation instructions:
Using conda
conda install -c conda-forge ipycanvas
JupyterLab extension
If you have JupyterLab, you will also need to install the JupyterLab extension. In order to install the JupyterLab extension, you will need npm to be installed. You can easily install npm with conda:
conda install -c conda-forge nodejs
Then you can install the JupyterLab extension:
jupyter labextension install @jupyter-widgets/jupyterlab-manager ipycanvas
既然你提到你在 jupyterhub 上,如果你在集群上并且你不是管理员,那么你可能没有执行此操作的权限。如果是这种情况,请联系您的集群管理员 - 他们可能不允许用户启用扩展。