question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Did the recent upgrade of ipywidgets (7.7.1->8.0.1) change the CDN-service for custom widgets?

See original GitHub issue

Thanks you for the innovative and very useful work you are doing with the ipywidgets-framework.

I’m prototyping a piece of visualization software built from the widget-cookiecutter and threejs. I’ve been testing mainly in notebooks and html-embedding.

Recently, I updated ipywidgets from 7.7.1 to 8.0.1, which seems to have broken the html-embed option. On 8.0.1 it still runs nicely in the Notebook, but when either doing “embed_minimal_html”, nbconvert to html, or (from the menu in the Notebook-environment) “embed widget state”, no view is shown in the resulting html.

I’m fairly new to Javascript, so I’m still struggling to debug properly, but the console (on Chrome, 104.0.5112.101 ) reports that it is “Falling back to https://cdn.jsdelivr.net/npm/” to fetch my embedded model. It then complains that “embed-amd.js:16 TypeError: o._deserialize_state is not a function at xc._make_model (embed-amd.js:16:581882)”. I cannot find any other reference to this error-message using google or browsing the documentation.

However, when downgrading ipywidgets to 7.7.1, my custom widgets works as intended. From my console, I can then read that it is "falling back to https://unpkg.com/ " for my embedded model, and it shows up on screen.

In my webpack.config.js-file, it explicitly says

entry: './lib/embed.js',
            output: {
                filename: 'index.js',
                path: path.resolve(__dirname, 'dist'),
                libraryTarget: 'amd',
                publicPath: 'https://unpkg.com/evince@' + version + '/dist/'
            },

which I understand to be the CDN-service from which to request the model.

My question is then, has there been made some changes recently which could affect this behaviour (changing from unpkg.com to cdn.jsdelivr.net), or is there something else I’m missing here?

Best regards, Audun

My setup:

{'commit_hash': '4396dd620',
 'commit_source': 'installation',
 'default_encoding': 'utf-8',
 'ipython_path': '/usr/local/lib/python3.10/site-packages/IPython',
 'ipython_version': '8.4.0',
 'os_name': 'posix',
 'platform': 'macOS-12.3.1-x86_64-i386-64bit',
 'sys_executable': '/usr/local/opt/python@3.10/bin/python3.10',
 'sys_platform': 'darwin',
 'sys_version': '3.10.6 (main, Aug 11 2022, 13:49:25) [Clang 13.1.6 '
                '(clang-1316.0.21.2.5)]'}

Issue Analytics

  • State:closed
  • Created a year ago
  • Comments:10 (5 by maintainers)

github_iconTop GitHub Comments

1reaction
audunshcommented, Sep 5, 2022

Thanks for resolving this issue efficiently. I can confirm that it works as intended now (Notebooks, embedding with export_minimal_html, nbconvert, “embed widget state” and jupyter book). Again, keep up the excellent work!

1reaction
jasongroutcommented, Sep 2, 2022

Ah, you’re right! https://github.com/jupyter-widgets/widget-cookiecutter/blob/6134771c6f2d7c275b186ff0cc00839be8d067b6/{{cookiecutter.github_project_name}}/js/lib/example.js does indeed have the old way of doing it! Thanks for pointing this out.

I’ll make a PR to update that part of the cookiecutter.

I’d still suggest using the js cookiecutter. The ts cookiecutter is more out of date than the js cookiecutter with respect to ipywidgets 8.

Read more comments on GitHub >

github_iconTop Results From Across the Web

ipywidgets changelog — Jupyter Widgets 7.7.1 documentation
This logic first tries to use the new widget control comm channel, ... Custom widget maintainers will need to make two changes to...
Read more >
Releases · jupyter-widgets/ipywidgets - GitHub
Custom widget maintainers will need to make two changes to update for JupyterLab 3: Update the @jupyter-widgets/base dependency version to include ^4 to...
Read more >
How to get ipywidgets working in Jupyter Lab? - Stack Overflow
The main change in this release is that installing ipywidgets 7.6.0 will now automatically enable ipywidgets support in JupyterLab 3.0—a user ...
Read more >
ipywidgets · PyPI
ipywidgets, also known as jupyter-widgets or simply widgets, are interactive HTML widgets for Jupyter notebooks and the IPython kernel.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found