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

widget in vscode fails to render: JS error #331

Open
2 tasks done
mathematicalmichael opened this issue Nov 11, 2024 · 8 comments
Open
2 tasks done

widget in vscode fails to render: JS error #331

mathematicalmichael opened this issue Nov 11, 2024 · 8 comments
Labels
bug Something isn't working

Comments

@mathematicalmichael
Copy link

mathematicalmichael commented Nov 11, 2024

Checks

  • I have checked that this issue has not already been reported.

  • I have confirmed this bug exists on the latest version of Buckaroo.

What type of jupyter notebook were you using (VSCode notebook, google colab, Jupyter Lab, Jupyter notebook). Select multiple if you can reproduce this in multiple environments. If other, please add to description.

VS Code, Jupyter Lab

Reproducible example

show any dataframe:

import numpy as np
import pandas as pd
import buckaroo

num_df = pd.DataFrame(
    {'a':[111_111,  77_777, 777_777, 1_000_000, 2_111_111, 1_235_999],
     'b':[111_111, 555_555,       0,    28_123,   482_388,     5_666]})
num_df

I did this in a fresh https://lightning.ai studio with Python 3.11.10. After selecting that version and pip installing numpy, pandas, and buckaroo, you should be able to reproduce this as well.
image

Issue description

cells don't render - neither in lab nor vscode.
I believe this is because of the sources for widgets.
Could you please clarify where the JS packages should come from?

image

environment: lightning.ai (remote EC2 instance)

image

settings.json:
image

Expected behavior

missing js packages are downloaded automatically or a helpful message telling me what to do is shown.

Installed versions

image

``` Selected Jupyter core packages... executing in unknown buckaroo : 0.7.11 jupyterlab : not installed notebook : not installed ipywidgets : 8.1.5 traitlets : 5.14.3 jupyter_core : 5.7.2 pandas : 2.2.3 numpy : 2.1.3 IPython : 8.29.0 ipykernel : 6.29.5 jupyter_client : 8.6.3 jupyter_server : not installed nbclient : not installed nbconvert : not installed nbformat : not installed qtconsole : not installed buckaroo : [/home/zeus/miniconda3/envs/cloudspace/lib/python3.11/site-packages/buckaroo/__init__.py](https://vscode-remote+vscode-002d01j9d6myvzcvjh2eyeaf6vb4j2-002estudio-002elightning-002eai.vscode-resource.vscode-cdn.net/home/zeus/miniconda3/envs/cloudspace/lib/python3.11/site-packages/buckaroo/__init__.py) jupyterlab : not installed notebook : not installed ipywidgets : [/home/zeus/miniconda3/envs/cloudspace/lib/python3.11/site-packages/ipywidgets/__init__.py](https://vscode-remote+vscode-002d01j9d6myvzcvjh2eyeaf6vb4j2-002estudio-002elightning-002eai.vscode-resource.vscode-cdn.net/home/zeus/miniconda3/envs/cloudspace/lib/python3.11/site-packages/ipywidgets/__init__.py) traitlets : [/home/zeus/miniconda3/envs/cloudspace/lib/python3.11/site-packages/traitlets/__init__.py](https://vscode-remote+vscode-002d01j9d6myvzcvjh2eyeaf6vb4j2-002estudio-002elightning-002eai.vscode-resource.vscode-cdn.net/home/zeus/miniconda3/envs/cloudspace/lib/python3.11/site-packages/traitlets/__init__.py) jupyter_core : [/home/zeus/miniconda3/envs/cloudspace/lib/python3.11/site-packages/jupyter_core/__init__.py](https://vscode-remote+vscode-002d01j9d6myvzcvjh2eyeaf6vb4j2-002estudio-002elightning-002eai.vscode-resource.vscode-cdn.net/home/zeus/miniconda3/envs/cloudspace/lib/python3.11/site-packages/jupyter_core/__init__.py) pandas : [/home/zeus/miniconda3/envs/cloudspace/lib/python3.11/site-packages/pandas/__init__.py](https://vscode-remote+vscode-002d01j9d6myvzcvjh2eyeaf6vb4j2-002estudio-002elightning-002eai.vscode-resource.vscode-cdn.net/home/zeus/miniconda3/envs/cloudspace/lib/python3.11/site-packages/pandas/__init__.py) numpy : [/home/zeus/miniconda3/envs/cloudspace/lib/python3.11/site-packages/numpy/__init__.py](https://vscode-remote+vscode-002d01j9d6myvzcvjh2eyeaf6vb4j2-002estudio-002elightning-002eai.vscode-resource.vscode-cdn.net/home/zeus/miniconda3/envs/cloudspace/lib/python3.11/site-packages/numpy/__init__.py) IPython : [/home/zeus/miniconda3/envs/cloudspace/lib/python3.11/site-packages/IPython/__init__.py](https://vscode-remote+vscode-002d01j9d6myvzcvjh2eyeaf6vb4j2-002estudio-002elightning-002eai.vscode-resource.vscode-cdn.net/home/zeus/miniconda3/envs/cloudspace/lib/python3.11/site-packages/IPython/__init__.py) ipykernel : [/home/zeus/miniconda3/envs/cloudspace/lib/python3.11/site-packages/ipykernel/__init__.py](https://vscode-remote+vscode-002d01j9d6myvzcvjh2eyeaf6vb4j2-002estudio-002elightning-002eai.vscode-resource.vscode-cdn.net/home/zeus/miniconda3/envs/cloudspace/lib/python3.11/site-packages/ipykernel/__init__.py) jupyter_client : [/home/zeus/miniconda3/envs/cloudspace/lib/python3.11/site-packages/jupyter_client/__init__.py](https://vscode-remote+vscode-002d01j9d6myvzcvjh2eyeaf6vb4j2-002estudio-002elightning-002eai.vscode-resource.vscode-cdn.net/home/zeus/miniconda3/envs/cloudspace/lib/python3.11/site-packages/jupyter_client/__init__.py) jupyter_server : not installed nbclient : not installed nbconvert : not installed nbformat : not installed qtconsole : not installed```

Jupyter Log output

No response

@mathematicalmichael mathematicalmichael added the bug Something isn't working label Nov 11, 2024
@paddymul
Copy link
Owner

Thank you for the bug report. I'm digging in.

Incidentally I recently asked a Microsoft rep for help with setting up CI against buckaroo and VSCode.

@paddymul
Copy link
Owner

Heads up. I will try to get a fix together this week. I hope that works with your timeline

@paddymul
Copy link
Owner

AnyWidget solves this problem.

I'm making progress on this. I have a version based on anywidget that works, I'd like to use ipyreact, and I have one stumbling block there.

Anywidget injects your entire js module into the dom for each invocation of the widget. IPYReact (built on top of anywidget) has a fix for this.

How are you at JS Build chains (vite, webpack, css)? Want to pair on a couple bits of this problem.

@mathematicalmichael
Copy link
Author

unfortunately I am pretty clumsy with JS tooling in general. I know enough to get by with an LLM but have not invested time to learn properly. I have built my fair share of docker images to get web projects working but can't say I'm confident in those particular skills.

@mathematicalmichael
Copy link
Author

there's no rush on my end. i just thought your tool looked particularly cool and thought I'd assess whether to add it to my toolbox yet. ill keep an eye on my github notifs. thanks for being so responsive!

@paddymul
Copy link
Owner

@mathematicalmichael would you mind trying the latest version of buckaroo.

Can you give this a try and see if it fixes your problem

pip install --force-reinstall buckaroo==0.8.0
#restart vs code , I'm not exactly sure how.  But VS Code needs to try the latest version of buckaroo

This fix (based on moving the js build system to anywidget in #339) took a lot longer than expected.
(anywidget)[https://anywidget.dev/] supports a lot more notebook like environments.

@mathematicalmichael
Copy link
Author

hi! thank you!

better, but still no dice:
image
(this was in a fresh environment - python 3.10.10)

you can use lightning.ai's compute for free to test it out. Alternatively, github codespaces. This type of "fresh environment" is a perfect testing sandbox.

@mathematicalmichael
Copy link
Author

mathematicalmichael commented Dec 27, 2024

jupyterlab (in same environment) may show a more helpful error:
image

[Open Browser Console for more detailed log - Double click to close this message]
Failed to load model class 'AnyModel' from module 'anywidget'
Error: No version of module anywidget is registered
    at f.loadClass (https://jupyterlab-01jg4pea3bz9maeze90s9yjsbe.studio.lightning.ai/lab/extensions/@jupyter-widgets/jupyterlab-manager/static/446.bf169bd3821a9ba1aa62.js?v=bf169bd3821a9ba1aa62:1:75363)
    at f.loadModelClass (https://jupyterlab-01jg4pea3bz9maeze90s9yjsbe.studio.lightning.ai/lab/extensions/@jupyter-widgets/jupyterlab-manager/static/327.8166aeb81cf1531ca240.js?v=8166aeb81cf1531ca240:1:10579)
    at f._make_model (https://jupyterlab-01jg4pea3bz9maeze90s9yjsbe.studio.lightning.ai/lab/extensions/@jupyter-widgets/jupyterlab-manager/static/327.8166aeb81cf1531ca240.js?v=8166aeb81cf1531ca240:1:7367)
    at f.new_model (https://jupyterlab-01jg4pea3bz9maeze90s9yjsbe.studio.lightning.ai/lab/extensions/@jupyter-widgets/jupyterlab-manager/static/327.8166aeb81cf1531ca240.js?v=8166aeb81cf1531ca240:1:5136)
    at f.handle_comm_open (https://jupyterlab-01jg4pea3bz9maeze90s9yjsbe.studio.lightning.ai/lab/extensions/@jupyter-widgets/jupyterlab-manager/static/327.8166aeb81cf1531ca240.js?v=8166aeb81cf1531ca240:1:3893)
    at _handleCommOpen (https://jupyterlab-01jg4pea3bz9maeze90s9yjsbe.studio.lightning.ai/lab/extensions/@jupyter-widgets/jupyterlab-manager/static/446.bf169bd3821a9ba1aa62.js?v=bf169bd3821a9ba1aa62:1:73900)
    at b._handleCommOpen (https://jupyterlab-01jg4pea3bz9maeze90s9yjsbe.studio.lightning.ai/static/lab/jlab_core.b207cc5f30e679038452.js?v=b207cc5f30e679038452:1:1369272)
    at async b._handleMessage (https://jupyterlab-01jg4pea3bz9maeze90s9yjsbe.studio.lightning.ai/static/lab/jlab_core.b207cc5f30e679038452.js?v=b207cc5f30e679038452:1:1371262)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants