Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

AttributeError: 'super' object has no attribute '_ipython_display_' #3552

Closed
hainm opened this issue Aug 19, 2022 · 11 comments
Closed

AttributeError: 'super' object has no attribute '_ipython_display_' #3552

hainm opened this issue Aug 19, 2022 · 11 comments

Comments

@hainm
Copy link

hainm commented Aug 19, 2022

Dear all,

We got AttributeError: 'super' object has no attribute '_ipython_display_' when upgrading to ipywidgets 8
nglviewer/nglview#1032 (comment)
The class inherits from ipywidgets.DOMWidget

Any idea how to fix?
(I've read the migration note from 7 to 8 but could not find anything)

Thanks
Hai

@soobidou
Copy link

I also have similar issues.
SparkMagic + Jupyterlab latest version now breaks because of this change.

Tried reverting to latest 7.x.x and now have issues with
@jupyter-widgets/jupyterlab-manager complaining about @jupyter-widgets/controls

(!!!)

@vidartf
Copy link
Member

vidartf commented Aug 19, 2022

The change that causes this: #2021

The correct migration path is to replace the method with a _repr_mimebundle_ method. The are pretty similar, but has some nuances. If you could contribute a section to the migration guide that would help out a lot!

@jasongrout
Copy link
Member

Tried reverting to latest 7.x.x and now have issues with
@jupyter-widgets/jupyterlab-manager complaining about @jupyter-widgets/controls

@soobidou - can you upgrade to ipywidgets 7.7.2 and make sure you have jupyterlab_widgets version 1.x (and not version 3).

@soobidou
Copy link

With 7.7.2, it's the same issue as my comment above
More details:

image

My env:

ipywidgets                    7.7.2
jupyterlab-widgets            1.1.1
widgetsnbextension            3.6.1

In DOM inspector I see many traces of:

Failed to load model class VBoxModel from module @jupyter-widgets/controls
Module @jupyter-widgets/controls version ^1.5.0 however 2.0.0 is 



150.467514c324d2bcc2…514c324d2bcc23502:1 Failed to fetch ipywidgets through the "jupyter.widget.control" comm channel, fallback to fetching individual model state. Reason: Control comm was closed too early
7
134.083e6b37f2f7b2f0…e6b37f2f7b2f04b5e:1 Error: widget model not found
    at f.get_model (150.467514c324d2bcc2…24d2bcc23502:1:3461)
    at w.renderModel (134.083e6b37f2f7b2f0…2f7b2f04b5e:1:72019)
default.js:1302 Connection lost, reconnecting in 0 seconds.
150.467514c324d2bcc2…514c324d2bcc23502:1 Failed to fetch ipywidgets through the "jupyter.widget.control" comm channel, fallback to fetching individual model state. Reason: Control comm was closed too early
7
134.083e6b37f2f7b2f0…e6b37f2f7b2f04b5e:1 Error: widget model not found
    at f.get_model (150.467514c324d2bcc2…24d2bcc23502:1:3461)
    at w.renderModel (134.083e6b37f2f7b2f0…2f7b2f04b5e:1:72019)
default.js:1302 Connection lost, reconnecting in 0 seconds.
150.467514c324d2bcc2…514c324d2bcc23502:1 Failed to fetch ipywidgets through the "jupyter.widget.control" comm channel, fallback to fetching individual model state. Reason: Control comm was closed too early
5
134.083e6b37f2f7b2f0…e6b37f2f7b2f04b5e:1 Error: widget model not found
    at f.get_model (150.467514c324d2bcc2…24d2bcc23502:1:3461)
    at w.renderModel (134.083e6b37f2f7b2f0…2f7b2f04b5e:1:72019)

150.467514c324d2bcc23502.js?v=467514c324d2bcc23502:1 Error: Module @jupyter-widgets/controls, version ^1.5.0 is not registered, however,         2.0.0 is
    at f.loadClass (134.083e6b37f2f7b2f04b5e.js?v=083e6b37f2f7b2f04b5e:1:74976)
    at f.loadModelClass (150.467514c324d2bcc23502.js?v=467514c324d2bcc23502:1:10721)
    at f._make_model (150.467514c324d2bcc23502.js?v=467514c324d2bcc23502:1:7517)
    at f.new_model (150.467514c324d2bcc23502.js?v=467514c324d2bcc23502:1:5137)
    at f.handle_comm_open (150.467514c324d2bcc23502.js?v=467514c324d2bcc23502:1:3894)
    at _handleCommOpen (134.083e6b37f2f7b2f04b5e.js?v=083e6b37f2f7b2f04b5e:1:73392)
    at b._handleCommOpen (default.js:1095:19)
    at async b._handleMessage (default.js:1262:43)

@jasongrout
Copy link
Member

The last error is the relevant one:

150.467514c324d2bcc23502.js?v=467514c324d2bcc23502:1 Error: Module @jupyter-widgets/controls, version ^1.5.0 is not registered, however,         2.0.0 is

Can you try in a new environment, just to make sure the downgrades actually fully applied? Someone else reported this error and reported that creating a fresh environment with ipywidgets 7.7.2 and jupyterlab_widgets 1.x fixed it.

@soobidou
Copy link

I did.. I do not directly install jupyterlab-widgets, it seems to be coming from the whole lab ecosystem... somewhere.. I guess I'll have to hunt down what module installs it and bug the owner to test or at least pin his stuff and not just take the LATEST which can (like yours) introduce a major breaking change overnight and screw all of our infra (I suspect the NPM jupyterlab-manager, but well, I have to reinstall line by line our CI and catch the culprit module.

@jasongrout
Copy link
Member

The error appears to be an incorrect dependency version in ipywidgets 7.x, which is accidentally pulling in the latest incompatible jupyterlab_widgets. I've dropped everything and spent much of today as an emergency fixing ipywidgets 7.7 and backporting the fix to 7.6 (almost released).

For your issue, my guess is that the downgrade to jupyterlab_widgets version 1 didn't actually replace the javascript jupyterlab is using for some reason. You can probably verify that by doing jupyter labextension list and seeing what version it says.

@jasongrout
Copy link
Member

(Sorry @hainm for taking over this issue with this other conversation unrelated to your issue. Is your question answered satisfactorily?)

@soobidou
Copy link

soobidou commented Aug 19, 2022

That's jupyterlab-manager the one installing jupyterlab_widgets throuh NPM

        @jupyter-widgets/jupyterlab-manager v3.1.1 enabled OK (python, jupyterlab_widgets)

Now despite manually updating the module, I still have the JS errors in Sparkmagic, I don't have a solution yet.

BTW SparkMagic simply set their requirements to ipywidgets>5.0.0 and the 8.x.x clearly introduced API breaking change (unlike the other majors), so they will need to at least set a 7.7.1 limit, until they manage to test your new changes.

I suspect this is also the case with my other jupyterlab-manager (which sits on jupyterlab-widgets).

@hainm
Copy link
Author

hainm commented Aug 19, 2022

(Sorry @hainm for taking over this issue with this other conversation unrelated to your issue. Is your question answered satisfactorily?)

yeah. It's clear to me how to fix now. Thanks @vidartf and @jasongrout.

@jasongrout
Copy link
Member

@jupyter-widgets/jupyterlab-manager v3.1.1 enabled OK (python, jupyterlab_widgets)

@soobidou - actually, that looks right - that is the version that is compatible with ipywidgets 7.

Let's move this conversation over to jupyter-incubator/sparkmagic#769, which I see you've already opened about this issue, rather than continuing to take over this issue discussion.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants