Skip to content
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

Running vedo on a Server #64

Closed
SiriusFuenmayor opened this issue Oct 9, 2019 · 8 comments
Closed

Running vedo on a Server #64

SiriusFuenmayor opened this issue Oct 9, 2019 · 8 comments

Comments

@SiriusFuenmayor
Copy link

SiriusFuenmayor commented Oct 9, 2019

Hello, I have succesfully build a FEniCS Docker container incluiding vedo, but when I try to use vedo I encounter the error:

ERROR: In /work/standalone-x64-build/VTK-source/Rendering/OpenGL2/vtkXOpenGLRenderWindow.cxx, line 1223 vtkXOpenGLRenderWindow (0x24992f0): bad X server connection. DISPLAY=Aborted (core dumped)

It appears that vedo or vtk can not run without the X server. Is there any way to solve this issue?

@marcomusy marcomusy changed the title Adding vtkplotter to FEniCS Docker container: vtkplotter can't render with error "ERROR: In /work/standalone-x64-build/VTK-source/Rendering/OpenGL2/vtkXOpenGLRenderWindow.cxx, line 1223 vtkXOpenGLRenderWindow (0x24992f0): bad X server connection. DISPLAY=Aborted (core dumped)" Docker container with FEniCS and render using SSH with X11 forwarding Nov 29, 2019
@RubendeBruin
Copy link
Contributor

RubendeBruin commented Nov 30, 2019

I'm reporting what worked for me on ubuntu 18.04 server.

  1. Install libgl1-mesa and xvfb:
 sudo apt-get install libgl1-mesa-dev libgl1-mesa-glx  xvfb
  1. Execute on startup:
#!/bin/bash
# 
set -x
export DISPLAY=:99.0
Xvfb :99 -screen 0 1024x768x24 > /dev/null 2>&1 &
sleep 3
set +x
exec "$@"

save the bash script above as /etc/rc.local (or any other file to be called) and use chmod +x to make it executable.

  1. Run a python script test:
plt = vedo.Plotter(offscreen=True)
plt += vedo.Cube()
plt.show()
plt.screenshot(filename)
plt.close()

@marcomusy marcomusy pinned this issue Apr 3, 2022
Repository owner deleted a comment from LogWell Apr 3, 2022
Repository owner deleted a comment from SiriusFuenmayor Apr 3, 2022
Repository owner deleted a comment from SiriusFuenmayor Apr 3, 2022
Repository owner deleted a comment from SiriusFuenmayor Apr 3, 2022
@marcomusy marcomusy changed the title Docker container with FEniCS and render using SSH with X11 forwarding Running vedo on a Server Apr 3, 2022
@XushanLu
Copy link
Contributor

Hi,

I tried this on my Ubuntu 22.04 LTS system connected via SSH. Both the test suggested here and my own script failed with the following error:
[1] 6992 abort (core dumped)

I believe I have installed all the libraries mentioned and set up the rc.local file both in /etc/ and in the folder that I am working in.

Is anyone experiencing such an error?

Thanks.

@marcomusy
Copy link
Owner

Have you tried running manually the bash script (point 2.) in the server?
to make sure the xvfb gets started.

@XushanLu
Copy link
Contributor

Hi Marco,

Thanks very much for your quick reply. I tried that manually and I find my zsh complaining. Then I switched to bash and it seems to be working under bash. I don't know full well what might be the issue behind the failure of zsh. I will simply switch to bash to get things done.

@fstrazzante
Copy link

fstrazzante commented Jan 31, 2023

Hello,
thank you Marco for the module is amazing!
I still have this problem on Ubuntu server 20.04.
When I try to execute

import vedo
plt = vedo.Plotter(offscreen=True)
plt += vedo.Cube()
plt.show()
plt.screenshot("a.png")
plt.close()

I get:

Aborted

I installed all the packages suggested by RubendeBruin's answer and executed the bash script. For the bash script I executed on the server which bash and got /usr/bin/bash so, this is the bash script:

#!/usr/bin/bash

set -x
export DISPLAY=:99.0
Xvfb :99 -screen 0 1024x768x24 > /dev/null 2>&1 &
#sleep 3
set +x
exec "$@"
echo Just a regular string

I did chmod u+x set_xvfb.sh, executed with ./set_xvfb.sh and got this output:

+ export DISPLAY=:99.0
+ DISPLAY=:99.0
+ set +x
Just a regular string
+ Xvfb :99 -screen 0 1024x768x24

And then, executing the python script, I still have:
Aborted

(Context)
vedo --info

vedo version      : 2022.4.2   https://vedo.embl.es
vtk version       : 9.2.5
numpy version     : 1.23.1
python version    : 3.8.10 (default, Nov 14 2022, 12:59:47) [GCC 9.4.0]
python interpreter: /usr/bin/python3
vedo installation : /home/flogicalg/.local/lib/python3.8/site-packages/vedo
system            : Linux 5.4.0-105-generic posix x86_64
monitor           : info is unavailable. Try "pip install screeninfo".

Python: 3.8.10
Ubuntu: Ubuntu 20.04.5 LTS

Anyone know how to resolve this?

@marcomusy
Copy link
Owner

Hi Francesco,
are you also getting the same problem if you run this script?

#!/usr/bin/env python
#
import vtk
import time

cone = vtk.vtkConeSource()

mapper = vtk.vtkPolyDataMapper()
mapper.SetInputConnection(cone.GetOutputPort())

actor = vtk.vtkActor()
actor.SetMapper(mapper)

ren = vtk.vtkRenderer()
ren.AddActor(actor)

renWin = vtk.vtkRenderWindow()
renWin.SetSize(500, 500)
renWin.AddRenderer(ren)

# iren = vtk.vtkRenderWindowInteractor()
# iren.SetRenderWindow(renWin)

renWin.SetOffScreenRendering(1)
renWin.Render()

@fstrazzante
Copy link

Hi Marco,
thank you, I tried to execute the script you shared and I got this error:

 2023-02-02 08:33:45.587 (   2.324s) [        ACC37740]vtkXOpenGLRenderWindow.:464    ERR| vtkXOpenGLRenderWindow (0x25dfd00): bad X server connection. DISPLAY=
Aborted

@marcomusy
Copy link
Owner

uhm i was suspecting that... it looks like your system has some problem with running Xvfb, unfortunately I would not know how to fix that as I'm not very familiar with it... but for sure it's not related to vedo per se. :(

@marcomusy marcomusy unpinned this issue Jan 16, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants