jupyter-bbox-widget icon indicating copy to clipboard operation
jupyter-bbox-widget copied to clipboard

Failed to load model class 'BBoxModel' from module 'jupyter-bbox-widget'

Open eppane opened this issue 1 year ago • 5 comments

Hello,

When executing the introduction notebook, I can run the IntProgress widget, but with BBoxWidget I am getting the following javascript error:

Failed to load model class 'BBoxModel' from module 'jupyter-bbox-widget'
Error: No version of module jupyter-bbox-widget is registered
    at f.loadClass (http://localhost:8888/lab/extensions/@jupyter-widgets/jupyterlab-manager/static/134.40eaa5b8e976096d50b2.js?v=40eaa5b8e976096d50b2:1:74856)
    at f.loadModelClass (http://localhost:8888/lab/extensions/@jupyter-widgets/jupyterlab-manager/static/150.b0e841b75317744a7595.js?v=b0e841b75317744a7595:1:10729)
    at f._make_model (http://localhost:8888/lab/extensions/@jupyter-widgets/jupyterlab-manager/static/150.b0e841b75317744a7595.js?v=b0e841b75317744a7595:1:7517)
    at f.new_model (http://localhost:8888/lab/extensions/@jupyter-widgets/jupyterlab-manager/static/150.b0e841b75317744a7595.js?v=b0e841b75317744a7595:1:5137)
    at f.handle_comm_open (http://localhost:8888/lab/extensions/@jupyter-widgets/jupyterlab-manager/static/150.b0e841b75317744a7595.js?v=b0e841b75317744a7595:1:3894)
    at _handleCommOpen (http://localhost:8888/lab/extensions/@jupyter-widgets/jupyterlab-manager/static/134.40eaa5b8e976096d50b2.js?v=40eaa5b8e976096d50b2:1:73393)
    at b._handleCommOpen (http://localhost:8888/static/lab/jlab_core.f83e0826f7dae6f5de09.js?v=f83e0826f7dae6f5de09:2:996710)
    at async b._handleMessage (http://localhost:8888/static/lab/jlab_core.f83e0826f7dae6f5de09.js?v=f83e0826f7dae6f5de09:2:998700)

labextension list looks as follows:

JupyterLab v3.4.8
C:\Users\xxx\miniconda3\share\jupyter\labextensions
        jupyter-matplotlib v0.11.3 enabled ok
        jupyterlab-unfold v0.2.2 enabled ok (python, jupyterlab-unfold)
        @jupyter-widgets/jupyterlab-manager v5.0.5 enabled ok (python, jupyterlab_widgets)

Other labextensions (built into JupyterLab)
   app dir: C:\Users\xxx\miniconda3\share\jupyter\lab
        jupyter-bbox-widget v0.5.0 enabled ok

Has anyone else encountered this issue, any tips or educated guesses to solve this? Similar issues can be found online, especially when using JupyterLab. But none of the suggested solutions (so far) has been working for me. Thanks!

eppane avatar Mar 21 '23 16:03 eppane

I have the same issue using Jupyter Lab version 3.6.3. I think it has to do with the difference in how Widgets are loaded for Notebook and Lab environments and there might be an error in the src/plugin.ts file. The following TypeScript Cookiecutter shows some minor change with using lumino instead of phosphor. I am only familiar with Python, so this out of my wheelhouse. But I would like to request @gereleth to take a look at updating their cookiecutter template, so it works for the newest jupyterlab/ipywidgets update!

Edit: made a PR with the fixes.

jurriandoornbos avatar May 31 '23 13:05 jurriandoornbos

Hi folks, I'm sorry for being slow to address this. I'm no expert in the intricacies of widget cookiecutters and I don't really know what will break and what will be fixed with the proposed change.

My plan is to switch over to anywidget instead as it promises a much simplified way of creating custom widgets. I did an initial experimental port to anywidget some time ago and the developer experience was 100x better than with cookiecutters. See this short video showing hot reloading of widget code - I edit stuff and the changes are displayed in the notebook immediately.

I still need some time to bring my experiment into publishable shape. But hopefully things will work and I can forget about cookiecutter headache. I'll post an update here once I have something ready for testing.

gereleth avatar Jun 03 '23 20:06 gereleth

Hey, I just wanted to put out there that I have had this issue as well. If there's a way to manually install instead of using pip, maybe I can try the suggestions suggested by @jurriandoornbos?

Dcosthephalump avatar Jul 03 '23 22:07 Dcosthephalump

Yes, you can clone the pull request instead of the main branch. And then build the pull equest with *pip install - e . *

Good luck!

On Tue, Jul 4, 2023, 00:49 David Costello @.***> wrote:

Hey, I just wanted to put out there that I have had this issue as well. If there's a way to manually install instead of using pip, maybe I can try the suggestions suggested by @jurriandoornbos https://github.com/jurriandoornbos?

— Reply to this email directly, view it on GitHub https://github.com/gereleth/jupyter-bbox-widget/issues/15#issuecomment-1619230177, or unsubscribe https://github.com/notifications/unsubscribe-auth/AOGMWZEAAMTFRXZW47UITB3XOND6XANCNFSM6AAAAAAWCW2VQY . You are receiving this because you were mentioned.Message ID: @.***>

jurriandoornbos avatar Jul 04 '23 06:07 jurriandoornbos

same issue here. Any solutions, please?

dumi5952 avatar Mar 21 '24 19:03 dumi5952

running into this issue as well

@jurriandoornbos is there a version of Python that's required to build it? I am trying to install it from the merged version of the pull request via: pip install git+https://github.com/gereleth/jupyter-bbox-widget@refs/pull/19/merge

BDGLundeSony avatar Aug 16 '24 16:08 BDGLundeSony

Hi there! I finally got around to that anywidget rewrite that should hopefully fix these issues. There's currently an anywidget branch in the repo with the new code. You can install it with this command:

pip install git+https://github.com/gereleth/jupyter-bbox-widget.git@anywidget

A Jupyter server restart is necessary after the module is installed (that's server restart, not kernel). And if the kernel uses a different python environment then you'll need to install the widget there as well.

I also refactored the way images are sent to frontend so there shouldn't be any need to muck with base64-encoding images any more.

@BDGLundeSony and anyone else interested - I'd really appreciate it if you checked and told me if this new version works for you.

gereleth avatar Aug 22 '24 17:08 gereleth

But I liked the option to muck with base64-encoded images 😦

BDGLundeSony avatar Aug 22 '24 17:08 BDGLundeSony

Oh you still can! But voluntarily instead of by necessity =).

gereleth avatar Aug 22 '24 18:08 gereleth

Ah, yes I see that after playing with it now! It works a treat! I was thinking of spending some free time trying to re-create something similar to learn more about Jupyter server and Jupyter widgets, but I am glad this just works now. Thank you so much!

BDGLundeSony avatar Aug 22 '24 18:08 BDGLundeSony

Thanks for confirming! Glad it works).

Definitely check out anywidget if you're interested in creating custom widgets. It's basically all fun and none of the cryptic boilerplate.

gereleth avatar Aug 22 '24 18:08 gereleth

The changes are merged and published as version 0.6.0.

gereleth avatar Aug 25 '24 13:08 gereleth