Sct_label_utils error

Hi Julien,
I installed successfully SCT on the server but failed to run labeling. What’s wrong?
Thanks.

Joe


sct_label_utils -i t2.nii.gz -create-viewer 1,2,3,4,5,6,7 -o t2label

qt.qpa.plugin: Could not load the Qt platform plugin “xcb” in “” even though it was found.

This application failed to start because no Qt platform plugin could be initialized. Reinstalling the application may fix this problem.

Available platform plugins are: eglfs, linuxfb, minimal, minimalegl, offscreen, vnc, wayland-egl, wayland, wayland-xcomposite-egl, wayland-xcomposite-glx, webgl, xcb.

Aborted

Operating System: CentOS Linux 7 (Core)
CPE OS Name: cpe:/o:centos:centos:7
Kernel: Linux 3.10.0-957.1.3.el7.x86_64
Architecture: x86-64

Hi
Do you connect to your server via ssh? If so do you have ssh tunnelling activated? (I.e. launched ssh with -X flag to get display). What happens if you run xeyes?

I used VNC actually so there should not be any display problem?

Hi Yazhuo_Kong, could you please share with us a screenshot of what you’re seeing and the exact steps you went through in order to get that error, so that we can easily reproduce it?

Normally an easy way to test the correct functionality of sct_label_utils would be to do the following:

  1. Install sct by doing sh install_sct
  2. Run: sct_download_data -d sct_course-beijing19 to download sample data.
  3. Run: cd sct_course-beijing19/single_subject/data/t2
  4. Run: sct_label_utils -i t2.nii.gz -create-viewer 1,2,3,4,5,6,7 -o t2label

By following the steps mentioned above you should be able to see the following screen:

Let me know if there is something I’m missing in order to reproduce your error.

Her is a link to the bejing course with more detail on the installation and usage OSF

Doing some further research some possible solutions to your problem would be doing the following.

Run: ldd /usr/lib/qt/plugins/platforms/libqxcb.so

if that doesn’t work, try,

sudo ln -sf /usr/lib/x86_64-linux-gnu/qt5/plugins/platforms/ /usr/bin/

Resources

  1. https://forum.qt.io/topic/93247/qt-qpa-plugin-could-not-load-the-qt-platform-plugin-xcb-in-even-though-it-was-found/9
  2. https://stackoverflow.com/questions/17106315/failed-to-load-platform-plugin-xcb-while-launching-qt5-app-on-linux-without
  3. https://askubuntu.com/questions/308128/failed-to-load-platform-plugin-xcb-while-launching-qt5-app-on-linux-without

I installed SCT in the my local folder on the server and I do not have root access to change any settings. Is that the reason for the error? I have to ask administrators to help me investigate this.

Thanks

Yazhuo

@gmotzespina can you please try to reproduce the error, by installing SCT on a CentOS7 image via Docker, without root access. Note: default Docker image gives you root access so you will need to run without root access.

Some info: to pull centos image and to run without root access.

1 Like

When trying to reproduce your error I came up with this error first:

--
Spinal Cord Toolbox (git-master-22f44e7316e75517ac3f056147ceb9db58e0c331)

Traceback (most recent call last):
  File "/sct/scripts/sct_label_utils.py", line 828, in <module>
    main()
  File "/sct/scripts/sct_label_utils.py", line 818, in main
    processor.process(process_type)
  File "/sct/scripts/sct_label_utils.py", line 129, in process
    self.output_image = self.launch_sagittal_viewer(self.value)
  File "/sct/scripts/sct_label_utils.py", line 599, in launch_sagittal_viewer
    from spinalcordtoolbox.gui import base
  File "/sct/spinalcordtoolbox/gui/base.py", line 27, in <module>
    from PyQt5 import QtCore, QtGui, QtWidgets
ImportError: libGL.so.1: cannot open shared object file: No such file or directory

In order to fix this error I had to install an OpenGl library this way: yum install mesa-libGL after doing this I was able to reproduce your error, so now I’m getting:

--
Spinal Cord Toolbox (git-master-22f44e7316e75517ac3f056147ceb9db58e0c331)

qt.qpa.plugin: Could not load the Qt platform plugin "xcb" in "" even though it was found.
This application failed to start because no Qt platform plugin could be initialized. Reinstalling the application may fix this problem.

Available platform plugins are: eglfs, linuxfb, minimal, minimalegl, offscreen, vnc, wayland-egl, wayland, wayland-xcomposite-egl, wayland-xcomposite-glx, webgl, xcb.

Aborted

I’m currently trying to find a solution to it.

Until now I’ve accessed the docker image witthout being a root user by doig the following:

  1. Create docker file
  2. Add the following:
##########################################
# Dockerfile to change from root to
# non-root privilege
###########################################
# Base image is CentOS
FROM centos:latest
# Add a new user "spinalcordtoolbox" with user id 8877
RUN yum -y install git bzip2 gcc wget which mesa-libGL unzip
RUN git clone https://github.com/neuropoly/spinalcordtoolbox.git sct
RUN cd sct &amp;&amp; yes | ./install_sct
RUN echo $PATH
RUN export PATH="/sct/bin:${PATH}"
RUN wget https://www.neuro.polymtl.ca/_media/downloads/sct/20190121_sct_course-london19.zip
RUN unzip 20190121_sct_course-london19.zip
RUN useradd -u 8877 spinalcordtoolbox
# Change to non-root privilege
USER spinalcordtoolbox
  1. Run: docker image build -t spinalcord . to build the image
  2. Run docker run -it spinalcord:latest to access the image.
  3. Run:
cd sct_course-london19/single_subject/data/t2
sct_label_utils -i t2.nii.gz -create-viewer 1,2,3,4,5,6,7 -o t2label

But now I get a permissions error:

Command-line usage error: Option -o no write permission for file t2label
Aborted...

If I run the command without -o , then I get the same error as when running the command being a root user:

[spinalcordtoolbox@4e6403b56129 t2]$ sct_label_utils -i t2.nii.gz -create-viewer 1,2,3,4,5,6,7  

--
Spinal Cord Toolbox (git-master-22f44e7316e75517ac3f056147ceb9db58e0c331)

generated new fontManager
qt.qpa.plugin: Could not load the Qt platform plugin "xcb" in "" even though it was found.
This application failed to start because no Qt platform plugin could be initialized. Reinstalling the application may fix this problem.

Available platform plugins are: eglfs, linuxfb, minimal, minimalegl, offscreen, vnc, wayland-egl, wayland, wayland-xcomposite-egl, wayland-xcomposite-glx, webgl, xcb.

So until now I guess the error dosen’t depend on the user’s type since the same error happens weather the user has root access or not.

I’ll dig further into this.

Hi @Yazhuo_Kong,

sorry for the delay, it took us a bit of time to debug this.

so, first of all, the fact the you are connecting with VNC should indeed solve the problem, although what I think is actually happening, is that you are connecting via VNC to a windows station, which is running SCT via a Dockerized solution. Is this indeed the case?

IF YES:

the problem is on the host station (the one you are connecting to via VNC): please follow the instructions here to do X forwarding via Xming.

IF NO:

there might be missing modules on your CentOS host. First thing to verify: are you able to get the display properly. To test this, please install xeyes (dummy software to test display):

yum install xeyes

Then run it:

xeyes

You should be able to see this at the top left corner of your VNC window:

Let us know how it goes,

I cannot install in as non-root user so I have to ask IT to help and haven’t been successful with that!
Sorry for the delay and will get back to you soon.
Joe

Hi Joe
You should be able to install without being root where you have write permission, e.g in your home folder: cd ~