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

RuntimeError: Aspect_DisplayConnectionDefinitionErrorCan not connect to the server "" raised from method Display3d of class Display3d #1302

Closed
Lydiagugugaga opened this issue Mar 11, 2024 · 2 comments

Comments

@Lydiagugugaga
Copy link

Dear community,
My problem is "can't use the class Viewer3d() from OCC.Display.OCCViewer import Viewer3d

viewer = Viewer3d() <-- Display3d.__init__(self) <-- _Visualization.Display3d_swiginit(self, _Visualization.new_Display3d())
RuntimeError: Aspect_DisplayConnectionDefinitionErrorCan not connect to the server "" raised from method Display3d of class Display3d

The version is pythonocc-core=7.7.2

I can do it in windows, but it can't work in linux. viewer = Viewer3d()
How to solve this problem for using in linux?
I wish for your help.

@vinnyvimto
Copy link

vinnyvimto commented Mar 22, 2024

So running the offscreen rendering example, which uses the Viewer3d, I have it working fine. This was with

  • ubuntu 23.10
  • python 3.10
  • pythonocc-core 7.7.2

Annoyingly though when I try to run this in a ubuntu:23.10 docker container with the exact same dependencies I get the above error. Would love to know a way around it so I can run workloads with it in docker.

Edit: I did actually get this working following this advice: #708 (comment)

The important part was installing xvfb

apt-get install xvfb
export DISPLAY=:99
Xvfb :99 -screen 0 640x480x24 &

The X virtual framebuffer (Xvfb) is an X server that can run on machines with no display hardware and no physical input devices. It emulates a dumb framebuffer using virtual memory.

@tpaviot
Copy link
Owner

tpaviot commented Apr 13, 2024

On Linux, to instanciate the Viewer3d class, you need to have a x server installed, or an x server emulator (like xvfb)

@tpaviot tpaviot closed this as completed Apr 13, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants