如何克服“错误:在注册表中找不到对象'jupyter.widget'"? [英] How can I overcome "Error: Object 'jupyter.widget' not found in registry"?

查看:633
本文介绍了如何克服“错误:在注册表中找不到对象'jupyter.widget'"?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在kubernetes上的jupyterhub中运行jupyterlab.

I am running jupyterlab within jupyterhub on kubernetes.

我正在尝试使用例如

from ipywidgets import interact

@interact(x=(0, 100, 10))
def p(x=50):
    pass

实验室笔记本代替预期的交互式窗口小部件进行打印:

Instead of the intended interactive widget, the lab notebook prints:

interactive(children=(IntSlider(value=50, description='x', step=10), Output()), _dom_classes=('widget-interact...

在检查javascript控制台时:

On inspection of the javascript console:

default.js:129 Error: Object 'jupyter.widget' not found in registry
    at default.js:1474
    at new Promise (<anonymous>)
    at Object.loadObject (default.js:1453)
    at DefaultKernel.<anonymous> (default.js:919)
    at Generator.next (<anonymous>)
    at default.js:9
    at new Promise (<anonymous>)
    at push.YC29.__awaiter (default.js:5)
    at DefaultKernel._handleCommOpen (default.js:911)
    at DefaultKernel.<anonymous> (default.js:1018)

我尝试了以下多种组合:

I have tried many different combinations of:

!pip install ipywidgets
!pip install widgetsnbextension --upgrade
!pip install widgetslabextension --upgrade
!conda install -n base -y --override-channels -c main -c conda-forge widgetsnbextension ipywidgets nodejs
!jupyter nbextension enable --py widgetsnbextension
!jupyter labextension enable widgetsnbextension
!jupyter labextension list
!jupyter labextension install @jupyter-widgets/jupyterlab-manager
!jupyter lab clean
!jupyter lab build
!pip install --upgrade Nodejs
!npm install -g npm yarn
!jupyter serverextension enable --py jupyterlab --sys-prefix

jupyterlab的值为1.0.0,jupyterlab-manager的值为1.0.

jupyterlab is at 1.0.0 and jupyterlab-manager is at 1.0.

一切正常之后,如何传播更改?

Once everything is in order, how do I propagate changes?

NB如果我重新启动jupyterlab,则容器将重新启动,并且所有更改都将丢失.

NB If I restart jupyterlab the container restarts and all changes are lost.

我将做任何事情-打印版本,冻结点,运行测试,重新格式化/重新编码该问题.

I will do anything - print versions, pip freeze, run tests, reformat/reword this question.

有人知道如何解决这个问题吗?

Does anyone have a remote clue how to resolve this?

请帮助!

以下内容无济于事:

如何让ipywidgets在Jupyter Lab中工作?

https://ipywidgets.readthedocs.io /en/latest/user_install.html#installing-the-jupyterlab-extension

问题显示小部件/ipywidgets安装失败

https://github.com/jupyter-widgets/ipywidgets/issues/2220

https://github.com/jupyter-widgets/ipywidgets/issues/2514

https://github.com/jupyter-widgets/ipywidgets/issues/2483

https://github.com/twosigma/beakerx/issues/7520

https://github.com/jupyterlab/jupyterlab/issues/6998

https://jupyterhub.readthedocs.io/en/stable/troubleshooting.html

https://github.com/jupyter-widgets/ipywidgets/issues/1949

https://github.com/jupyter-widgets/ipywidgets/pull/1962

推荐答案

利用

Leveraging https://github.com/jupyter-widgets/ipywidgets/issues/2488#issuecomment-509719214, in a jupyterlab terminal - running on jupyterhub - execute:

pythonversion=3.7
labversion=0.34.12
labmanagerversion=0.37.4
ipywidgetsversion=7.4.2

conda install ipywidgets=$ipywidgetsversion -c conda-forge -y --override-channels -c main
conda install jupyterlab=$labversion  -y -c conda-forge --override-channels -c main
jupyter-labextension install @jupyter-widgets/jupyterlab-manager@$labmanagerversion

此时,可能会感兴趣的是jupyter lab clean; jupyter lab build.

At this point a jupyter lab clean; jupyter lab build might be of interest.

然后在同一jupyterlab窗口中运行的.ipynb笔记本中,点击重新启动内核按钮.

Then in a .ipynb notebook running in the same jupyterlab window, hit the restart kernel button.

重要提示:请不要忘记也刷新浏览器页面刷新,否则所有的努力都将徒劳无功. :\

IMPORTANT: Don't forget to also REFRESH the browser page - or all efforts will have been in vain . :\

然后执行示例:

from ipywidgets import interact

@interact(x=(0, 100, 10))
def p(x=50):
    pass

我从没想过要住一天,但是-嘿,我很高兴-小部件终于出现了!

I never thought I would live to see the day but - hey presto - the widget finally appears!

可悲的是,安装程序对其他扩展的安装极为敏感,兼容版本的组合非常具体.

The sad things are that the setup is extremely sensitive to the installation of other extensions and the combination of compatible versions is very specific.

这篇关于如何克服“错误:在注册表中找不到对象'jupyter.widget'"?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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