You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
First of all, thanks for this awesome package! It has made developing a widget for my package (pipefunc/pipefunc#323) much easier!
My widget works in a Jupyter notebook but in VS Code I get:
[Open Browser Console for more detailed log - Double click to close this message]
Failed to load model class 'AnyModel' from module 'anywidget'
Error: No version of module anywidget is registered
at ph.loadClass (https://file+.vscode-resource.vscode-cdn.net/Users/basnijholt/.vscode/extensions/ms-toolsai.jupyter-renderers-1.0.19/out/node_modules/%40vscode/jupyter-ipywidgets8/dist/ipywidgets.js:2:4099813)
at ph.loadClass (https://file+.vscode-resource.vscode-cdn.net/Users/basnijholt/.vscode/extensions/ms-toolsai.jupyter-renderers-1.0.19/out/node_modules/%40vscode/jupyter-ipywidgets8/dist/ipywidgets.js:2:4403287)
at ph.loadModelClass (https://file+.vscode-resource.vscode-cdn.net/Users/basnijholt/.vscode/extensions/ms-toolsai.jupyter-renderers-1.0.19/out/node_modules/%40vscode/jupyter-ipywidgets8/dist/ipywidgets.js:2:4097773)
at ph._make_model (https://file+.vscode-resource.vscode-cdn.net/Users/basnijholt/.vscode/extensions/ms-toolsai.jupyter-renderers-1.0.19/out/node_modules/%40vscode/jupyter-ipywidgets8/dist/ipywidgets.js:2:4094616)
at ph.new_model (https://file+.vscode-resource.vscode-cdn.net/Users/basnijholt/.vscode/extensions/ms-toolsai.jupyter-renderers-1.0.19/out/node_modules/%40vscode/jupyter-ipywidgets8/dist/ipywidgets.js:2:4092246)
at ph.handle_comm_open (https://file+.vscode-resource.vscode-cdn.net/Users/basnijholt/.vscode/extensions/ms-toolsai.jupyter-renderers-1.0.19/out/node_modules/%40vscode/jupyter-ipywidgets8/dist/ipywidgets.js:2:4091039)
at https://file+.vscode-resource.vscode-cdn.net/Users/basnijholt/.vscode/extensions/ms-toolsai.jupyter-renderers-1.0.19/out/node_modules/%40vscode/jupyter-ipywidgets8/dist/ipywidgets.js:2:4402511
at n._handleCommOpen (https://file+.vscode-resource.vscode-cdn.net/Users/basnijholt/.vscode/extensions/ms-toolsai.jupyter-2024.8.1-darwin-arm64/dist/webviews/webview-side/ipywidgetsKernel/ipywidgetsKernel.js:3:80955)
at async n._handleMessage (https://file+.vscode-resource.vscode-cdn.net/Users/basnijholt/.vscode/extensions/ms-toolsai.jupyter-2024.8.1-darwin-arm64/dist/webviews/webview-side/ipywidgetsKernel/ipywidgetsKernel.js:3:82830)
Thanks for the detailed error message. I'm sorry I haven't been able to dive deep into this yet. Some users on Discord mentioned some issues in an update of VS Code and I'm wondering if they have been resolved now.
I just tested locally with the anywidget template repo and I'm able to develop in VS Code:
pnpm create anywidget@latest
However, I think there may be an issue with the global environment. I see the graph_widget.js code appends scripts to the window. In my experience, this is a very unreliable way to load javascript code as there can be version conflicts or the UMD builds of those pacakges will look for tools like RequireJS (which is a primary source of pain and variation between notebook frontnends). In order to make anywidget work, we focused on ECMAScript modules and hope widget authors will also use ESM since it's much more reliable way to JavaScript in an isolated manner.
I'm not sure whether the packages you've included have been packaged as ESM anywhere via a CDN (I'd try something like esm.sh), but otherwise you can use the project template and try bundling them locally with esbuild.
Describe the bug
First of all, thanks for this awesome package! It has made developing a widget for my package (pipefunc/pipefunc#323) much easier!
My widget works in a Jupyter notebook but in VS Code I get:
I found some related issue here:
JupyterChart
component vega/altair#3409 (comment)Reproduction
I have this widget
with
graphviz_widget.js
:The I run:
graph_widget()
In a Jupyter notebook in the browser this works, but in VS Code I see the error I posted above.
Logs
No response
System Info
The text was updated successfully, but these errors were encountered: