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

add docker files #107

Closed
keiyamamo opened this issue Nov 27, 2023 · 13 comments · Fixed by #128
Closed

add docker files #107

keiyamamo opened this issue Nov 27, 2023 · 13 comments · Fixed by #128
Assignees

Comments

@keiyamamo
Copy link
Collaborator

No description provided.

@keiyamamo keiyamamo self-assigned this Nov 27, 2023
@keiyamamo
Copy link
Collaborator Author

Hi @jorgensd,

I created a docker image on my forked repository: https://github.com/keiyamamo/VaSP/pkgs/container/vasp
but I have problem with using GUI with docker.

Here is the command I used.

  1. pull docker image
docker pull ghcr.io/keiyamamo/vasp:master --platform linux/amd64
  1. run the container
docker run --name=vasp -w /home/shared/ -v $PWD:/home/shared/ -it ghcr.io/keiyamamo/vasp:master
  1. run glxgears to see if the window pops up, but got the following error message
Error: couldn't open display

I tried to add -e DISPLAY=$DISPLAY with docker run, but that did not solve the problem. I also checked command that you explained in the seminar to use Jupyter notebook with docker, but that also did not solve the problem.

Do you have any idea how to fix the issue?

@keiyamamo
Copy link
Collaborator Author

This is the error message I get specifically when trying to run VaSP with docker

--- Visualizing flow split at outlets, inlet flow rate, and probes in VTK render window. 
--- Press 'q' inside the render window to exit.
2023-12-11 10:26:15.700 (  70.182s) [         1F4E300]vtkXOpenGLRenderWindow.:651    ERR| vtkXOpenGLRenderWindow (0x40754ff860): Cannot create GLX context.  Aborting.
qemu: uncaught target signal 6 (Aborted) - core dumped
Aborted

@keiyamamo
Copy link
Collaborator Author

I managed to run glxgears inside the docker container but still getting the error with vtk

--- Visualizing flow split at outlets, inlet flow rate, and probes in VTK render window.
--- Press 'q' inside the render window to exit.
libGL error: No matching fbConfigs or visuals found
libGL error: failed to load driver: swrast
2023-12-11 13:45:46.320 (  81.200s) [         1F4E300]vtkOpenGLRenderWindow.c:499    ERR| vtkXOpenGLRenderWindow (0x4074bd2600): Unable to find a valid OpenGL 3.2 or later implementation. Please update your video card driver to the latest version. If you are using Mesa please make sure you have version 11.2 or later and make sure your driver in Mesa supports OpenGL 3.2 such as llvmpipe or openswr. If you are on windows and using Microsoft remote desktop note that it only supports OpenGL 3.2 with nvidia quadro cards. You can use other remoting software such as nomachine to avoid this issue.
qemu: uncaught target signal 11 (Segmentation fault) - core dumped
Segmentation fault

To make glxgears work, I ran

defaults write org.xquartz.X11 enable_iglx -bool YES

and

xhost +

outside the container.

@jorgensd
Copy link
Collaborator

I get it to run by calling:

xhost +
 docker run --network=host -e DISPLAY=$DISPLAY --rm -w /home/shared/ -v $PWD:/home/shared/ -it ghcr.io/keiyamamo/vasp:master

It renders the gears nicely (using ubuntu:22.04 with an intel core i7)

@keiyamamo
Copy link
Collaborator Author

keiyamamo commented Dec 11, 2023

Thank you for trying it out! Yes, the gears work nicely, but the problem happens with vtk and its window.
It might be related to this issue docker/for-mac#5123
since I’m using linux/amd64 image on my M1 Mac book pro with arm64.

Now I’m trying to create an image with arm64 but I got an error

https://github.com/keiyamamo/VaSP/actions/runs/7168742081/job/19517580928

Do you have any suggestion how to fix this?

@jorgensd
Copy link
Collaborator

Vmtk Depends on VtK? It is likely that we cannot use conda to build the docker environment, and have to build dependencies from source.

@keiyamamo
Copy link
Collaborator Author

Yes, vmtk depends on vtk. I will try a few different things and then will try building from source if none of them works. Thanks!

@johannesring
Copy link
Collaborator

There is a docker file for building vmtk from source in the VMTKScripts repository on KVSlab. It's been a while since I made it, so I am not sure if it is still usable.

@keiyamamo
Copy link
Collaborator Author

@johannesring Thanks for letting me know! I will check it out.

@keiyamamo
Copy link
Collaborator Author

keiyamamo commented Dec 12, 2023

Hi @jorgensd @johannesring

This is a minimal working example of this problem with vtk.

import vtk

# Create a renderer and a render window
renderer = vtk.vtkRenderer()
render_window = vtk.vtkRenderWindow()
render_window.AddRenderer(renderer)

# Create a render window interactor
interactor = vtk.vtkRenderWindowInteractor()
render_window.Render()
interactor.Start()

which gives

libGL error: No matching fbConfigs or visuals found
libGL error: failed to load driver: swrast
2023-12-12 14:41:24.382 (   1.068s) [         1F4E300]vtkOpenGLRenderWindow.c:499    ERR| vtkXOpenGLRenderWindow (0x4000427b40): Unable to find a valid OpenGL 3.2 or later implementation. Please update your video card driver to the latest version. If you are using Mesa please make sure you have version 11.2 or later and make sure your driver in Mesa supports OpenGL 3.2 such as llvmpipe or openswr. If you are on windows and using Microsoft remote desktop note that it only supports OpenGL 3.2 with nvidia quadro cards. You can use other remoting software such as nomachine to avoid this issue.
qemu: uncaught target signal 11 (Segmentation fault) - core dumped
Segmentation fault

I’m not sure if this is specific to my Mac book pro or general problem. Would it be possible to test it on your laptop?

@johannesring
Copy link
Collaborator

@keiyamamo - I have been looking into this today and tried a few different things on my laptop with Ubuntu and a Intel graphics card. I found that your Docker image ghcr.io/keiyamamo/vasp:add_docker does not work for me. The glxgears command works, but when I try to run a vmtk command, like for example vmtksurfaceviewer, a windows does not pop up like it should. I tried to build a new Docker image using environment.yml instead of environment_without_vtk.yml and that fixed this problem. I see the same behavior if I create two different conda environments (with and without vtk) without using Docker, so this problem is not related to Docker. Any reason you are using environment_without_vtk.yml?

I also tried your minimal vtk example above but that failed for me both inside and outside of Docker with the same error message:

2024-01-17 09:38:04.710 (   0.391s) [         EFE9740]vtkXRenderWindowInterac:322    ERR| vtkXRenderWindowInteractor (0x55b15d9786c0): No renderer defined!

I had to modify the example to make it run:

import vtk

# Create a renderer and a render window
renderer = vtk.vtkRenderer()
render_window = vtk.vtkRenderWindow()
render_window.AddRenderer(renderer)

# Create a render window interactor
interactor = vtk.vtkRenderWindowInteractor()
interactor.SetRenderWindow(render_window) 

# Create a cube as a simple example
cube_source = vtk.vtkCubeSource()
cube_mapper = vtk.vtkPolyDataMapper()
cube_mapper.SetInputConnection(cube_source.GetOutputPort())

cube_actor = vtk.vtkActor()
cube_actor.SetMapper(cube_mapper)

# Add the cube actor to the renderer
renderer.AddActor(cube_actor)

# Set up the renderer, render window, and interactor
render_window.Render()
interactor.Start()

I see the same issue with this example. No window pops up when using your Docker image (using environment_without_vtk.yml).

@keiyamamo
Copy link
Collaborator Author

Hi @johannesring

Thank you for checking this out! Originally, I was using environment.yml but that did not work for me with the same error message. Therefore, I was just testing with environment_without_vtk.yml to see if that helps. So there’s no big reason for me to use environment_without_vtk.yml.

If the docker image with environment.yml works on your computer, I think we can go ahead and publish the docker image on the main branch since the problem might be specific to my Mac computer. What do you think?

@johannesring
Copy link
Collaborator

Yes, I agree.

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

Successfully merging a pull request may close this issue.

3 participants