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

NonGuiException when running visualqc_freesurfer #77

Open
jbramen opened this issue Aug 13, 2023 · 4 comments
Open

NonGuiException when running visualqc_freesurfer #77

jbramen opened this issue Aug 13, 2023 · 4 comments

Comments

@jbramen
Copy link

jbramen commented Aug 13, 2023

  • visualqc version: 0.6.7.dev2+g3b66e64 (also tried on 0.6.6)
  • Python version: 3.11.4
  • Operating System: Amazon Linux 2 (Linux-4.14.290-217.505.amzn2.x86_64-x86_64-with-glibc2.26)

Description

When I execute visualqc_freesurfer, it successfully opens the FreeView GUI a few times, but then returns an error.

What I Did

(venv) daniel@yoda:[~/vqc]: visualqc_freesurfer -f ~/vqc

Freesurfer QC module
Time stamp : 2023-08-13 10:19:42

version info: visualqc 0.6.7.dev2+g3b66e64
numpy 1.25.2 / scipy 1.11.1 / matplotlib 3.7.2
python 3.11.4 (main, Aug  6 2023, 09:08:03) [GCC 7.3.1 20180712 (Red Hat 7.3.1-15)]
platform Linux-4.14.290-217.505.amzn2.x86_64-x86_64-with-glibc2.26
#1 SMP Wed Aug 10 09:52:16 UTC 2022


	Linux distribution: {'NAME': 'Amazon Linux', 'ID': 'amzn', 'PRETTY_NAME': 'Amazon Linux 2', 'VERSION': '2', 'ID_LIKE': 'centos rhel fedora', 'VERSION_ID': '2', 'ANSI_COLOR': '0;33', 'CPE_NAME': 'cpe:2.3:o:amazon:amazon_linux:2', 'HOME_URL': 'https://amazonlinux.com/'}
/opt/visualqc/visualqc/utils.py:823: UserWarning: The following subjects do NOT have all the required files or some are empty - skipping them!
  warnings.warn('The following subjects do NOT have all the required files'
visualqc


The following files do not exist or empty: 
 /home/daniel/vqc/visualqc/mri/orig.mgz
/home/daniel/vqc/visualqc/mri/aparc+aseg.mgz 


1 subjects are usable for review.

Number of samples to review = 1 < 10:  insufficient for outlier detection, disabling it.

Input folder: /home/daniel/vqc
Output folder: /home/daniel/vqc/visualqc
outlier detection: disabled, as requested.

Attempting to generate surface visualizations of parcellation ...
Processing PREV_001_S1_T1_sag.nii

Restoring ratings from previous session(s), if they exist ..
To be reviewed : 1


Reviewing PREV_001_S1_T1_sag.nii
Traceback (most recent call last):
  File "/opt/visualqc/venv/bin/visualqc_freesurfer", line 8, in <module>
    sys.exit(main())
             ^^^^^^
  File "/opt/visualqc/visualqc/__freesurfer__.py", line 12, in main
    freesurfer.cli_run()
  File "/opt/visualqc/visualqc/freesurfer.py", line 1193, in cli_run
    wf.run()
  File "/opt/visualqc/visualqc/workflows.py", line 98, in run
    self.loop_through_units()
  File "/opt/visualqc/visualqc/workflows.py", line 271, in loop_through_units
    self.show_fig_and_wait()
  File "/opt/visualqc/visualqc/workflows.py", line 309, in show_fig_and_wait
    self.fig.canvas.manager.show()
  File "/opt/visualqc/venv/lib/python3.11/site-packages/matplotlib/backend_bases.py", line 2921, in show
    raise NonGuiException(
matplotlib.backend_bases.NonGuiException: Matplotlib is currently using agg, which is a non-GUI backend, so cannot show the figure.

@raamana
Copy link
Owner

raamana commented Aug 14, 2023

Hi Jennifer, thanks for opening the issues and sharing the details. As the log says:
Matplotlib is currently using agg, which is a non-GUI backend, so cannot show the figure.

it appears the issue is you don't have an X-server/display environment setup right? seeing keywords like amazon it seems you are trying to run VisualQC over the cloud? if so, you need to add flags to your command such as -X or -Y so they forward the GUI as well. That said, I highly recommend you download the Freesurfer outputs to locally and then run VisualQC, it would be much much faster and more reliable that way. See some helpful notes here:
https://raamana.github.io/visualqc/examples_freesurfer.html#generating-and-downloading-required-files-from-a-remote-ssh-server

if that doesn't help, let me know, with all the logs of errors you run into.

@raamana
Copy link
Owner

raamana commented Aug 21, 2023

Hi Jennifer @jbramen, did you make progress? it's fine if you haven't had a chance to look into this :)

@jbramen
Copy link
Author

jbramen commented Aug 23, 2023

This is actually running on a Amazon Linux 2 cloud machine with a MATE desktop, so I would think the GUI should work. I am running it through remote desktop, not over an SSH connection.

If you don't have any immediate ideas, I can try running some isolated tests with matplotlib outside of this application and see if I can narrow down any issues there.

@raamana
Copy link
Owner

raamana commented Aug 25, 2023

that's rather a special OS/setup that we are not familiar with at all TBH. We tested it extensively on CentOS, and Amazon Linux is supposed to be CentOS, but there might some differences in setup causing the issues. Is it possible for you to spin up a CentOS instance on your cloud server? that would be easiest solution for now.

Also, again, if it is possible for you I highly recommend you download the Freesurfer outputs to your local linux machine and then run VisualQC, it would be much much faster and more reliable that way. See some helpful notes here:
https://raamana.github.io/visualqc/examples_freesurfer.html#generating-and-downloading-required-files-from-a-remote-ssh-server

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

2 participants