jupyter-widgets / pythreejs

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

JupyterLab support #287

Closed dkuegler closed 4 years ago

dkuegler commented 4 years ago

Hi,

in my installation threevis works fine with pythreejs in a jupyter notebook, but once I open the notebook in jupyter lab, it does not work anymore.

That is despite pythreejs being presnt and activated as an extension. Instead Jupyter Lab just writes out: Renderer(background='white', camera=PerspectiveCamera(aspect=1.5, children=(DirectionalLight(position=(-30.0, …

Code snippet:


import os, sys
import numpy as np
import nibabel as nib
#matplotlib notebook
import openmesh
import threevis

colors = threevis.UniformAttribute(np.asarray([0.1, 0.4, 0.4]))
bg = "white"
coords, faces, volume_info = nib.freesurfer.io.read_geometry(
    filepath, read_metadata=True, read_stamp=False)

threevis.display_faces(coords, faces, normals="face", shading="flat", colors=colors, background_color=bg) ```

$ jupyter notebook --version
6.0.0
$ jupyter lab --version
1.0.9
jasongrout commented 4 years ago

What labextensions do you have installed? jupyter labextension list

Did you install widgets: jupyter labextension install @jupyter-widgets/jupyterlab-manager?

(That widgets step should probably be added to the pythreejs install instructions at https://github.com/jupyter-widgets/pythreejs#installation)

dkuegler commented 4 years ago

@jasongrout Thank you.

This advice solved the issue.

It was a bit complicated to execute jupyter labextension install @jupyter-widgets/jupyterlab-manager in my docker container, but that was on my side.

I agree the addition of this in the install instructions is useful.