M1 install problems, at a pretty early level

HI AFNI gurus

My AFNI was working and then I tried updating and unfortunately got in a pickle trying to fix things... Right now it's looking not so great and I see a lot of seemingly relevant posts on here but I've tried many of the suggestions and they aren't working. Here's my afni_system_check output:

-------------------------------- general ---------------------------------
architecture: 64bit Mach-O
cpu type: arm64
system: Darwin
release: 23.2.0
version: Darwin Kernel Version 23.2.0: Wed Nov 15 21:53:18 PST 2023; root:xnu-10002.61.3~2/RELEASE_ARM64_T6000
distribution: 14.2.1
number of CPUs: 10
apparent login shell: zsh
shell RC file: .zshrc (exists)

--------------------- AFNI and related program tests ---------------------
which afni :
:
AFNI_version.txt : AFNI_24.3.03, anyos_text, Oct 17 2024, local
which python : /opt/homebrew/opt/python/libexec/bin/python
python version : 3.13.0
which R : /usr/local/bin/R
R version : R version 4.3.1 (aarch64-apple-darwin20)

instances of various programs found in PATH:
afni : 0
R : 1 (/Library/Frameworks/R.framework/Versions/4.3-arm64/Resources/bin/R)
python : 1 (/opt/homebrew/Cellar/python@3.13/3.13.0_1/Frameworks/Python.framework/Versions/3.13/bin/python3.13)
python2 : 0
python3 : 2
/opt/homebrew/Cellar/python@3.13/3.13.0_1/Frameworks/Python.framework/Versions/3.13/bin/python3.13
/usr/bin/python3

** have python3 but not python2

testing ability to start various programs...
afni : FAILURE
/bin/sh: afni: command not found
suma : FAILURE
/bin/sh: suma: command not found
3dSkullStrip : FAILURE
/bin/sh: 3dSkullStrip: command not found
3dAllineate : FAILURE
/bin/sh: 3dAllineate: command not found
3dRSFC : FAILURE
/bin/sh: 3dRSFC: command not found
SurfMesh : FAILURE
/bin/sh: SurfMesh: command not found
3dClustSim : FAILURE
/bin/sh: 3dClustSim: command not found
uber_subject.py : success
3dMVM : FAILURE
Error in library(data.table) : there is no package called ‘data.table’
Calls: source ... suppressPackageStartupMessages -> withCallingHandlers -> library
Execution halted

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

which tcsh : /bin/tcsh
tcsh version : 6.21.00
which Xvfb : /opt/X11/bin/Xvfb

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

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:/opt/X11/bin:/Library/Apple/usr/bin:/opt/homebrew/opt/python/libexec/bin:/Users/sergiogarcia/abin:/opt/homebrew/opt/python/libexec/bin

PYTHONPATH =
R_LIBS =
LD_LIBRARY_PATH =
DYLD_LIBRARY_PATH (sub-shell) =
DYLD_FALLBACK_LIBRARY_PATH (sub-shell) =
CONDA_SHLVL =
CONDA_DEFAULT_ENV =
CC =

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

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

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

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

-- good: .tcshrc seems to contain 'source .cshrc'
-- 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 3 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 : did not find TT_N27+tlrc

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

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

========================= summary, please fix: =========================

  • just be aware: login shell 'zsh', but our code examples use 'tcsh'
  • missing program: afni
  • failure under initial "AFNI and related program tests"
  • AFNI programs show FAILURE
  • missing R packages (see rPkgsInstall)
  • python library matplotlib is required
    (see AFNI install docs for details)
  • please run: apsearch -update_all_afni_help
  • insufficient data for AFNI bootcamp
    (see "Prepare for Bootcamp" on install pages)
  • possibly missing atlases
  • consider installing gcc under homebrew
  • consider installing glib under homebrew

and when i try compiling it breaks with this:

++ running: build_afni.py -build_root ~/afni_build -package macos_13_ARM_clang
build_afni.py -build_root /Users/sergiogarcia/afni_build -package macos_13_ARM_clang

-- current AFNI: AFNI_24.3.03, anyos_text, Oct 17 2024
-- cleaning old build root dir, /Users/sergiogarcia/afni_build
-- backing up dir build_src
-- preparing build_root dir, /Users/sergiogarcia/afni_build
-- have default git tag LAST_TAG, will checkout AFNI_24.3.03
-- checking out git tag AFNI_24.3.03
-- using repo branch (detached), tag AFNI_24.3.03
-- removing old atlas dir, prev/afni_atlases_dist
-- moving old atlas dir afni_atlases_dist to prev/afni_atlases_dist
-- downloading AFNI atlas package, afni_atlases_dist.tgz
-- unpacking atlas package, afni_atlases_dist
-- removing old NiiVue backup, prev/niivue_afni.umd.js
-- moving old niivue niivue_afni.umd.js to prev/niivue_afni.umd.js
-- downloading NiiVue, niivue_afni.umd.js

-- preparing to run 'make' build of package macos_13_ARM_clang
-- copying README files
-- copying other_builds/Makefile.macos_13_ARM_clang to Makefile
-- building make target 'itall'

-- consider monitoring the build in a separate window with:
cd /Users/sergiogarcia
tail -f /Users/sergiogarcia/afni_build/build_src/log_make.txt
# use ctrl-c to terminate 'tail' command (not the build)
++ building (please be patient)...
** error: failed run_cmd: make AFNI_WHOMADEIT=build itall >& log_make.txt
-- status: building FAILURE
see 'make' log file /Users/sergiogarcia/afni_build/build_src/log_make.txt
** error: tail from log_make.txt:

In file included from niml.h:5,
from niml_private.h:4,
from niml_b64.c:1:
/opt/homebrew/Cellar/gcc@13/13.3.0/lib/gcc/13/gcc/aarch64-apple-darwin23/13/include-fixed/stdio.h:78:10: fatal error: _stdio.h: No such file or directory
78 | #include <_stdio.h>
| ^~~~~~~~~~
compilation terminated.
make[1]: *** [niml_b64.o] Error 1
mv: rename .o to ../.o: No such file or directory
make: *** [niml_b64.o] Error 1

so sorry about this but can someone help? thank you!

Hello,

Perhaps your system has upgraded the CommandLineTools package, and it is now out of sync with homebrew's gcc.

You might try reinstalling either or both (which should be okay to do). The only danger I would expect in uninstalling gcc is that it might take other packages with it, meaning you might then have to try the install commands in OS_notes.macos_12_ARM_a_admin_pt1.zsh.

To reinstall CLT, use:

sudo rm -rf /Library/Developer/CommandLineTools
xcode-select --install

To reinstall gcc (since you might have 13 in addition to 14), try:

brew uninstall gcc@13
brew uninstall gcc
brew install gcc

Then try your same build_afni.py command again and let us know how it goes.

-rick

I followed the steps you previously mentioned and when I ran "tcsh OS_notes.macos_12_ARM_b_user.tcsh" again, I got a different error:

-- preparing to run 'make' build of package macos_13_ARM_clang
-- copying README files
-- copying other_builds/Makefile.macos_13_ARM_clang to Makefile
-- building make target 'itall'

-- consider monitoring the build in a separate window with:
cd /Users/sergiogarcia
tail -f /Users/sergiogarcia/afni_build/build_src/log_make.txt
# use ctrl-c to terminate 'tail' command (not the build)
++ building (please be patient)...
** error: failed run_cmd: make AFNI_WHOMADEIT=build itall >& log_make.txt
-- status: building FAILURE
see 'make' log file /Users/sergiogarcia/afni_build/build_src/log_make.txt
** error: tail from log_make.txt:

AFNI_version.h ;
echo "#undef AFNI_VERSION_PLATFORM" >> AFNI_version.h ;
echo '#define AFNI_VERSION_PLATFORM "'macos_13_ARM_clang'"'
AFNI_version.h ;
( cd niml/ ; make all 'CC=/opt/homebrew/bin/gcc-13 -arch arm64 -DDARWIN -DARM_M1 -O1 -m64 -Wall -Wno-deprecated-declarations -Wcomment -Wformat -DUSE_TRACING -DHAVE_XDBE -DDONT_USE_MCW_MALLOC ' ; /bin/mv -f *.o .. ; )
/opt/homebrew/bin/gcc-13 -arch arm64 -DDARWIN -DARM_M1 -O1 -m64 -Wall -Wno-deprecated-declarations -Wcomment -Wformat -DUSE_TRACING -DHAVE_XDBE -DDONT_USE_MCW_MALLOC -I../f2c -c niml_b64.c
make[1]: /opt/homebrew/bin/gcc-13: No such file or directory
make[1]: *** [niml_b64.o] Error 1
mv: rename .o to ../.o: No such file or directory
make: *** [niml_b64.o] Error 1


-- shell/system command history is in:
/Users/sergiogarcia/afni_build/hist_commands.txt

++ screen text history is in:
/Users/sergiogarcia/afni_build/hist_messages.txt

rehash
if ( ! 1 ) then
echo -- already have R_LIBS=/Users/sergiogarcia/sw/R-4.3.1
-- already have R_LIBS=/Users/sergiogarcia/sw/R-4.3.1
endif
if ( ! -d /Users/sergiogarcia/sw/R-4.3.1 ) then
echo -- already have directory /Users/sergiogarcia/sw/R-4.3.1
-- already have directory /Users/sergiogarcia/sw/R-4.3.1
endif
if ( -f /opt/X11/bin/Xvfb ) then
which Xvfb
if ( 0 ) then
echo -- already have Xvfb in PATH
-- already have Xvfb in PATH
endif
else
if ( ! -f ~/.afnirc ) then
if ( ! -f ~/.sumarc ) then
if ( ! -f ~/.afni/help/all_progs.COMP ) then
echo ++ running: apsearch -update_all_afni_help
++ running: apsearch -update_all_afni_help
apsearch -update_all_afni_help
apsearch: Command not found.

I think you should update your build_afni.py script before trying again. Please run:

@update.afni.binaries -prog_list build_afni.py

And let's just make sure that works, first.

  • rick

I think the problem is that my computer is not finding the command "apsearch":

sergiogarcia@Sergios-MacBook-Pro ~ % apsearch -update_all_afni_help
zsh: command not found: apsearch
sergiogarcia@Sergios-MacBook-Pro ~ % @update.afni.binaries -prog_list build_afni.py
-- running @update.afni.binaries version 3.26, September 19, 2024
-- no current AFNI package found in path...
-- install dir: using default ~/abin
-- any downloads will be from https://afni.nimh.nih.gov via curl -O -f

-- attempting to install package macos_10.12_local under
(including only 1 programs)
install dir: /Users/sergiogarcia/abin...
-- have install dir
++ working in new temp dir, .tmp.install
++ getting install prog: curl -O -f bin/misc/@update.afni.binaries ...
curl -O -f https://afni.nimh.nih.gov/pub/dist/bin/misc/@update.afni.binaries
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
100 59630 100 59630 0 0 112k 0 --:--:-- --:--:-- --:--:-- 112k
-- fixing lost permissions on @update.afni.binaries
++ using updated @update.afni.binaries, instead...

++ running: tcsh tmp.@update.afni.binaries -no_recur -prog_list build_afni.py
-- running tmp.@update.afni.binaries version 3.26, September 19, 2024
-- no current AFNI package found in path...
-- install dir: using default ~/abin
-- any downloads will be from https://afni.nimh.nih.gov via curl -O -f

-- attempting to install package macos_10.12_local under
(including only 1 programs)
install dir: /Users/sergiogarcia/abin...
-- have install dir
deleting old temporary directory...
++ working in new temp dir, .tmp.install
-- skipping update of tmp.@update.afni.binaries
++ downloading test file: curl -O -f macos_10.12_local/build_afni.py ...
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
100 80445 100 80445 0 0 156k 0 --:--:-- --:--:-- --:--:-- 156k
++ no update needed
...finished, removing temp version, tmp.@update.afni.binaries

I played with it a little more and reinstalled ggc13. The install command seems to have gotten past that point and ran thoroughly, although there seems to be a lot of missing files and "afni" on it's own does not open. Here is the output of "afni_system_check.py -check_all":

sergiogarcia@Sergios-MacBook-Pro ~ % afni_system_check.py -check_all
-------------------------------- general ---------------------------------
architecture: 64bit Mach-O
cpu type: arm64
system: Darwin
release: 23.2.0
version: Darwin Kernel Version 23.2.0: Wed Nov 15 21:53:18 PST 2023; root:xnu-10002.61.3~2/RELEASE_ARM64_T6000
distribution: 14.2.1
number of CPUs: 10
apparent login shell: zsh
shell RC file: .zshrc (exists)

--------------------- AFNI and related program tests ---------------------
which afni : /Users/sergiogarcia/abin/afni
afni version : Precompiled binary macos_13_ARM_clang: Oct 25 2024
: AFNI_24.3.04 'Elagabalus'
AFNI_version.txt : AFNI_24.3.04, macos_13_ARM_clang, Oct 25 2024, build
which python : /opt/homebrew/opt/python/libexec/bin/python
python version : 3.13.0
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/sergiogarcia/abin/afni)
R : 1 (/Library/Frameworks/R.framework/Versions/4.3-arm64/Resources/bin/R)
python : 1 (/opt/homebrew/Cellar/python@3.13/3.13.0_1/Frameworks/Python.framework/Versions/3.13/bin/python3.13)
python2 : 0
python3 : 2
/opt/homebrew/Cellar/python@3.13/3.13.0_1/Frameworks/Python.framework/Versions/3.13/bin/python3.13
/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 : FAILURE
Error in library(data.table) : there is no package called ‘data.table’
Calls: source ... suppressPackageStartupMessages -> withCallingHandlers -> library
Execution halted

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

which tcsh : /bin/tcsh
tcsh version : 6.21.00
which Xvfb : /opt/X11/bin/Xvfb

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

    oo Warning: 
       These packages are not installed on the computer: afex!
    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: lme4!
    These packages are not installed on the computer: lmerTest!
    These packages are not installed on the computer: gamm4!
    These packages are not installed on the computer: data.table!
    These packages are not installed on the computer: paran!
    These packages are not installed on the computer: psych!
    These packages are not installed on the computer: brms!
    These packages are not installed on the computer: corrplot!
    These packages are not installed on the computer: metafor!

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:/opt/X11/bin:/Library/Apple/usr/bin:/opt/homebrew/opt/python/libexec/bin:/Users/sergiogarcia/abin:/opt/homebrew/opt/python/libexec/bin

PYTHONPATH =
R_LIBS =
LD_LIBRARY_PATH =
DYLD_LIBRARY_PATH (sub-shell) =
DYLD_FALLBACK_LIBRARY_PATH (sub-shell) =
CONDA_SHLVL =
CONDA_DEFAULT_ENV =
CC =

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

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

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

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

-- good: .tcshrc seems to contain 'source .cshrc'
-- 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 3 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/sergiogarcia/abin

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

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

========================= summary, please fix: =========================

  • just be aware: login shell 'zsh', but our code examples use 'tcsh'
  • AFNI programs show FAILURE
  • missing R packages (see rPkgsInstall)
  • python library matplotlib is required
    (see AFNI install docs for details)
  • insufficient data for AFNI bootcamp
    (see "Prepare for Bootcamp" on install pages)
  • consider installing gcc under homebrew
  • consider installing glib under homebrew

The important part should have been getting the current build_afni.py before trying again, I don't think that gcc-13 is needed. But it is fine to do that. In any case, you look to be in good shape with the binaries now.

But I do not think you actually ran the user setup part of the instructions, as R_LIBS is not set. Is R_LIBS being set in your ~/.zshrc file? If not, it might be repetitive but simple to finish the steps from the instructions. So from steps_macOS_12_Silicon.html, go to Quick Setup part E:

tcsh OS_notes.macos_12_ARM_b_user.tcsh

If you do not have that file, get it from part A, the curl commands to download the scripts.

  • rick