Error when run 3DSlicer in singularity container

The following errors is reported when i run 3DSlicer in singularity container:

X Error: BadValue (integer parameter out of range for operation) 2
Extension: 155 (Uknown extension)
Minor opcode: 3 (Unknown request)
Resource id: 0x0
Cannot create GLX context. Aborting.

The singularity container is created based on ubuntu 16.04.
3DSlicer is downloaded from 3DSlicer released archive.
The version of 3D slicer i tried is v4.4 and v4.5.1.
Phenomenon: the GUI of 3DSlicer stuck for few seconds and then closed automatically. Please check the screenshot below:

I tried this singularity container in two host machines, one with OS ubuntu 18.01 and another with OS redhat 6.7. I got the same error in both of those two host machines.

No idea how to solve this problem.

Thanks so much for any suggestion.

Hi -

You need a OpenGL support in your X server to run Slicer.

I haven’t done it for Singularity, but it works well for Docker (no GPU acceleration, but software emulation works well).

Let us know how it goes.

Hi Steve,

Thanks so much for your reply. Since i need to run 3DSlicer in HPC cluster, I cannot use docker to do it (which requires sudo).

I think the X server in our HPC cluster should support opengl, since i can run multiple GUI based software in our cluster. Here is the output of “glxinfo”:

xil14026admin@cn01:~$ glxinfo | grep render
direct rendering: Yes
    GLX_MESA_multithread_makecurrent, GLX_MESA_query_renderer, 
    GLX_MESA_query_renderer, GLX_OML_swap_method, GLX_SGI_make_current_read, 
OpenGL renderer string: Gallium 0.4 on llvmpipe (LLVM 3.6, 128 bits)
    GL_EXT_vertex_array_bgra, GL_NV_conditional_render, 
    GL_ARB_clip_control, GL_ARB_conditional_render_inverted, 

I think the reason i get this error maybe caused by 3DSlicer tries to write something in system folder (such as libpulse). Is there any way to remove all the libraries, which require access to the system folder and write something in it during the runtime? If it could be, recompiling a special version of 3DSlicer without contain those sytem-folder-write-based functions may let 3DSclier fit HPC cluster.

Thanks so much for your help

There really wouldn’t be anything in Slicer that requires sudo, but I really don’t have any experience with Singularity so perhaps it adds extra constraints. Are you able to run other graphics apps inside Singularity, like glxgears or ParaView? It would be nice to get this working, since it sounds like a pretty common use case (cluster nodes with no root access).

Dear Steve,

Thanks so much for your prompt reply. I just compiled 3DSlicer installation package (4.9) through docker in my desktop (ubuntu 18.04). I also created a new singularity container through my original recipe file. It seems works in both of my desktop (ubuntu 18.04) and our cluster (redhat 6.7).

I will spend additional time to check why the old singularity container doesn’t work.
I am all set now. Thanks so much for your time.

That’s great Xin :+1: - any chance you could share the instructions / recipe / image for future reference.

Sure Steve:) I work for UConn HPC 16 hours per week during summer. I will back to office on Monday next week and create a recipe file of singularity for 3DSlicer. Please let me know what is your favorite way to share files.

Have a good night

Thanks Xin - that will be excellent. I think a github repository is best for the recipe, and then maybe an image in singularity hub (I think that’s the right terminology, but whatever corresponds to github Dockerfile and dockerhub).

Dear Pieper,

I already uploaded the recipe file and readme doc of how to build/use 3DSlicer with singularity container.
Please check the link below:

Have a good night

1 Like

Thanks for posting that Xin! :+1: