Xvfb and matplotlib missing

Hi AFNI gurus,

Despite the build of AFNI seems successful if I may trust the log, I am struggling with the installation of AFNI due to problems with matplotlib and Xvfb. The summary & please fix text is quite clear, yet it seems I am unable to fix. I followed the installation instructions on 1. Installation and Background — AFNI, SUMA and FATCAT: v24.1.17. I use a MacBook Pro with M1 chip.

Any help is much appreciated.

-------------------------------- general ---------------------------------
architecture:         64bit 
cpu type:             arm
system:               Darwin
release:              23.5.0
version:              Darwin Kernel Version 23.5.0: Wed May  1 20:16:51 PDT 2024; root:xnu-10063.121.3~5/RELEASE_ARM64_T8103
distribution:         14.5
number of CPUs:       8
apparent login shell: tcsh
** have both .cshrc and .tcshrc, with former not applied
   (consider adding 'source $HOME/.cshrc' to $HOME/.tcshrc)
shell RC file:        .tcshrc (exists)

--------------------- AFNI and related program tests ---------------------
which afni           : /Users/jitka/abin/afni
afni version         : Precompiled binary macos_13_ARM_clang: Jun 10 2024 
                     : AFNI_24.1.17 'Publius Septimius Geta'
AFNI_version.txt     : AFNI_24.1.17, macos_13_ARM_clang, Jun 10 2024, build
which python         : /opt/homebrew/opt/python/libexec/bin/python
python version       : 3.12.3
which R              : /usr/local/bin/R
R version            : R version 4.3.1 (aarch64-apple-darwin20)

instances of various programs found in PATH:
    afni    : 1   (/Users/jitka/abin/afni)
    R       : 1   (/Library/Frameworks/R.framework/Versions/4.3-arm64/Resources/bin/R)
    python  : 1   (/opt/homebrew/Cellar/python@3.12/3.12.3/Frameworks/Python.framework/Versions/3.12/bin/python3.12)
    python2 : 0 
    python3 : 2 
      /opt/homebrew/Cellar/python@3.12/3.12.3/Frameworks/Python.framework/Versions/3.12/bin/python3.12
      /usr/bin/python3

** have python3 but not python2

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

------------------------ dependent program tests -------------------------
checking for dependent programs...

which tcsh           : /opt/homebrew/bin/tcsh
tcsh version         : 6.24.12
which Xvfb           :

checking for R packages...
    rPkgsInstall -pkgs ALL -check : success

R RHOME : /Library/Frameworks/R.framework/Resources

------------------------------ python libs -------------------------------

** failed to load module matplotlib.pyplot
-- matplotlib.pyplot is required

** failed to load module flask
-- flask is not required, but is desirable

** failed to load module flask_cors
-- flask_cors is not required, but is desirable

-------------------------------- env vars --------------------------------
PATH                       = /opt/homebrew/bin:/opt/homebrew/sbin:/usr/local/bin:/System/Cryptexes/App/usr/bin:/usr/bin:/bin:/usr/sbin:/sbin:/var/run/com.apple.security.cryptexd/codex.system/bootstrap/usr/local/bin:/var/run/com.apple.security.cryptexd/codex.system/bootstrap/usr/bin:/var/run/com.apple.security.cryptexd/codex.system/bootstrap/usr/appleinternal/bin:/Users/jitka/abin:/opt/homebrew/opt/python/libexec/bin:/opt/homebrew/opt/python/libexec/bin:/opt/homebrew/opt/python/libexec/bin:/opt/homebrew/opt/python/libexec/bin:/opt/homebrew/opt/python/libexec/bin

PYTHONPATH                 = 
R_LIBS                     = 
LD_LIBRARY_PATH            = 
DYLD_LIBRARY_PATH (sub-shell) = /opt/X11/lib/flat_namespace
DYLD_FALLBACK_LIBRARY_PATH (sub-shell) = 
CONDA_SHLVL                = 0
CONDA_DEFAULT_ENV          = 

----------------------------- eval dot files -----------------------------

----------- AFNI $HOME files -----------

    .afnirc                   : found
    .sumarc                   : found
    .afni/help/all_progs.COMP : found

