New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Mayavi off screen rendering not working for VTK 7.1.0 #477
Comments
I found that by setting >>> from mayavi import mlab
>>> mlab.options.offscreen = True
>>> mlab.test_plot3d()
ERROR: In ../Rendering/OpenGL2/vtkXOpenGLRenderWindow.cxx, line 301
vtkXOpenGLRenderWindow (0x2e027d0): bad X server connection. DISPLAY=Aborted (core dumped) |
If |
@jan-janssen -- Can you please test with latest master, it should be fixed now. You will still need the |
I have tested this using the osmesa conda-forge vtk packages and I can't make it work without an X server. I think I have the env setup properly. What I did was:
|
ok actually the pure VTK example given in the OP dosen't work either, so I assume there is something wrong with my env. I get the same thing with a straight |
Thanks for testing, can you check if the installed VTK has |
It does not have that. I don't suppose you know what controls if that exists or not?! |
When VTK is built you need to set |
hmmm, as far as I can tell the conda-forge osmesa package should do that. I will go open an issue there. |
I think newer mesa releases do not allow both mesa and osmesa so recent VTK releases may automatically turn off osmesa when vtk_use_x is turned on. But I am not entirely sure about this as many things could have changed ... |
If possible could you try with an older version like VTK-7.x or whenever this was known to work? |
I'm having the same error message on Ubuntu 18, vtk 8.1.2, mayavi 4.6.2 |
I'm also having this issue with mayavi. Did anyone find any solution? I'm having this issue when using mayavi in a server, although I have the display being forwarded to my local computer. |
I had quite a similar problem when using Mayavi in a Jupyter-Notebook provided by a remote Jupyter-Hub server. The problem was that that there is no X Server is running. I solved it with installing xvfbwrapper and the Xvfb back-end. Before doing anything with mayavi start a Display. Example #The following 3 lines must be before doing anything with mayavi (even importing)
from xvfbwrapper import Xvfb
vdisplay = Xvfb(width=1920, height=1080)
vdisplay.start()
from mayavi import mlab
mlab.init_notebook()
s = mlab.test_plot3d()
s If there is no more elegant way, I think it would be good to mention this in the manual. |
@max9111 do you remember doing anything else? I tried your code after installing
|
@tjiagoM Maybe you have forgotten to install xfb itself (sudo apt-get install xvfb)? |
@max9111 oh, no, initially I made that mistake but they would throw an error saying that no xvfb was found/active (or something similar) |
@max9111 I'm struggling with the same set-up, mayavi on a remote jupyterhub. Do you have a sample docker image used by the hub? I tried using |
@mirestrepo My setup is:
|
@max9111 I managed to skip the xvfb wrapper by launching |
The xvfb-run may come to your assistance: xvfb-run python your-py-script.py Note you need to install xvfb before running the command above. |
I use vtk with the MesaOS driver as I want to run the rendering as part of a jupyter notebook in headless mode, some more details to the package configuration can be found here:
conda-forge/vtk-feedstock#20
When I use the VTK off screen example it is working fine:
But when I test the mayavi off screen example, it is not working:
The error message I get is:
So to me it seems like the off screen initialisation is not correctly forwarded to VTK. Unfortunately I was unable to locate the initialisation of VTK inside mayavi myself. To me it seems to be happening in
tvtk_access.py
, still I do not see an option to force offscreen rendering directly.The text was updated successfully, but these errors were encountered: