K3D-tools / K3D-jupyter

K3D lets you create 3D plots backed by WebGL with high-level API (surfaces, isosurfaces, voxels, mesh, cloud points, vtk objects, volume renderer, colormaps, etc). The primary aim of K3D-jupyter is to be easy for use as stand alone package like matplotlib, but also to allow interoperation with existing libraries as VTK.
MIT License
917 stars 123 forks source link

Failed to load model class 'PlotModel' from module 'k3d' #384

Closed dirtycomputer closed 10 months ago

dirtycomputer commented 1 year ago

##################################My code ####################################

check_ds = Dataset(data=train_files[:4], transform=val_transforms)
image, label = check_ds[0]["image"], check_ds[0]["label"]
image, label = torch.squeeze(image), torch.squeeze(label)
print(f"image shape: {image.shape}, label shape: {label.shape}")
print(f"image max: {image.max()}, image min: {image.min()}")
print(f"label max: {label.max()}, label min: {label.min()}")

plt_volume = k3d.volume(image,
                        mask=label.astype(np.uint8),
                        mask_opacities=[0.025, 3.0],
                        color_range=[0, 700])

plot = k3d.plot()
plot += plt_volume
plot.display()

################################ What I GOT in jupyter lab notebook ##################################

[Open Browser Console for more detailed log - Double click to close this message] Failed to load model class 'PlotModel' from module 'k3d' loadClass@http://localhost:8888/lab/extensions/@jupyter-widgets/jupyterlab-manager/static/134.bcbea9feb6e7c4da7530.js?v=bcbea9feb6e7c4da7530:1:74856 loadModelClass@http://localhost:8888/lab/extensions/@jupyter-widgets/jupyterlab-manager/static/150.3e1e5adfd821b9b96340.js?v=3e1e5adfd821b9b96340:1:10729

artur-trzesiok commented 1 year ago

Please try 2.15.0 (https://pypi.org/project/k3d/ for conda-forge we need to wait a little bit). @renefritze contribution should solve that

artur-trzesiok commented 1 year ago

@dirtycomputer any update?

parmentelat commented 1 year ago

Hi all fyi, I was running into the same issue earlier this week, and upgrading to 2.15.3 did solve my problem

parmentelat commented 1 year ago

Hi all fyi, I was running into the same issue earlier this week, and upgrading to 2.15.3 did solve my problem

artur-trzesiok commented 10 months ago

great then! I will lose that issue.