--------- shell startup files ----------

   -- good: .cshrc seems to contain 'source .tcshrc'
   -- considered operations: path, apsearch
   
   -- note: followers should not need edits, so edit flags should be 0
      (have 1 follower(s), which can be ignored)
   
   no modifications needed across 2 dot files
   
------------------------------ 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 /Users/jitka/abin

------------------------------ OS specific -------------------------------
XQuartz version      : 2.8.5

which brew           : /opt/homebrew/bin/brew
brew version         : Homebrew 4.3.4

-- consider installing gcc under homebrew
-- consider installing glib under homebrew

=========================  summary, please fix:  =========================
*  have both .cshrc and .tcshrc, with former not applied
   (consider adding 'source $HOME/.cshrc' to $HOME/.tcshrc)
*  missing program: Xvfb
*  python library matplotlib is required
   (see AFNI install docs for details)
*  insufficient data for AFNI bootcamp
   (see "Prepare for Bootcamp" on install pages)

I ran into a problem like this recently where new version of numpy was incompatible with the matplotlib version and blocked its installation. In miniconda, you can work around this by specifying the version of numpy like this (tweaking one of our example configuration commands) :

conda create -y
-n py39_afni_tiny
python=3.9
"matplotlib>=2.2.3" numpy=1 scipy

Just to add to Daniel's comment---indeed, I can only think that using Conda/Miniconda/etc. on a macOS is quite helpful nowadays. To be honest, it might even be necessary, given some of the quirks+changes of the macOS package management.

Pages describing how to set up miniconda---which does not even require admin rights/passwords (yay!)---are here. We provide recipes that contain all necessary Python packages. If you have an existing miniconda environment you like+use, you could always just add whatever extra dependencies from this list to that, as well.

Please let us know if you have any questions.

--pt

Thank you both, this seems to solve the matplotlib issue. However, Xvfb is still missing. Do you have suggestions on how to solve that?

-------------------------------- general ---------------------------------
architecture:         64bit 
cpu type:             arm
system:               Darwin
release:              23.5.0
version:              Darwin Kernel Version 23.5.0: Wed May  1 20:16:51 PDT 2024; root:xnu-10063.121.3~5/RELEASE_ARM64_T8103
distribution:         14.5
number of CPUs:       8
apparent login shell: tcsh
** have both .cshrc and .tcshrc, with former not applied
   (consider adding 'source $HOME/.cshrc' to $HOME/.tcshrc)
shell RC file:        .tcshrc (exists)

--------------------- AFNI and related program tests ---------------------
which afni           : /Users/jitka/abin/afni
afni version         : Precompiled binary macos_13_ARM_clang: Jun 10 2024 
                     : AFNI_24.1.17 'Publius Septimius Geta'
AFNI_version.txt     : AFNI_24.1.17, macos_13_ARM_clang, Jun 10 2024, build
which python         : /Users/jitka/miniconda3/envs/py3_afni_tiny/bin/python
python version       : 3.12.3
which R              : /usr/local/bin/R
R version            : R version 4.3.1 (aarch64-apple-darwin20)

instances of various programs found in PATH:
    afni    : 1   (/Users/jitka/abin/afni)
    R       : 1   (/Library/Frameworks/R.framework/Versions/4.3-arm64/Resources/bin/R)
    python  : 2 
      /Users/jitka/miniconda3/envs/py3_afni_tiny/bin/python3.12
      /opt/homebrew/Cellar/python@3.12/3.12.3/Frameworks/Python.framework/Versions/3.12/bin/python3.12
    python2 : 0 
    python3 : 3 
      /Users/jitka/miniconda3/envs/py3_afni_tiny/bin/python3.12
      /opt/homebrew/Cellar/python@3.12/3.12.3/Frameworks/Python.framework/Versions/3.12/bin/python3.12
      /usr/bin/python3

** have python3 but not python2

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

------------------------ dependent program tests -------------------------
checking for dependent programs...

which tcsh           : /opt/homebrew/bin/tcsh
tcsh version         : 6.24.12
which Xvfb           :

checking for R packages...
    rPkgsInstall -pkgs ALL -check : success

R RHOME : /Library/Frameworks/R.framework/Resources

------------------------------ python libs -------------------------------

++ module loaded: matplotlib.pyplot
   module file : /Users/jitka/miniconda3/envs/py3_afni_tiny/lib/python3.12/site-packages/matplotlib/pyplot.py
   matplotlib version : 3.8.4

++ module loaded: flask
   module file : /Users/jitka/miniconda3/envs/py3_afni_tiny/lib/python3.12/site-packages/flask/__init__.py
   flask version : 3.0.3

++ module loaded: flask_cors
   module file : /Users/jitka/miniconda3/envs/py3_afni_tiny/lib/python3.12/site-packages/flask_cors/__init__.py
   flask_cors version : 3.0.10

-------------------------------- env vars --------------------------------
PATH                       = /Users/jitka/miniconda3/envs/py3_afni_tiny/bin:/Users/jitka/miniconda3/condabin:/opt/homebrew/bin:/opt/homebrew/sbin:/usr/local/bin:/System/Cryptexes/App/usr/bin:/usr/bin:/bin:/usr/sbin:/sbin:/var/run/com.apple.security.cryptexd/codex.system/bootstrap/usr/local/bin:/var/run/com.apple.security.cryptexd/codex.system/bootstrap/usr/bin:/var/run/com.apple.security.cryptexd/codex.system/bootstrap/usr/appleinternal/bin:/Users/jitka/abin:/opt/homebrew/opt/python/libexec/bin:/opt/homebrew/opt/python/libexec/bin:/opt/homebrew/opt/python/libexec/bin:/opt/homebrew/opt/python/libexec/bin:/opt/homebrew/opt/python/libexec/bin

PYTHONPATH                 = 
R_LIBS                     = 
LD_LIBRARY_PATH            = 
DYLD_LIBRARY_PATH (sub-shell) = /opt/X11/lib/flat_namespace
DYLD_FALLBACK_LIBRARY_PATH (sub-shell) = 
CONDA_SHLVL                = 1
CONDA_DEFAULT_ENV          = py3_afni_tiny

----------------------------- eval dot files -----------------------------

----------- AFNI $HOME files -----------

    .afnirc                   : found
    .sumarc                   : found
    .afni/help/all_progs.COMP : found

--------- shell startup files ----------

   -- good: .cshrc seems to contain 'source .tcshrc'
   -- considered operations: path, apsearch
   
   -- note: followers should not need edits, so edit flags should be 0
      (have 1 follower(s), which can be ignored)
   
   no modifications needed across 2 dot files
   
------------------------------ 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 /Users/jitka/abin

------------------------------ OS specific -------------------------------
XQuartz version      : 2.8.5

which brew           : /opt/homebrew/bin/brew
brew version         : Homebrew 4.3.4

-- consider installing gcc under homebrew
-- consider installing glib under homebrew

=========================  summary, please fix:  =========================
*  have both .cshrc and .tcshrc, with former not applied
   (consider adding 'source $HOME/.cshrc' to $HOME/.tcshrc)
*  missing program: Xvfb
*  insufficient data for AFNI bootcamp
   (see "Prepare for Bootcamp" on install pages)

Hi-

Your PATH in line 76 there does not include "/opt/X11/bin", even though the third installer script adds that to your path. I think this because the installer script puts that information for tcsh (which is your login shell) into the ~/.cshrc, and in your computer setup, the first "please fix" item states is not being sourced/read. That is, the shell is not aware of that information sitting there, and we have to tell it to read that ~/.cshrc file. If that is the case, it should be remediable.

Therefore, can you do this:

  • open up the following text file (afni_open -e .. will do that generically on any OS, if you have AFNI installed):
    afni_open -e ~/.tcshrc
    
  • go to the very start of the file (first line) and hit enter once or twice to push the content down, and copy+paste this there:
    source $HOME/.cshrc 
    
  • save and close the file you are editing.

If you open up a new terminal and run afni_system_check.py -check_all, does that still complain about Xvfb not being found?

--pt

When I do that, upon opening another terminal I receive the message [Process completed]. The terminal seems unusable, as I cannot type anything.

Screenshot 2024-06-11 at 14.14.27

Hm, OK. I will PM you about sending a tarball of dot-files to me to check.

--pt