Jon*_*nas 11 jupyter-notebook jupyterhub ipywidgets jupyter-lab
目前,我们的团队正在使用 JupyterHub。当我尝试在 JupyterLab 中使用 ipywidgets 时,出现此 JavaScript 错误(https 地址被删除)
\n代码
\nimport ipywidgets as widgets\n\nslider = widgets.FloatSlider(description=\'$x$\')\ntext = widgets.FloatText(disabled=True, description=\'$x^2$\')\n\ndef compute(*ignore):\n text.value = str(slider.value ** 2)\n\nslider.observe(compute, \'value\')\n\nslider.value = 4\n\nwidgets.VBox([slider, text])\nRun Code Online (Sandbox Code Playgroud)\n笔记本上的错误:
\n[Open Browser Console for more detailed log - Double click to close this message]\nFailed to load model class \'VBoxModel\' from module \'@jupyter-widgets/controls\'\nError: Module @jupyter-widgets/controls, version ^1.5.0 is not registered, however, 2.0.0 is\n at f.loadClass (/lab/extensions/@jupyter-widgets/jupyterlab-manager/static/134.bcbea9feb6e7c4da7530.js?v=bcbea9feb6e7c4da7530:1:74977)\n at f.loadModelClass (/lab/extensions/@jupyter-widgets/jupyterlab-manager/static/150.3e1e5adfd821b9b96340.js?v=3e1e5adfd821b9b96340:1:10729)\n at f._make_model (/lab/extensions/@jupyter-widgets/jupyterlab-manager/static/150.3e1e5adfd821b9b96340.js?v=3e1e5adfd821b9b96340:1:7517)\n at f.new_model (/lab/extensions/@jupyter-widgets/jupyterlab-manager/static/150.3e1e5adfd821b9b96340.js?v=3e1e5adfd821b9b96340:1:5137)\n at f.handle_comm_open (/lab/extensions/@jupyter-widgets/jupyterlab-manager/static/150.3e1e5adfd821b9b96340.js?v=3e1e5adfd821b9b96340:1:3894)\n at _handleCommOpen (/lab/extensions/@jupyter-widgets/jupyterlab-manager/static/134.bcbea9feb6e7c4da7530.js?v=bcbea9feb6e7c4da7530:1:73393)\n at b._handleCommOpen (/static/lab/jlab_core.c53d87cd566b4851041c.js?v=c53d87cd566b4851041c:2:1203616)\n at async b._handleMessage (/static/lab/jlab_core.c53d87cd566b4851041c.js?v=c53d87cd566b4851041c:2:1205606)\nRun Code Online (Sandbox Code Playgroud)\n这是浏览器控制台中的错误(https://i.stack.imgur.com/E9wJS.png)
\n套餐:
\nPackage Version\n----------------------------- ------------\nabsl-py 1.3.0\naiohttp 3.8.3\naiosignal 1.3.1\nalembic 1.8.1\naltair 4.2.0\nanyio 3.6.2\nappmode 0.8.0\nargon2-cffi 21.3.0\nargon2-cffi-bindings 21.2.0\nasn1crypto 1.5.1\nasttokens 2.1.0\nastunparse 1.6.3\nasync-generator 1.10\nasync-timeout 4.0.2\nattrs 22.1.0\nBabel 2.11.0\nbackcall 0.2.0\nbackports.functools-lru-cache 1.6.4\nbeautifulsoup4 4.11.1\nbleach 5.0.1\nblinker 1.5\nbokeh 3.0.2\nboto3 1.26.16\nbotocore 1.29.16\nBottleneck 1.3.5\nbrotlipy 0.7.0\ncached-property 1.5.2\ncachetools 5.2.0\ncertifi 2022.9.24\ncertipy 0.1.3\ncffi 1.15.1\ncharset-normalizer 2.1.1\nclick 8.1.3\ncloudpickle 2.2.0\ncolorama 0.4.6\ncomm 0.1.0\nconda 22.9.0\nconda-package-handling 1.9.0\ncontourpy 1.0.6\ncryptography 38.0.3\ncycler 0.11.0\nCython 0.29.32\ncytoolz 0.12.0\ndask 2022.11.0\ndebugpy 1.6.3\ndecorator 5.1.1\ndefusedxml 0.7.1\ndill 0.3.6\ndistributed 2022.11.0\necdsa 0.18.0\nenbw-aop-client 0.20221027.1\nentrypoints 0.4\nentsoe-py 0.5.8\nenvs 1.4\net-xmlfile 1.0.1\nexecuting 1.2.0\nfastjsonschema 2.16.2\nfilelock 3.8.0\nFlask 2.2.2\nflatbuffers 2.0\nflit_core 3.8.0\nfonttools 4.38.0\nfrozenlist 1.3.3\nfsspec 2022.11.0\ngast 0.4.0\ngeographiclib 1.52\ngeopy 2.3.0\ngitdb 4.0.9\nGitPython 3.1.29\ngmpy2 2.1.2\ngoogle-auth 2.14.1\ngoogle-auth-oauthlib 0.4.6\ngoogle-pasta 0.2.0\ngravis 0.1.0\ngreenlet 2.0.1\ngrpcio 1.47.1\nh11 0.14.0\nh5py 3.7.0\nHeapDict 1.0.1\nidna 3.4\nimagecodecs 2022.9.26\nimageio 2.22.4\nimportlib-metadata 5.0.0\nimportlib-resources 5.10.0\nipykernel 6.18.0\nipython 8.6.0\nipython-genutils 0.2.0\nipywidgets 7.6.5\nitsdangerous 2.1.2\njedi 0.18.2\nJinja2 3.1.2\njmespath 1.0.1\njoblib 1.2.0\njson5 0.9.10\njsonschema 4.17.1\njupyter_client 7.4.1\njupyter_core 5.0.0\njupyter-server 1.23.3\njupyter-server-mathjax 0.2.6\njupyter-server-proxy 3.2.2\njupyter-telemetry 0.1.0\njupyterhub 3.0.0\njupyterlab 3.5.0\njupyterlab-git 0.39.3\njupyterlab-pygments 0.2.2\njupyterlab_server 2.16.3\njupyterlab-widgets 1.1.1\nkeras 2.10.0\nKeras-Preprocessing 1.1.2\nkiwisolver 1.4.4\nlibmambapy 1.0.0\nllvmlite 0.39.1\nlocket 1.0.0\nlxml 4.9.1\nlz4 4.0.2\nMako 1.2.4\nmamba 1.0.0\nMarkdown 3.4.1\nMarkupSafe 2.1.1\nmatplotlib 3.6.2\nmatplotlib-inline 0.1.6\nmistune 0.8.4\nmpmath 1.2.1\nmsgpack 1.0.4\nmultidict 6.0.2\nmunkres 1.1.4\nnbclassic 0.4.8\nnbclient 0.5.13\nnbconvert 6.5.3\nnbdime 3.1.1\nnbformat 5.7.0\nnbtools 21.12\nnest-asyncio 1.5.6\nnetworkx 2.8.8\nneurolab 0.3.5\nnotebook 6.5.2\nnotebook_shim 0.2.2\nntlm-auth 1.5.0\nnumba 0.56.4\nnumexpr 2.8.3\nnumpy 1.23.5\noauthlib 3.2.2\nopenpyxl 3.0.10\nopt-einsum 3.3.0\noscrypto 1.2.1\noutcome 1.2.0\npackaging 21.3\npamela 1.0.0\npandas 1.5.2\npandocfilters 1.5.0\nparso 0.8.3\npartd 1.3.0\npatsy 0.5.3\npexpect 4.8.0\npickleshare 0.7.5\nPillow 9.2.0\npip 22.3.1\npkgutil_resolve_name 1.3.10\nplatformdirs 2.5.4\nplotly 5.11.0\npretty-html-table 0.9.11\nprometheus-client 0.15.0\nprompt-toolkit 3.0.33\nprotobuf 4.21.9\npsutil 5.9.4\nptyprocess 0.7.0\npure-eval 0.2.2\npyarrow 9.0.0\npyasn1 0.4.8\npyasn1-modules 0.2.7\npycognito 2022.4.0\npycosat 0.6.4\npycparser 2.21\npycryptodomex 3.15.0\npycurl 7.45.1\npydantic 1.10.2\nPygments 2.13.0\nPyJWT 2.6.0\npyOpenSSL 22.1.0\npyparsing 3.0.9\npyproj 3.4.0\npyrsistent 0.19.2\nPySocks 1.7.1\npython-dateutil 2.8.2\npython-jose 3.3.0\npython-json-logger 2.0.1\npytz 2022.6\npytz-deprecation-shim 0.1.0.post0\npyu2f 0.1.5\nPyWavelets 1.3.0\nPyYAML 6.0\npyzmq 24.0.1\nrequests 2.28.1\nrequests-ntlm 1.1.0\nrequests-oauthlib 1.3.1\nrequests-toolbelt 0.10.1\nrpy2 3.5.6\nrsa 4.9\nruamel.yaml 0.17.21\nruamel.yaml.clib 0.2.7\nruamel-yaml-conda 0.15.80\ns3transfer 0.6.0\nscikit-image 0.19.3\nscikit-learn 1.1.3\nscipy 1.9.3\nseaborn 0.12.1\nselenium 4.6.0\nSend2Trash 1.8.0\nsetuptools 65.6.2\nSharePlum 0.5.1\nsimpervisor 0.4\nsimplegeneric 0.8.1\nsix 1.16.0\nsmmap 3.0.5\nsniffio 1.3.0\nsnowflake-connector-python 2.8.2\nsortedcontainers 2.4.0\nsoupsieve 2.3.2.post1\nSQLAlchemy 1.4.44\nstack-data 0.6.1\nstatsmodels 0.13.5\nsympy 1.11.1\ntables 3.7.0\ntblib 1.7.0\ntenacity 8.1.0\ntensorboard 2.10.1\ntensorboard-data-server 0.6.0\ntensorboard-plugin-wit 1.8.1\ntensorflow 2.10.0\ntensorflow-estimator 2.10.0\ntermcolor 2.1.1\nterminado 0.17.0\nterminaltables 3.1.10\nthreadpoolctl 3.1.0\ntifffile 2022.10.10\ntinycss2 1.2.1\ntomli 2.0.1\ntoolz 0.12.0\ntornado 6.2\ntqdm 4.64.1\ntraitlets 5.5.0\ntrio 0.21.0\ntrio-websocket 0.9.2\ntyping_extensions 4.4.0\ntzdata 2022.6\ntzlocal 4.2\nunicodedata2 15.0.0\nurllib3 1.26.13\nusp.common.data 5.1.1\nusp.common.util 0.0.1\nvoila 0.4.0\nwcwidth 0.2.5\nwebencodings 0.5.1\nwebsocket-client 1.4.2\nwebsockets 10.4\nWerkzeug 2.2.2\nwheel 0.38.4\nwidgetsnbextension 3.5.2\nwrapt 1.14.1\nwsproto 1.2.0\nxlrd 2.0.1\nXlsxWriter 3.0.3\nxyzservices 2022.9.0\nyarl 1.8.1\nzict 2.2.0\nzipp 3.10.0\nRun Code Online (Sandbox Code Playgroud)\n我已经尝试过该解决方案的两个版本ipywidgets==7.6.5 or ipywidgets==7.7.2 ipywidgets < 8 例如 7.7 无法使用 pip \xc2\xb7 安装 Issue #3558 \xc2\xb7 jupyter-widgets/ipywidgets \xc2\xb7 GitHub
每个用户的单独环境(从零到 JupyterHub 解决方案)以 开头ipywidgets==8.0.2。问题是,<8由于您的问题,我们可能需要另一个版本,瞧 Nbconvert 和 voila no ipywidgets 问题,我们可能需要另一个版本 - 一般 - Jupyter 社区论坛
交叉发布https://discourse.jupyter.org/t/ipywidgets-are-not-displayed-with-javascript-error/16958
\n小智 0
不是答案:
这个问题似乎与升级到 jupyterlab 4 有关。我有完美的代码。ipyfilechooser 的 FileChooser 工作了。单元格下方会出现一个小框,我单击该框,然后可以选择一个文件(或者在我的情况下,选择一个文件夹)。现在我得到了同样的 javascript 错误。
如果我采取以下步骤,我可以让它工作:
但是,如果我使用 conda 安装的内核(我必须这样做),则卸载/重新安装没有任何效果。
| 归档时间: |
|
| 查看次数: |
1552 次 |
| 最近记录: |