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

Conflicting nodejs dependencies when installing jupyter-widgets in jupyterlab 0.30.1 #1855

Closed
costrouc opened this issue Dec 5, 2017 · 16 comments
Labels
resolved-locked Closed issues are locked after 30 days inactivity. Please open a new issue for related discussion.
Milestone

Comments

@costrouc
Copy link

costrouc commented Dec 5, 2017

When trying to add jupyter-widgets in jupyterlab 0.30.1 it fails with the following message. Using jupyterlab 0.29.2 works fine.

virtualenv was used.

$ jupyter labextension install @jupyter-widgets/jupyterlab-manager
> /home/costrouc/.local/bin/npm pack @jupyter-widgets/jupyterlab-manager
jupyter-widgets-jupyterlab-manager-0.30.1.tgz

"@jupyter-widgets/jupyterlab-manager@0.30.1" is not compatible with the current JupyterLab
Conflicting Dependencies:
JupyterLab              Extension            Package
>=0.13.1-0 <0.14.0-0    >=0.12.0-0 <0.13.0-0 @jupyterlab/application
>=0.13.0-0 <0.14.0-0    >=0.12.0-0 <0.13.0-0 @jupyterlab/coreutils
>=0.13.0-0 <0.14.0-0    >=0.12.0-0 <0.13.0-0 @jupyterlab/notebook
>=0.13.0-0 <0.14.0-0    >=0.12.0-0 <0.13.0-0 @jupyterlab/rendermime
>=0.52.0-0 <0.53.0-0    >=0.51.0-0 <0.52.0-0 @jupyterlab/services
@jasongrout
Copy link
Member

Thanks. The message "@jupyter-widgets/jupyterlab-manager@0.30.1" is not compatible with the current JupyterLab means we haven't updated yet for 0.30.1 (it was just released today). We're working on it, though.

@jasongrout jasongrout added this to the 7.x milestone Dec 5, 2017
@jasongrout
Copy link
Member

I just released @jupyter-widgets/jupyterlab-manager 0.31 that has support for jlab 0.30.

@jasongrout
Copy link
Member

Looks like there might be a problem - I'm only getting a page that is 184 pixels high when installing the widgets jlab extension. Investigating...

@jasongrout jasongrout reopened this Dec 5, 2017
@blink1073
Copy link
Contributor

My guess would be this: #1841

@jasongrout
Copy link
Member

jasongrout commented Dec 6, 2017

Thanks! Yep, that's the issue. I've got two or three fixes I'm experimenting with.

@sccolbert
Copy link

sccolbert commented Dec 6, 2017

You shouldn't override the Phosphor core CSS. The core is the minimal required for Phosphor to behave correctly.

@blink1073
Copy link
Contributor

/thread

@blink1073
Copy link
Contributor

(sorry that was too good a setup). https://www.urbandictionary.com/define.php?term=%2Fthread

@jasongrout
Copy link
Member

Widgets contained a verbatim copy of the phosphor css. One take on the issue here was that JLab was overriding the core phosphor css for its own widget without having greater specificity - basically assuming that phosphor css would be before it on the page for tie-breaking the specificity. If that is a valid assumption, we should probably make it clear to extension developers that they should not import the phosphor css.

Widgets contained a copy of this core phosphor css (for pages that don't have phosphor on them):

.p-Widget {
  box-sizing: border-box;
  position: relative;
  overflow: hidden;
  cursor: default;
}

However, the JupyterLab shell overrides the position attribute: https://github.com/jupyterlab/jupyterlab/blob/83b17558eef35ae0ffaaad76bb4bb07de951137f/packages/application/style/index.css#L23. Since the widget css was loaded after the jlab css, and has the same specificity (.p-widget vs .jp-ApplicationShell), the application shell position was set back to absolute.

@sccolbert
Copy link

It's fine to override specific core things on a per-widget basis, like the app shell is doing. It's not okay to change the defaults for all widgets.

@sccolbert
Copy link

sccolbert commented Dec 6, 2017

You can get more specific by tagging your own widgets: .jp-widgets-widget.p-Widget, which is specific enough to override the core defaults for any Jupyter widget, while leaving alone everything else.

@jasongrout
Copy link
Member

It's not okay to change the defaults for all widgets.

Totally agreed. Let me emphasize that the defaults weren't being changed (in fact, the entire reason it was there in widgets css was to make sure those plain phosphor defaults were on the page for widgets). My point is that the problem was a CSS specificity issue, coming from conflicting assumptions about who was putting phosphor css on the page and where that inclusion was happening.

So what I've done to fix it is to take the import of the phosphor css out of the css used by the jlab plugin, and only put the phosphor css on the page in the classic notebook and arbitrary html page cases.

@jasongrout
Copy link
Member

More investigation: it seems that webpack is pretty intelligent about how it puts css up on the page - it appears that when I import the phosphor css in the jlab plugin, it only goes onto the page in one place and things work (some sort of deduplication going on?). My mistake in this repo was copying (verbatim, so no change) the phosphor css, so it appeared two different places on the page.

Still, I'm now making it the widget manager's responsibility to put the phosphor css on the page - and the jlab widget manager is going to assume the phosphor css is already on the page.

@blink1073
Copy link
Contributor

Webpack only loads a CSS module once if it is the same version.

@jasongrout
Copy link
Member

Webpack only loads a CSS module once if it is the same version.

Thanks for the confirmation.

@jasongrout
Copy link
Member

Okay, this is now fixed with the latest @jupyter-widgets/jupyterlab-manager (0.31.2).

@jasongrout jasongrout modified the milestones: 7.x, 7.1 Dec 18, 2017
@github-actions github-actions bot added the resolved-locked Closed issues are locked after 30 days inactivity. Please open a new issue for related discussion. label Feb 9, 2021
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Feb 9, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
resolved-locked Closed issues are locked after 30 days inactivity. Please open a new issue for related discussion.
Projects
None yet
Development

No branches or pull requests

4 participants