panel
panel copied to clipboard
PyVista plot fails with the panel as the jupyter backend with TypeError: GetPoints() takes exactly 1 argument (0 given)
ALL software version info
I am running a JupyterLab with following version info:
jupyter core : 4.7.1
jupyter-notebook : 6.4.0
qtconsole : not installed
ipython : 7.24.1
ipykernel : 5.5.5
jupyter client : 6.1.12
jupyter lab : 2.3.1
nbconvert : 6.0.7
ipywidgets : not installed
nbformat : 5.1.3
traitlets : 5.0.5
...using a custom conda-env kernel with:
python=3.9.5
panel=0.11.3
pyvista=0.31.2
and the following JupyterLab extensions:
JupyterLab v2.3.1
Known labextensions:
app dir: /Users/matus/miniconda3/share/jupyter/lab
@axlair/jupyterlab_vim v0.12.4 enabled OK
@jupyter-widgets/jupyterlab-manager v2.0.0 enabled OK
@pyviz/jupyterlab_pyviz v1.0.4 enabled OK
ipygany v0.5.0 enabled OK
k3d v2.9.6 enabled OK
...on a macOS:
os.uname()
posix.uname_result(sysname='Darwin', nodename='Foo-MacBook-Pro.local', release='20.5.0', version='Darwin Kernel Version 20.5.0: Sat May 8 05:10:33 PDT 2021; root:xnu-7195.121.3~9/RELEASE_X86_64', machine='x86_64')
...in Google Chrome (Version 91.0.4472.106).
Description of expected behavior and the observed behavior
I am using the GSTools geostatistical library which can export mesh objects to pyvista (via the to_pyvista()
interface) which I can then use for interactive plotting in jupyter lab. I have two jupyter backends installed - ipygany
and panel
. The following example works with the ipygany
backend but fails with the panel
backend with a TypeError.
Complete, minimal, self-contained example code that reproduces the issue
The example is taken from here:
import gstools as gs
# structured field with a size 100x100 and a grid-size of 1x1
x = y = range(100)
model = gs.Gaussian(dim=2, var=1, len_scale=10)
srf = gs.SRF(model)
srf((x, y), mesh_type='structured')
mesh = srf.to_pyvista()
mesh.plot(jupyter_backend='ipygany') # works
#mesh.plot(jupyter_backend='panel') # fails with TypeError
Stack traceback
---------------------------------------------------------------------------
TypeError Traceback (most recent call last)
~/miniconda3/envs/foo/lib/python3.9/site-packages/IPython/core/formatters.py in __call__(self, obj, include, exclude)
968
969 if method is not None:
--> 970 return method(include=include, exclude=exclude)
971 return None
972 else:
~/miniconda3/envs/foo/lib/python3.9/site-packages/panel/viewable.py in _repr_mimebundle_(self, include, exclude)
586 doc = _Document()
587 comm = state._comm_manager.get_server_comm()
--> 588 model = self._render_model(doc, comm)
589 ref = model.ref['id']
590 manager = CommManager(comm_id=comm.id, plot_id=ref)
~/miniconda3/envs/foo/lib/python3.9/site-packages/panel/viewable.py in _render_model(self, doc, comm)
425 if comm is None:
426 comm = state._comm_manager.get_server_comm()
--> 427 model = self.get_root(doc, comm)
428
429 if config.embed:
~/miniconda3/envs/foo/lib/python3.9/site-packages/panel/pane/base.py in get_root(self, doc, comm, preprocess)
252 doc = init_doc(doc)
253 if self._updates:
--> 254 root = self._get_model(doc, comm=comm)
255 else:
256 root = self.layout._get_model(doc, comm=comm)
~/miniconda3/envs/foo/lib/python3.9/site-packages/panel/pane/vtk/vtk.py in _get_model(self, doc, root, parent, comm)
428 debug=self._debug_serializer
429 )
--> 430 scene, arrays = self._serialize_ren_win(self.object, context)
431 self._update_color_mappers()
432 props = self._process_param_change(self._init_params())
~/miniconda3/envs/foo/lib/python3.9/site-packages/panel/pane/vtk/vtk.py in _serialize_ren_win(self, ren_win, context, binary, compression, exclude_arrays)
317 ren_win.Modified()
318 ren_win.Render()
--> 319 scene = rws.serializeInstance(None, ren_win, context.getReferenceId(ren_win), context, 0)
320 scene['properties']['numberOfLayers'] = 2 #On js side the second layer is for the orientation widget
321 arrays = {name: context.getCachedDataArray(name, binary=binary, compression=compression)
~/miniconda3/envs/foo/lib/python3.9/site-packages/panel/pane/vtk/synchronizable_serializer.py in serializeInstance(parent, instance, instanceId, context, depth)
282
283 if serializer:
--> 284 return serializer(parent, instance, instanceId, context, depth)
285
286 if context.debugSerializers:
~/miniconda3/envs/foo/lib/python3.9/site-packages/panel/pane/vtk/synchronizable_serializer.py in renderWindowSerializer(parent, instance, objId, context, depth)
1283 renderer = rendererCollection.GetItemAsObject(rIdx)
1284 rendererId = context.getReferenceId(renderer)
-> 1285 rendererInstance = serializeInstance(
1286 instance, renderer, rendererId, context, depth + 1)
1287 if rendererInstance:
~/miniconda3/envs/foo/lib/python3.9/site-packages/panel/pane/vtk/synchronizable_serializer.py in serializeInstance(parent, instance, instanceId, context, depth)
282
283 if serializer:
--> 284 return serializer(parent, instance, instanceId, context, depth)
285
286 if context.debugSerializers:
~/miniconda3/envs/foo/lib/python3.9/site-packages/panel/pane/vtk/synchronizable_serializer.py in rendererSerializer(parent, instance, objId, context, depth)
1216 viewPropId = context.getReferenceId(viewProp)
1217
-> 1218 viewPropInstance = serializeInstance(
1219 instance, viewProp, viewPropId, context, depth + 1)
1220 if viewPropInstance:
~/miniconda3/envs/foo/lib/python3.9/site-packages/panel/pane/vtk/synchronizable_serializer.py in serializeInstance(parent, instance, instanceId, context, depth)
282
283 if serializer:
--> 284 return serializer(parent, instance, instanceId, context, depth)
285
286 if context.debugSerializers:
~/miniconda3/envs/foo/lib/python3.9/site-packages/panel/pane/vtk/synchronizable_serializer.py in genericActorSerializer(parent, actor, actorId, context, depth)
652 def genericActorSerializer(parent, actor, actorId, context, depth):
653 # may have texture and
--> 654 instance = genericProp3DSerializer(parent, actor, actorId, context, depth)
655
656 if not instance: return
~/miniconda3/envs/foo/lib/python3.9/site-packages/panel/pane/vtk/synchronizable_serializer.py in genericProp3DSerializer(parent, prop3D, prop3DId, context, depth)
629 def genericProp3DSerializer(parent, prop3D, prop3DId, context, depth):
630 # This kind of actor has some position properties to add
--> 631 instance = genericPropSerializer(parent, prop3D, prop3DId, context, depth)
632
633 if not instance: return
~/miniconda3/envs/foo/lib/python3.9/site-packages/panel/pane/vtk/synchronizable_serializer.py in genericPropSerializer(parent, prop, popId, context, depth)
575 if mapper:
576 mapperId = context.getReferenceId(mapper)
--> 577 mapperInstance = serializeInstance(
578 prop, mapper, mapperId, context, depth + 1)
579 if mapperInstance:
~/miniconda3/envs/foo/lib/python3.9/site-packages/panel/pane/vtk/synchronizable_serializer.py in serializeInstance(parent, instance, instanceId, context, depth)
282
283 if serializer:
--> 284 return serializer(parent, instance, instanceId, context, depth)
285
286 if context.debugSerializers:
~/miniconda3/envs/foo/lib/python3.9/site-packages/panel/pane/vtk/synchronizable_serializer.py in genericPolyDataMapperSerializer(parent, mapper, mapperId, context, depth)
747
748 def genericPolyDataMapperSerializer(parent, mapper, mapperId, context, depth):
--> 749 instance = genericMapperSerializer(parent, mapper, mapperId, context, depth)
750
751 if not instance: return
~/miniconda3/envs/foo/lib/python3.9/site-packages/panel/pane/vtk/synchronizable_serializer.py in genericMapperSerializer(parent, mapper, mapperId, context, depth)
709 # vtk-js actors can render only surfacic datasets
710 # => we ensure to convert the dataset in polydata
--> 711 dataObjectInstance = mergeToPolydataSerializer(
712 mapper, dataObject, dataObjectId, context, depth + 1)
713 else:
~/miniconda3/envs/foo/lib/python3.9/site-packages/panel/pane/vtk/synchronizable_serializer.py in mergeToPolydataSerializer(parent, dataObject, dataObjectId, context, depth)
1134 dataset = dataObject
1135
-> 1136 return polydataSerializer(parent, dataset, dataObjectId, context, depth)
1137
1138 # -----------------------------------------------------------------------------
~/miniconda3/envs/foo/lib/python3.9/site-packages/panel/pane/vtk/synchronizable_serializer.py in polydataSerializer(parent, dataset, datasetId, context, depth)
1066 datasetType = dataset.GetClassName()
1067
-> 1068 if dataset and dataset.GetPoints():
1069 properties = {}
1070
TypeError: GetPoints() takes exactly 1 argument (0 given)
Any updates on this issue?
I also ran into this issue when trying to visualize a local vtk
file with pyvista
with panel
backend in Jupyter notebook, regardless of OS, browser, etc.
Appears fixed in 1.0.0rc1:
