Surf commands and singularity

Has anyone tried running the Surf commands in a singularity container? Whenever I try to run them in a singularity container, I get this message:

freeglut (SurfSmooth): failed to open display ''

I am using an older fmriprep singularity container to run the Surf commands.


What is the output of: -check_all

on that system?


I get this error:

  File "/usr/lib/afni/bin/", line 273
    print g_help_string
SyntaxError: Missing parentheses in call to 'print'. Did you mean print(g_help_string)?

I think it is because the system python is set to python3. Here is the output of afni --version:

Precompiled binary Debian-x86_64-1-gnu: Jun 12 2017 (Version Debian-16.2.07~dfsg.1-5~nd16.04+1)

I created my own singularity recipe for a proper system setup and to download the latest afni version. The Surf commands now print the help message without the original error.


That version of AFNI appears to be 5.5 years old. At that time, most Python programs in AFNI were written in Python 2.7. For a long time now, all Python programs in AFNI have been updated to run in both Python 2.7 and Python 3.* (the only exception is an older program, written by P Kundu and distributed within AFNI).

Regardless of Python version, there are so many updates to existing programs and much newer functionality to make use of that you should really update the version of AFNI you are using. Are you using precompiled binaries, or building on your own system (I’m guessing the latter, from the version info)?


I was using an fmriprep singularity image. I realized the version was old, so I built my own singularity container using @update.afni.binaries to install afni. This is the version I am using now:

Precompiled binary linux_ubuntu_16_64: Dec  2 2022 (Version AFNI_22.3.07 'Lucius Verus')

Here is the output of -check_all now:

-------------------------------- general ---------------------------------
architecture:         64bit ELF
cpu type:             x86_64
system:               Linux
release:              3.10.0-1160.15.2.el7.x86_64
version:              #1 SMP Wed Feb 3 15:06:38 UTC 2021
distribution:         Ubuntu 22.04.1 LTS
number of CPUs:       56
apparent login shell: bash
shell RC file:        .bashrc (exists)

--------------------- AFNI and related program tests ---------------------
which afni           : /opt/afni/afni
afni version         : Precompiled binary linux_ubuntu_16_64: Dec  2 2022 
                     : AFNI_22.3.07 'Lucius Verus'
AFNI_version.txt     : AFNI_22.3.07, linux_ubuntu_16_64, Dec 02 2022
which python         : /usr/local/miniconda/bin/python
python version       : 3.10.8
which R              : /usr/bin/R
R version            : R version 4.1.2 (2021-11-01) -- "Bird Hippie"
which tcsh           : /usr/bin/tcsh

instances of various programs found in PATH:
    afni    : 1   (/opt/afni/afni)
    R       : 1   (/usr/bin/R)
    python  : 1   (/usr/local/miniconda/bin/python3.10)
    python2 : 0 
    python3 : 2 

** have python3 but not python2

testing ability to start various programs...
    afni                 : success
    suma                 : success
    3dSkullStrip         : success      : success
    3dAllineate          : success
    3dRSFC               : success
    SurfMesh             : success
    3dClustSim           : success
    3dMVM                : success

checking for R packages...
    rPkgsInstall -pkgs ALL -check : FAILURE
        oo Warning: 
           These packages are not installed on the computer: phia!
        These packages are not installed on the computer: snow!
        These packages are not installed on the computer: paran!
        These packages are not installed on the computer: brms!

R RHOME : /usr/lib/R

checking for $HOME files...
    .afnirc                   : found
    .sumarc                   : missing
    .afni/help/all_progs.COMP : found

------------------------------ python libs -------------------------------
** failed to load module PyQt4
-- PyQt4 is no longer needed for an AFNI bootcamp

++ module loaded: matplotlib.pyplot
   module file : /usr/local/miniconda/lib/python3.10/site-packages/matplotlib/
   matplotlib version : 3.6.2

-------------------------------- env vars --------------------------------
PATH = /usr/local/miniconda/bin:/opt/workbench/bin_linux64:/opt/fsl-v6.0.6.1/share/fsl/bin:/opt/fsl-v6.0.6.1/share/fsl/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/opt/afni

LD_LIBRARY_PATH = /opt/workbench/lib_linux64::/.singularity.d/libs


------------------------------ data checks -------------------------------
data dir : missing AFNI_data6
data dir : missing AFNI_demos
data dir : missing suma_demo
data dir : missing afni_handouts
atlas    : found TT_N27+tlrc  under /opt/afni

------------------------------ OS specific -------------------------------
which apt-get        : /usr/bin/apt-get
apt-get version      : apt 2.4.8 (amd64)

have Ubuntu system: Ubuntu 22.04.1 LTS
have Ubuntu afni  : Precompiled binary linux_ubuntu_16_64: Dec  2 2022 

=========================  summary, please fix:  =========================
*  just be aware: login shell 'bash', but our code examples use 'tcsh'
*  missing R packages (see rPkgsInstall)
*  please run: "suma -update_env" for .sumarc
*  insufficient data for AFNI bootcamp
   (see "Prepare for Bootcamp" on install pages)

The update fixed the problem I was having.

Great, glad that updating sorted things out.

The R package failures will just affect some of the group analysis programs, and even then just a few of them (like RBA, likely). We can discuss more about those if that becomes a major issue.