jupyter-widgets / pythreejs

A Jupyter - Three.js bridge
https://pythreejs.readthedocs.io
Other
934 stars 185 forks source link

Can not use in JupyterLite #402

Open sunzhuo opened 1 year ago

sunzhuo commented 1 year ago

I runned folowing cells in JupyterLite:

%pip install pythreejs
from pythreejs import *
from IPython.display import display
from math import pi
# Reduce repo churn for examples with embedded state:
from pythreejs._example_helper import use_example_model_ids
use_example_model_ids()
BoxGeometry(
    width=5,
    height=10,
    depth=15,
    widthSegments=5,
    heightSegments=10,
    depthSegments=15)

And get these error messages:

[Open Browser Console for more detailed log - Double click to close this message]
Failed to load model class 'PreviewModel' from module 'jupyter-threejs'
Error: No version of module jupyter-threejs is registered
    at f.loadClass (https://jupyterlite.github.io/demo/extensions/@jupyter-widgets/jupyterlab-manager/static/134.402424ef4079078b2e0e.js?v=402424ef4079078b2e0e:1:74855)
    at f.loadModelClass (https://jupyterlite.github.io/demo/extensions/@jupyter-widgets/jupyterlab-manager/static/150.1a6d6a3a0542a41bec5a.js?v=1a6d6a3a0542a41bec5a:1:10729)
    at f._make_model (https://jupyterlite.github.io/demo/extensions/@jupyter-widgets/jupyterlab-manager/static/150.1a6d6a3a0542a41bec5a.js?v=1a6d6a3a0542a41bec5a:1:7517)
    at f.new_model (https://jupyterlite.github.io/demo/extensions/@jupyter-widgets/jupyterlab-manager/static/150.1a6d6a3a0542a41bec5a.js?v=1a6d6a3a0542a41bec5a:1:5137)
    at f.handle_comm_open (https://jupyterlite.github.io/demo/extensions/@jupyter-widgets/jupyterlab-manager/static/150.1a6d6a3a0542a41bec5a.js?v=1a6d6a3a0542a41bec5a:1:3894)
    at _handleCommOpen (https://jupyterlite.github.io/demo/extensions/@jupyter-widgets/jupyterlab-manager/static/134.402424ef4079078b2e0e.js?v=402424ef4079078b2e0e:1:73392)
    at v._handleCommOpen (https://jupyterlite.github.io/demo/build/6591.94ed352.js:1:28742)
    at async v._handleMessage (https://jupyterlite.github.io/demo/build/6591.94ed352.js:1:30636)
merlinND commented 1 year ago

Hello @sunzhuo, This sounds like the same issue as #389.

Homomorpheus commented 1 month ago

In Jupyterlite, this problem can stem from too few packages being present in the python environment at build time. Try changing your requirements.txt to the requirements.txt of this project: https://github.com/triadtitans/rigid_body_interactive