conda-forge / vtk-feedstock

A conda-smithy repository for vtk.
BSD 3-Clause "New" or "Revised" License
13 stars 64 forks source link

VTK with OSMesa support does not work #81

Closed daniellivingston closed 5 years ago

daniellivingston commented 5 years ago

Issue:

Given a Docker running Jupyter, I am trying to craft a Dockerfile around #20 in order to do notebook embedded renderings.

I consistently get an X error:

ERROR: In ../Rendering/OpenGL2/vtkXOpenGLRenderWindow.cxx, line 452
vtkXOpenGLRenderWindow (0x560a53bb7ce0): bad X server connection. DISPLAY=[I 00:12:28.476 NotebookApp] KernelRestarter: restarting kernel (1/5), keep random ports
kernel 0839b810-c699-472b-bd57-11c5cfed7fa5 restarted

so clearly, VTK is not running headless.

The environment variable VTK_WITH_OSMESA="True", Mesa is installed via libgl1-mesa-glx libosmesa6-dev and conda install --yes -c conda-forge mesalib.


Environment (conda list):

Effectively my entire Dockerfile is printed below: ``` ARG BASE_CONTAINER=jupyter/minimal-notebook FROM $BASE_CONTAINER USER root RUN apt-get update && \ apt-get install -y --no-install-recommends \ gfortran libz-dev m4 bison cmake \ libgl1-mesa-glx libosmesa6-dev USER $NB_UID # Ensure that OSMesa is used for headless VTK ENV VTK_WITH_OSMESA True RUN conda install --yes -c conda-forge mesalib # Build dependencies RUN conda install --quiet --yes \ 'conda-forge::blas=*=openblas' \ 'ipywidgets=7.4*' \ 'matplotlib=3.0*' \ 'vtk' && \ conda clean -tipsy && \ jupyter nbextension enable --py widgetsnbextension --sys-prefix && \ jupyter labextension install @jupyter-widgets/jupyterlab-manager@^0.38.1 && \ jupyter labextension install jupyterlab_bokeh@0.6.3 && \ npm cache clean --force && \ rm -rf $CONDA_DIR/share/jupyter/lab/staging && \ rm -rf /home/$NB_USER/.cache/yarn && \ rm -rf /home/$NB_USER/.node-gyp && \ fix-permissions $CONDA_DIR && \ fix-permissions /home/$NB_USER ```


Details about conda and system ( conda info ):

``` jovyan@26d2d8cf795a:~$ conda info active environment : None user config file : /home/jovyan/.condarc populated config files : /opt/conda/.condarc /home/jovyan/.condarc conda version : 4.6.8 conda-build version : not installed python version : 3.7.1.final.0 base environment : /opt/conda (writable) channel URLs : https://conda.anaconda.org/conda-forge/linux-64 https://conda.anaconda.org/conda-forge/noarch https://repo.anaconda.com/pkgs/main/linux-64 https://repo.anaconda.com/pkgs/main/noarch https://repo.anaconda.com/pkgs/free/linux-64 https://repo.anaconda.com/pkgs/free/noarch https://repo.anaconda.com/pkgs/r/linux-64 https://repo.anaconda.com/pkgs/r/noarch package cache : /opt/conda/pkgs /home/jovyan/.conda/pkgs envs directories : /opt/conda/envs /home/jovyan/.conda/envs platform : linux-64 user-agent : conda/4.6.8 requests/2.21.0 CPython/3.7.1 Linux/4.9.125-linuxkit ubuntu/18.04.1 glibc/2.27 UID:GID : 1000:100 netrc file : None offline mode : False jovyan@26d2d8cf795a:~$ ```
banesullivan commented 5 years ago

solution in https://github.com/vtkiorg/vtki/issues/155

daniellivingston commented 5 years ago

Solved by @banesullivan in vtkiorg/vtki#155. Thanks Bane!

shuhaowu commented 5 years ago

The solution above is a work around right? Why is this issue closed?

banesullivan commented 5 years ago

I wouldn't consider it a "workaround." In order to use VTK (or many other graphics libraries) in a headless mode, you must set up the display configurations for that environment/machine as outlined in https://github.com/pyvista/pyvista/issues/155 and PyVista's docs

That type of configuration is out of scope for this feedstock as it has to do more with the machine. Also, even if there was a clean way to set up the headless display upon installation, it wouldn't last as the display has to be set up anytime the computer/environment is booted/started.

shuhaowu commented 5 years ago

Isn't there a compile time option that can enable off-screen rendering as indicated in this post? Is it not possible to provide a version of VTK like this? Sorry if I misunderstood what's going on here as I'm not super familiar with the rendering portion of VTK.

banesullivan commented 5 years ago

Hm, thanks for sharing that blog post... that's actually something I didn't know about. Perhaps this is worth exploring and something I have been overlooking. As far as whether or not it would be possible to provide a version of VTK leveraging that in this feedstock is out of my knowledge at this time.

If you think this is worth exploring, I'd recommend reopening this issue to see if some of the maintainers here can chime in. I'd investigate this, but I'm currently low on bandwidth and will have to circle back in a while

shuhaowu commented 5 years ago

I can't reopen this issue as I'm not the OP. I don't have time to investigate this either as I've setup Xvfb running in the background for now.

Another thing to note is that Paraview (which uses VTK) has a completely headless version available. So the rendering without X is definitely something worth looking into.

banesullivan commented 5 years ago

Thanks for bringing this back up, @shuhaowu - I'll keep all of this in mind for PyVista as it would definitely be applicable to many of our users!