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

Model class 'PlotModel' from module 'k3d' is loaded but can not be instantiated #383

Closed RonaldEnsing closed 1 year ago

RonaldEnsing commented 1 year ago

K3D version: 2.14.5 Python version: 3.10.6 Operating System: Ubuntu 20.04

Description

I am trying to show a k3d plot in a jupyter notebook.

What I Did

I used the following conda environment.yml:

name: k3d
channels:
  - conda-forge
  - defaults
dependencies:
  - jupyter
  - k3d

Created the env with: conda env create -f environment.yml

Installed and enabled the nbextensions:

$ jupyter nbextension install --py --user k3d
$ jupyter nbextension enable --py --user k3d

Started the notebook with jupyter notebook.

and executed the following code:

import numpy as np
import k3d
plot = k3d.plot()
plot += k3d.points(np.random.randn(100), point_size=0.1)
plot.display()

Web console log / python logs

The code runs, but instead of showing the plot I get an error:

Model class 'PlotModel' from module 'k3d' is loaded but can not be instantiated

image

hboekema commented 1 year ago

I have the same issue when following these steps.

CRTejaswi commented 1 year ago

Facing the same issue. Browser shows a "Host not attached" error.

Duplicate of #371 As of now, downgrading works (flacle).

pip uninstall jupyterlab-widgets ipywidgets
pip install ipywidgets==7.7.1 jupyterlab-widgets==1.1
RonaldEnsing commented 1 year ago

I don't think this is a duplicate of #371.

The error of this issue is:

Model class 'PlotModel' from module 'k3d' is loaded but can not be instantiated

The error of #371 is:

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

anilkul98 commented 1 year ago

I have exactly the same problem even after downgrading the ipywidgets and jupyterlab-widgets. Is there any other solution.

My Setting Details:

ubuntu 22.04 LTS python 3.7 k3d: 2.12.0

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

any updates?