Closed wholtz closed 2 years ago
Thanks for the detailed report :)
Indeed, when the versions don't match it will fail to render (even if, in some cases, it could technically work). This check is being done by the ipywidgets's JupyterLab Widget Manager.
Currently we have a:
Technically, we should also have a "model version", a version of some kind of protocol that the back-end/front-end speaks. I think this would be the cleanest way of doing it (and it is possible to do that with ipywidgets), but I don't know any widget which does that. This would allow e.g. ipympl 0.8.5 and jupyter-matplotlib 0.9.1 to be compatible if their model versions matches.
I am personally totally open to start doing this. Although I am not sure what the transition would look like, and it would not affect old ipympl versions.
We would bump such "model version" only if there is a breaking change in the widget model (e.g. if we rename a widget property in the model). It's a bit more maintenance pain but it might be worth it.
It might actually reduce the number of issues "it fails to render in JupyterLab with model not found" that we see popping on all widgets libs.
It might actually reduce the number of issues "it fails to render in JupyterLab with model not found" that we see popping on all widgets libs.
Agreed I think it would.
We would bump such "model version" only if there is a breaking change in the widget model (e.g. if we rename a widget property in the model). It's a bit more maintenance pain but it might be worth it.
but I don't know any widget which does that.
I agree that this is good. But I think the only example is actually ipywidgets itself: https://github.com/jupyter-widgets/ipywidgets/blob/f7c48afb27bd80b14966b862ad03e30c40c7481f/python/ipywidgets/ipywidgets/_version.py#L9-L12
We actually already have some of the infrastructure for this. I think that so long as:
matches these: https://github.com/matplotlib/ipympl/blob/6a7c2ba76479a6ad9f63f548eacfe0606000db3c/src/mpl_widget.ts#L33-L34
then things should work.
So we need to decouple that number from the package versioning. This is what ipywidgets does: https://github.com/jupyter-widgets/ipywidgets/blob/88cec8be2869e75760a6a99bba129e6011d9043f/python/ipywidgets/ipywidgets/_version.py
So I propose that we take the current protocol version and call it 1.0.0
as this isn't really a public facing thing and I think this will make the future version comparisons easier to understand.
oh actually, changing it is worse. We should leave it exactly the same until we actually change the protocol. So we should decouple js_semver
from the package.json version, and also change the _model_module_version
to not follow the package.json number
I'll try this as a follow up to https://github.com/matplotlib/ipympl/pull/446 and then on release we can see if the situation improved. Then we can leave extensive comments to that effect and/or add this as docs to contributing guide (and to ipywidgets) so we know what to do in the future.
We should leave it exactly the same until we actually change the protocol. So we should decouple js_semver from the package.json version, and also change the _model_module_version to not follow the package.json number
Yes! Also making this version 1.0.0
makes sense to me 👍🏽
Happy to give it a review!
I think this will have been fixed going forward by #448 but let's definitely reopen if we discover that it was not
heads up @wholtz that there were some issues with pbulishing the npm version so the new version 0.9.0
does not have a corresponding version on npm yet see https://github.com/matplotlib/ipympl/issues/458
I have this same issue at the moment. I don't know what version of ipympl is installed on the server side. Is anyone else still facing the issue?
This issue was originally discussed in #34 but I now see this is a distinct issue.
If a jupyterlab user wants to make use of a custom kernel and use ipympl in their notebooks, then ipympl must be installed in both the jupyterlab environment and their kernel environment. If different versions of ipympl are installed in the jupyterlab environment and kernel environments, then sometimes ipympl breaks even for differences in the patch version. If jupyterlab is running within a multi-user environment (jupyterhub) and the user does not control the server, then the user may not know what version of ipympl is installed in the jupyterlab environment. This can make it difficult for users to determine the version of ipympl they need to install in their kernels. Additionally, the kernel environments are likely to break when upgrades occur to ipympl in the jupyterlab environment.
Test setup
The test were run using 6 builds of the following Dockerfile, where LAB_IPYMPL_VERSION modified for each build.
For each build-kernel pair, I ran the following in a notebook:
After selecting the kernel for the next test, I performed a 'Empty Cache and Hard Reload' with the the Chrome web browser.
Versions
Here is the version info for the test when ipympl v0.8.0 was installed in the jupyterlab environment:
For the other tests, all these values except for the ipympl version and the jupyter-matplotlib remained constant. jupyter-matplotlib was never directly installed, it always came from the installation of ipympl.
Results
I ran a series of tests to determine which combinations of the ipympl v0.8.x packages are functional when installed in both the jupyterlab environment and the kernel environment. Three different outputs occurred:
The results are summarized in this table:
Conclusions
ipympl is fragile when installed in kernels in a different environment from the jupyterlab environment. It would be great if in these types of setups, ipympl was compatible with itself across patch versions (ie, within the v0.8.x series).
Thanks!
Sorry this was so long. This module is an important and appreciated part of my workflows. Thanks you!