-
-
Notifications
You must be signed in to change notification settings - Fork 48
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
Is it possible to use ipympl - %matplotlib widget in jupyter-ui? #85
Comments
You probably miss the
But even with that, on my env, I hit I am working on the ipywidgets stuff and hopefully will come soon with a fix for this and someting more robust in general for ipwidgets. |
Yes, in fact, I am trying now with require.js loaded and getting the same error you mentioned. The links you provided mostly address resolving the issue within the Jupyter server UI. Curiously, when I run a notebook from the server UI, I am able to use %matplotlib widget without any problems. However, when integrating it with my Next.js application, it doesn't seem to work. Is there a solution or workaround available to resolve this issue? |
Are you saying you can use |
Yes, exactly, it works with the predefined UI that comes with JupyterLab but not working with my next.js app using jupyter-ui. |
I have just pushed work around ipywidget with support for jupyter-matplotlib. I will now make it configurable so anyone can define the widgets he wants, but in the meantime, jupyter-matplotlib is supported out-of-the box in main branch. If it does not show up at the first time, hit run again, looking forward your feedbacks on how it work on your env. |
The latest push introduces a externalIPyWidgets={["jupyter-matplotlib:0.11.3"]}
externalIPyWidgets={["bqplot:0.5.42"]}
externalIPyWidgets={["@widgetti/jupyter-react:0.3.0"]} cdn.jsdelivr.net may be slow to load the first time, so if it fails at first load, reload your browser and it should work fine. |
Now you have in latest main |
Closing this as resolved, please open separated issue for any specific question. |
Thank you for your response, @echarles. I have a quick question: Will this update be included in the next release to npm? I'm currently using the npm version, not a local one. Thank you in advance! |
@BrandonEscamilla just published @datalayer/jupyter-react 0.6.2. this morning I have pushed a feature to ensure that the JupyterLab CSS were not loaded when the components are used in JupyterLab it self 👍 This has driven a small regression for the ipympl widget which was showing correctly before, but now show with the toolbar being move to the bottom. The other ipywidgets (bqplot...) does seem to be impacted. Also I notice regularly that the widget is not lodaded when you use it quickly after the first time - Maybe time is needed to load the remote javascript, still need to makes sens of what is going on, your feedbacks would be useful there. |
Hi @echarles, I just tried the new version and it seems it's not working on my project, I already tried including externalIPyWidgets={["jupyter-matplotlib:0.11.3"]} in the Notebook component, and reloading the browser, but not working, is there anything I am probably missing? Thanks! |
@BrandonEscamilla Sorry, forgot to mention that I changed to more typed props (separate the name and version as For externals jupyter-ui/packages/react/src/examples/Bqplot.tsx Lines 14 to 16 in 527a49c
for bundled jupyter-ui/packages/react/src/examples/Matplotlib.tsx Lines 17 to 19 in 527a49c
|
Hey @echarles, I'm currently testing this and unfortunately, I haven't been able to make it work. I'm still encountering the same error. Do you have any suggestions? Here's how I included the widget: This is the error: Apart from this, I am wondering what's the difference between externalIPyWidget and Bundled? Thanks in advance! |
Rested on my env and it works for me. Now trying to create a codesandbox, but a bit slow atm. Can you double check the version of jupyter-react you use?
If you add |
Ok, it seems is working with the bundle. I did |
A few issues here:
|
Reopening and will work on that soon. |
@BrandonEscamilla I have release 0.6.3 which brings a more rock-solid ipywidgets support (It now runs fine from the first start). I still have to fix the specific toolbar issue for ipympl but otherwirse, the other widgets I have tests (bqplot, ipyreact, plotly, bokeh) work great. If you have cycles to look at the toolbar which I think could be a CSS to inject, that would be great. Otherwse, tell me. |
Sorry, was meaning 0.6.4 |
Just released 0.6.5 I have updated the Matplotlib example to load the css from directly and disable the loading by the jupyter content. This fixes the CSS issue. For the path change, with the last release, the component does not throw an error, but after the change, the ipywidgets are not working anymore. I will wait a bit more on @BrandonEscamilla feedback before tackling that remaining issue. jupyter-ui/packages/react/src/examples/Matplotlib.tsx Lines 10 to 49 in ebaaa7b
|
Hey @echarles, I've been experimenting with version 0.6.4 of the library. It appears that loading the CSS and using |
JupyterLab is notably poor with it CSS management (no css-in-js, no css modules, just plain good-old css). I opened PR to fix some of the glitches which got merged, but still experience side effect mainly depending on the order of loading. So for now, the core jupyter-react library does its best to load as it should, but if we want the components to be usable in jupyerlab with non-double css loading, the developer would need to do something like in the Matplotlib example in some case. Is that a stopper for you? I can think a bit more based on your inputs.
Yeah, I can fix that next week. |
Hey @echarles, got it, I think in my case is not a problem to include css in the component directly. I would probably import it through globals.css or something like this, just to avoid having all of the imports there. But I think going into that direction is not a big problem. By the way, now that we are talking about css, are there plans to support dark mode? Or if I wanted to modify the css to support it, where should I look? Thanks in advance! |
You may have the toolbar issue if you load all the css files from an external globals.css file, to be tested on your env.
Sounds good.
With #67 I am preparing a more flexiable way to create the notebook with any jupyterlab extension support, including any themes, so dark theme also. We plan also to wrap something for the theme in that folder https://github.com/datalayer/jupyter-ui/tree/933d7acf57fb125a154cbb1be69bdce00cecdec9/packages/theme but it will be for after.
For now, as you will load the css your self, you can try change jupyter-ui/packages/react/src/examples/Matplotlib.tsx Lines 26 to 27 in 933d7ac
|
I will try this, let you know what happens.
Yeah, I tried already and I think it's not working still showing the light version, I will check if I can do a workaround. Thanks! |
Should we close this? If there are any other issue like theming... please open new dedicated issues. Thx! |
@BrandonEscamilla In the meantime #94 is resolved. Could we close this? |
I am attempting to achieve dynamic plotting using Jupyter-UI. I have followed the steps to install ipympl on my server, and it works fine with the UI version of Jupyter. However, when using Jupyter-UI, I encountered the following error. In the image below you can also find the way I am trying to plot by including %matplotlib widget.
Error:
The text was updated successfully, but these errors were encountered: