Is there a way to use compas_view2 to visualize compas objects in 3D in a google colab notebook?
After a successful install, trying to display a dummy mesh with the
App raises an
ImportError: Cannot load backend ‘Qt5Agg’ which requires the ‘qt5’ interactive framework, as ‘headless’ is currently running
Here is a minimal working example FYR: Google Colab
I searched around, and the cause of this error might be that Google colab runs the notebook code in servers that do not have explicit support for interactive GUIs. However, I have been able to run and visualize stuff in a 3D GUI, similar to compas_view2.App, in a colab notebook: Google Colab
What they seem to be doing to circumvent this issue is to write the entire scene/app to a HTML, and then use IPython display to visualize it: nfem/viewer.py at main · StatikTUM/nfem · GitHub
Any thoughts on how to do this with compas_view2?
i don’t think this will work.
we started a notebook package for this a while ago, but i’m not sure what state it is in currently…
@Li_Chen will know
Thanks, @brgcode! Do you have any leads, @Li_Chen? Much appreciated!
Hey Rafael, sorry for the late reply. Yep… unfortunately it is not very realistic to run view2 with colab since it cannot access your local graphic card with just openGL,a rather fundamental problem. As Tom mentioned, we did compas_notebook specifically for this purpose. Here’s some examples; https://github.com/BRG-research/compas_notebook/tree/main/scripts in background it basically converts compas data structure to gltf and visualize it with three.js (webGL), it’s not as versatile but does cover basic elements like line edges faces. How complicated will it be in your visualisation?
@Li_Chen – thanks for sharing! I ran one of the scripts on a collab notebook and it works, so this is indeed promising. I essentially want to display a bunch of cylinders and arrows (represented as meshes, i.e. compas_view2.shapes.Arrow), each with a different color.
Do you think this is feasible with the current version of compas_notebook? I will anyways take a closer look and keep you all posted.