Render VTU and VTK files in Jupyter Notebooks

Hello, there is a way to render VTU/VTK files on a Jupyter notebook? Or a command to take screenshots of this VTU-VTK files? Support in Google Colaboratory will be great

Hi Sirius!

I’ve been working on a project for interactive ParaView within Jupyter, called iPyParaView: https://github.com/NickLeaf/ipyparaview It was recently open-sourced and is still in an early state (the install process, in particular, needs work). It will eventually slot nicely into the conda / PyViz ecosystem, and might be worth a try to see if it fits your needs.

If you’re keen on a little early adoption, feedback and contributions are more than welcome!

Hi Nick, that is great, I will try it now with Google Colab and give you feedback. I do not think of a better way to show it working that with a functional Jupyter notebook in the cloud. It remains to be seen if paraview could be installed on the virtual machine of Google Colab.

When you say " Note that this requires a pre-existing ParaView installation" it means a “ParaView Server for Headless Machines”? Sorry for my lack of knowledge in these topics

No problem! As long as the version of ParaView (and pvpython in particular) runs on the machine, then the widget should work. The headless server version of ParaView isn’t strictly required, but for a VM running in the cloud it’s probably the easiest version to use.

Hi Nick, I am having problems installing your software, I have tried in Google Colab as well as on my ubuntu machine (Ubuntu 19.04 64 bit) and I get the error:

Collecting https://github.com/NickLeaf/ipyparaview.git
  Downloading https://github.com/NickLeaf/ipyparaview.git
     | 112kB 71kB/s
  Cannot unpack file /tmp/pip-unpack-1XrKYl/ipyparaview.git (downloaded from /tmp/pip-req-build-Qo3ZAl, content-type: text/html; charset=utf-8); cannot detect archive format
Cannot determine archive format of /tmp/pip-req-build-Qo3ZAl

It looks like I forgot to update the install instructions in the README when I moved repos. The instructions for installation via pip should be
pip install git+https://github.com/NickLeaf/ipyparaview.git
Note that this also requires that nodejs be install for npm.

1 Like

thank you Nick I will check

Another option is to use vtk.js-based rendering via itkwidgets. Here is an example:

And an UnstructuredGrid with pyvista:

Notebook

There is a known limitation in Google Colab for ipywidget-based Jupyter extensions, like itkwidgets and ipyparaview, so your mileage may vary there.

1 Like

There is a new Jupyter Kernel for paraview, available here :
https://gitlab.kitware.com/paraview/paraviewjupyterkernel

1 Like

I have a server-only installation (PARAVIEW_BUILD_QT_GUI=OFF) of ParaView 5.7 and the configuration fails with the error:

Missing required module: ParaView::pqApplicationComponents

Is this something from the GUI? I would not have thought it would be required. We have managed to install and use the first solution by @NickLeaf using the same ParaView installation.

Please advise on how to remove the pqApplicationComponents error.

@nicolas.vuaille

Why we created the paraviewJupyterKernel (mentioned by Mathieu)

This Jupyter Kernel was designed to be used with the GUI, as an external python shell. It was useful in our use case to keep access to the GUI.

Why GUI is required and not optional
This kernel is an autostart plugin, that can only exists with Qt.

I will update the doc to specify this.