Skip to content

Javascript error when rendering  #400

Closed
@StrongWeiUMN

Description

@StrongWeiUMN

When I run the example code, the Javascript error will raise, and cannot render the figure:

from pythreejs import *
from IPython.display import display
import ipywidgets

# Reduce repo churn for examples with embedded state:
from pythreejs._example_helper import use_example_model_ids
use_example_model_ids()

ball = Mesh(geometry=SphereGeometry(),
            material=MeshLambertMaterial(color='red'))
key_light = DirectionalLight(color='white', position=[3, 5, 1], intensity=0.5)

c = PerspectiveCamera(position=[0, 5, 5], up=[0, 1, 0], children=[key_light])

scene = Scene(children=[ball, c, AmbientLight(color='#777777')], background=None)

renderer = Renderer(camera=c,
                    scene=scene,
                    alpha=True,
                    clearOpacity=0,
                    controls=[OrbitControls(controlling=c)])
display(renderer)

The following is the raised error:

[Open Browser Console for more detailed log - Double click to close this message]
Model class 'RendererModel' from module 'jupyter-threejs' is loaded but can not be instantiated
TypeError: Cannot read properties of undefined (reading 'then')
    at http://localhost:8888/lab/extensions/jupyter-threejs/static/jupyter-threejs-chunk.ba1735fea70611ab4bc1.js?v=ba1735fea70611ab4bc1:1:32057
    at async Promise.all (index 20)
    at async f._make_model (http://localhost:8888/static/lab/4416.0944956f5de66ec0a0b0.js?v=0944956f5de66ec0a0b0:1:9684)

The following is the conda environment:

jupyter_client            8.1.0              pyhd8ed1ab_0    conda-forge
jupyter_core              5.3.0           py310h5588dad_0    conda-forge
jupyter_events            0.6.3              pyhd8ed1ab_0    conda-forge
jupyter_server            2.5.0              pyhd8ed1ab_0    conda-forge
jupyter_server_terminals  0.4.4              pyhd8ed1ab_1    conda-forge
jupyterlab                3.5.0              pyhd8ed1ab_0    conda-forge
jupyterlab_pygments       0.2.2              pyhd8ed1ab_0    conda-forge
jupyterlab_server         2.21.0             pyhd8ed1ab_0    conda-forge
jupyterlab_widgets        3.0.7              pyhd8ed1ab_0    conda-forge
pythreejs                 2.4.2              pyh1d7be83_0    conda-forge

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions