Hi all,
Last week I went to open afni to find that it had deleted itself off my computer. I hadn't done ANY computer updates recently (Mac M1), and it seems like AFNI had wiped itself off my computer completely. I attempted to reinstall twice, and on the second time it seemed OK - but still had some warnings come up (bootcamp data, other programs I don't use). I figured I was ok to proceed and would re-evaluate if I ran into other errors. Well... This week, I am trying to make/edit some masks using Brainnetome atlas. When I attempt to run 3dcalc, I get the following error:
I checked that the directory I'm in has the atlas (it does) and I ran @findAfniDsetPath, and all seems ok... Truly at a loss for what to do! Any guidance is appreciated.
Thanks,
Zsofi
Hi, Zsofi-
OK, I am not sure how AFNI might have gotten removed. Is it possible that a path variable might have changed, like in a ~/.zshrc
or ~/.profile
file or something, so that the location of the abin
directory got lost in the (re)shuffle?
Anyways, I will assume that you followed one of the relevant macOS instruction pages here for installing AFNI.
To check the current state of things, the best thing to see would be the output of the AFNI system check, if you could please copy+paste the text output by running:
afni_system_check.py -check_all
Another thing specifically about what you show in the current snapshot: the quotation marks look suspiciously like non-ASCII ones. Because it is a JPG, I can't copy+paste an investigate on my system from the posting, but that is something to check, esp. if you copy+pasted that command from some text file that might have rich formatting. I would try rerunning that command after deleting and manually typing a '
(note how this is vertical, not tilted) for each of those ticks around <41>
, so it looks more like '<41>'
.
--pt
ps: and for when you paste the afni_system_check.py output, here is some information about copy+pasting code chunks with formatting that might help here.
Here's output for system check - I ended up copying and pasting everything from terminal, I hope formatting is ok:
-------------------------------- general ---------------------------------
architecture: 64bit Mach-O
cpu type: arm64
system: Darwin
release: 24.0.0
version: Darwin Kernel Version 24.0.0: Mon Aug 12 20:49:48 PDT 2024; root:xnu-11215.1.10~2/RELEASE_ARM64_T8103
distribution: 15.0
number of CPUs: 8
user: zsofiacohen
apparent login shell: zsh
shell RC file: .zshrc (exists)
--------------------- AFNI and related program tests ---------------------
which afni : /Users/zsofiacohen/abin/afni
afni version : Precompiled binary macos_10.12_local: Jul 4 2025
: AFNI_25.2.03 'Gordian I'
AFNI_version.txt : AFNI_25.2.03, macos_10.12_local, Jul 04 2025, official
which python : /opt/homebrew/opt/python/libexec/bin/python
python version : 3.13.5
which R : /usr/local/bin/R
R version : R version 4.5.1 (aarch64-apple-darwin20)
instances of various programs found in PATH:
afni : 1 (/Users/zsofiacohen/abin/afni)
R : 1 (/Library/Frameworks/R.framework/Versions/4.5-arm64/Resources/bin/R)
python : 1 (/opt/homebrew/Cellar/python@3.13/3.13.5/Frameworks/Python.framework/Versions/3.13/bin/python3.13)
python2 : 0
python3 : 2
/opt/homebrew/Cellar/python@3.13/3.13.5/Frameworks/Python.framework/Versions/3.13/bin/python3.13
/usr/bin/python3
testing ability to start various programs...
afni : success
suma : success
3dSkullStrip : success
3dAllineate : success
3dRSFC : success
SurfMesh : success
3dClustSim : success
build_afni.py : success
uber_subject.py : success
3dMVM : FAILURE
Error in dyn.load(ll) :
unable to load shared object '/Users/zsofiacohen/abin/R_io.so':
dlopen(/Users/zsofiacohen/abin/R_io.so, 0x0006): tried: '/Users/zsofiacohen/abin/R_io.so' (mach-o file, but is an incompatible architecture (have 'x86_64', need 'arm64e' or 'arm64')), '/System/Volumes/Preboot/Cryptexes/OS/Users/zsofiacohen/abin/R_io.so' (no such file), '/Users/zsofiacohen/abin/R_io.so' (mach-o file, but is an incompatible architecture (have 'x86_64', need 'arm64e' or 'arm64'))
Calls: source ... withVisible -> eval -> eval -> set_R_io -> dyn.load
Execution halted
rPkgsInstall : FAILURE
Error in dyn.load(ll) :
unable to load shared object '/Users/zsofiacohen/abin/R_io.so':
dlopen(/Users/zsofiacohen/abin/R_io.so, 0x0006): tried: '/Users/zsofiacohen/abin/R_io.so' (mach-o file, but is an incompatible architecture (have 'x86_64', need 'arm64e' or 'arm64')), '/System/Volumes/Preboot/Cryptexes/OS/Users/zsofiacohen/abin/R_io.so' (no such file), '/Users/zsofiacohen/abin/R_io.so' (mach-o file, but is an incompatible architecture (have 'x86_64', need 'arm64e' or 'arm64'))
Calls: source ... withVisible -> eval -> eval -> set_R_io -> dyn.load
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
Error in dyn.load(ll) :
unable to load shared object '/Users/zsofiacohen/abin/R_io.so':
dlopen(/Users/zsofiacohen/abin/R_io.so, 0x0006): tried: '/Users/zsofiacohen/abin/R_io.so' (mach-o file, but is an incompatible architecture (have 'x86_64', need 'arm64e' or 'arm64')), '/System/Volumes/Preboot/Cryptexes/OS/Users/zsofiacohen/abin/R_io.so' (no such file), '/Users/zsofiacohen/abin/R_io.so' (mach-o file, but is an incompatible architecture (have 'x86_64', need 'arm64e' or 'arm64'))
Calls: source ... withVisible -> eval -> eval -> set_R_io -> dyn.load
Execution halted
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:/Users/zsofiacohen/abin:/opt/homebrew/opt/python/libexec/bin
PYTHONPATH =
R_LIBS = /Users/zsofiacohen/sw/R-4.3.1
LD_LIBRARY_PATH =
DYLD_LIBRARY_PATH (sub-shell) = :/opt/X11/lib/flat_namespace
DYLD_FALLBACK_LIBRARY_PATH (sub-shell) =
CONDA_SHLVL =
CONDA_DEFAULT_ENV =
CC =
HOMEBREW_PREFIX = /opt/homebrew
----------------------------- 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, flatdir, 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/zsofiacohen/abin
------------------------------ OS specific -------------------------------
XQuartz version : 2.8.5
which brew : /opt/homebrew/bin/brew
brew version : Homebrew 4.5.10
which git : /usr/bin/git
git version : git version 2.39.5 (Apple Git-154)
which gcc : /usr/bin/gcc
gcc version : Apple clang version 16.0.0 (clang-1600.0.26.6)
brew gcc(s) : /opt/homebrew/bin/gcc-15
CommandLineTools SDK : MacOSX15.2.sdk
++ found 1 dylib files under '/opt/X11/lib/flat_namespace'
-- found 'libXt' dylib files:
/opt/X11/lib/flat_namespace/libXt.6.dylib
-- recent OS X, cheating to check DYLD_LIBRARY_PATH in cur shell 'zsh'...
++ found evar DYLD_LIBRARY_PATH = :/opt/X11/lib/flat_namespace
-- recent OS X, cheating to check DYLD_LIBRARY_PATH in shell 'tcsh'...
++ found evar DYLD_LIBRARY_PATH = /opt/X11/lib/flat_namespace:/opt/X11/lib/flat_namespace:/opt/X11/lib/flat_namespace
========================= summary, please fix: =========================
* just be aware: login shell 'zsh', but our code examples use 'tcsh'
* have ARM cpu, but Intel AFNI binaries
- consider online install instructions for local build, or more directly:
build_afni.py -build_root ~/afni_build -package macos_13_ARM
* 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)
zsofiacohen@MacBookPro ~ %
Hi, Zsofi-
Thanks, and I wrapped the copy+pasted text block with trip backquotes:
```
.... text block
```
... so that the text would be code formatted, looking like:
.... text block
To the AFNI-specific stuff--- There are things noted in the "Please fix" section at the bottom. A couple pointers about items there:
- You are using a macOS with M1/ARM architecture, but you have installed AFNI for Intel chip. The instructions for M1/ARM architecture are here:
macOS 12+ (Apple Silicon/ARM processor/chip: M1, M2, …)
That will guide you through an installation where you compile the AFNI binaries locally, which will take a little while (like, 10-20 mins?). But that will be compatible with any R version, like your ver=4.5.1.
- It looks like you haven't installed any Python libraries used by AFNI. The easiest way to do that is using Miniconda. The AFNI Installation instructions above point you at the page we have for that, which is here.
Hope that is helpful.
--pt
Embarrassing - thanks for catching that! I got the M1 installation and am following along for Miniconda quick setup. I got to step 7 on the linked page and am stuck:
Downloading and Extracting Packages:
Preparing transaction: done
Verifying transaction: done
Executing transaction: done
#
# To activate this environment, use
#
# $ conda activate py39_afni_tiny
#
# To deactivate an active environment, use
#
# $ conda deactivate
(base) zsofiacohen@Psych-klk ~ % name: py3_afni_tiny # TO MAKE: conda env create -f env*_ex1.yml
dependencies:
- python
- "matplotlib>=2.2.3" # minimal ver for 'pythonic' APQC HTML
- numpy
- scipy
- "flask>=2.1.2" # for local server for APQC HTML
- "flask-cors>=3.0.10" # for local server for APQC HTML
zsh: no matches found: env*_ex1.yml
zsh: command not found: dependencies:
Python 3.13.5 | packaged by Anaconda, Inc. | (main, Jun 12 2025, 11:23:37) [Clang 14.0.6 ] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>>
No worries.
For the Miniconda, in step 7 you should download one of the files, and then execute a separate command. The file is also shown in the green text, but that is not what you copy+paste in the terminal. I believe you are aiming to use "environment_ex1.yml"---so rightclick on the blue+bold text there that is environment_ex1.yml and save it on your computer. Then go to the directory containing that file, and run the described conda ...
command, which I believe in this case would be:
conda env create -f environment_ex1.yml
How does that go?
--pt
Got it - so the file is in my current directory and it's still complaining:
**2 channel Terms of Service accepted**
EnvironmentFileNotFound: 'environment_ex1.yml' file not found
Hm. The first line is just an acknowledgment of accepting terms, so that is fine.
For the second line, can you go to the directory wtih that has the environment_ex1.yml
file, and verify that it exists by running:
ls environment_ex1.yml
... and not getting an error message.
Then, can you run this to display its contents:
cat environment_ex1.yml
... and verify that they are how they appear on the documentation pages, namely:
name: py3_afni_tiny # TO MAKE: conda env create -f env*_ex1.yml
dependencies:
- python
- "matplotlib>=2.2.3" # minimal ver for 'pythonic' APQC HTML
- numpy
- scipy
- "flask>=2.1.2" # for local server for APQC HTML
Then, can you run this:
conda env create -f environment_ex1.yml
... which should be valid, if conda exists and can run?
--pt
Hi, sorry for the delay! This is still giving an error. For whatever reason, my terminal can't find the ex1.yml file in any directory.
Hi-
Can you please copy+paste the output of these two commands:
- A:
\ls -l ex1.yml
- B:
cat ex1.yml
?
Thanks,
pt
\ls -l ex1.yml
ls: ex1.yml: No such file or directory
cat ex1.yml
cat: ex1.yml: No such file or directory
Howdy-
Ok, then it does not appear that that file actually exists there, hence it can't be used to load a conda environment from that directory location. Or it has a different name? I think the one we use is called environment_ex1.yml
(hence why the script uses the wildcarded form env*_ex1.yml
). Is that the issue here---a difference in file names? Can you please copy+paste the output of:
?
If that doesn't work to show the file exists and has the correct content, you will first have to find the specific file on your computer system. What operating system are you on? On a macOS, you could search for it with the Finder or Searchlight functionality. On a Linux computer you could try using the Files Application -> Search functionality. Or you might be able to try from a command line
locate FILE
... with the correct filename (though that latter command line one might require installing a separate program).
--pt
OK, I got to the bottom of that issue. Looks like my computer was adding a .txt to the file name. I ran C and D (with .txt) and got
\ls -l environment_ex1.yml.txt
-rw-r--r--@ 1 zsofiacohen staff 316 Aug 5 10:03 environment_ex1.yml.txt
cat environment_ex1.yml.txt
name: py3_afni_tiny # TO MAKE: conda env create -f env*_ex1.yml
dependencies:
- python
- "matplotlib>=2.2.3" # minimal ver for 'pythonic' APQC HTML
- numpy
- scipy
- "flask>=2.1.2" # for local server for APQC HTML
- "flask-cors>=3.0.10" # for local server for APQC HTML %
I renamed the .yml.txt files into just .yml and was able to finish setup. I successfully ran
conda activate py39_afni_tiny
and now checking systems...
afni_system_check.py -check_all
-------------------------------- general ---------------------------------
architecture: 64bit
cpu type: arm64
system: Darwin
release: 24.0.0
version: Darwin Kernel Version 24.0.0: Mon Aug 12 20:49:48 PDT 2024; root:xnu-11215.1.10~2/RELEASE_ARM64_T8103
distribution: 15.0
number of CPUs: 8
user: zsofiacohen
apparent login shell: zsh
shell RC file: .zshrc (exists)
--------------------- AFNI and related program tests ---------------------
which afni : /Users/zsofiacohen/abin/afni
afni version : Precompiled binary macos_10.12_local: Jul 4 2025
: AFNI_25.2.03 'Gordian I'
AFNI_version.txt : AFNI_25.2.03, macos_10.12_local, Jul 04 2025, official
which python : /Users/zsofiacohen/miniconda3/envs/py39_afni_tiny/bin/python
python version : 3.9.23
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/zsofiacohen/abin/afni)
R : 1 (/Library/Frameworks/R.framework/Versions/4.3-arm64/Resources/bin/R)
python : 2
/Users/zsofiacohen/miniconda3/envs/py39_afni_tiny/bin/python3.9
/opt/homebrew/Cellar/python@3.13/3.13.5/Frameworks/Python.framework/Versions/3.13/bin/python3.13
python2 : 0
python3 : 3
/Users/zsofiacohen/miniconda3/envs/py39_afni_tiny/bin/python3.9
/opt/homebrew/Cellar/python@3.13/3.13.5/Frameworks/Python.framework/Versions/3.13/bin/python3.13
/usr/bin/python3
testing ability to start various programs...
afni : success
suma : success
3dSkullStrip : success
3dAllineate : success
3dRSFC : success
SurfMesh : success
3dClustSim : success
build_afni.py : 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
rPkgsInstall : FAILURE
Error in dyn.load(ll) :
unable to load shared object '/Users/zsofiacohen/abin/R_io.so':
dlopen(/Users/zsofiacohen/abin/R_io.so, 0x0006): tried: '/Users/zsofiacohen/abin/R_io.so' (mach-o file, but is an incompatible architecture (have 'x86_64', need 'arm64e' or 'arm64')), '/System/Volumes/Preboot/Cryptexes/OS/Users/zsofiacohen/abin/R_io.so' (no such file), '/Users/zsofiacohen/abin/R_io.so' (mach-o file, but is an incompatible architecture (have 'x86_64', need 'arm64e' or 'arm64'))
Calls: source ... withVisible -> eval -> eval -> set_R_io -> dyn.load
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
Error in dyn.load(ll) :
unable to load shared object '/Users/zsofiacohen/abin/R_io.so':
dlopen(/Users/zsofiacohen/abin/R_io.so, 0x0006): tried: '/Users/zsofiacohen/abin/R_io.so' (mach-o file, but is an incompatible architecture (have 'x86_64', need 'arm64e' or 'arm64')), '/System/Volumes/Preboot/Cryptexes/OS/Users/zsofiacohen/abin/R_io.so' (no such file), '/Users/zsofiacohen/abin/R_io.so' (mach-o file, but is an incompatible architecture (have 'x86_64', need 'arm64e' or 'arm64'))
Calls: source ... withVisible -> eval -> eval -> set_R_io -> dyn.load
Execution halted
R RHOME : /Library/Frameworks/R.framework/Resources
------------------------------ python libs -------------------------------
Matplotlib is building the font cache; this may take a moment.
++ module loaded: matplotlib.pyplot
module file : /Users/zsofiacohen/miniconda3/envs/py39_afni_tiny/lib/python3.9/site-packages/matplotlib/pyplot.py
matplotlib version : 3.9.2
++ module loaded: flask
module file : /Users/zsofiacohen/miniconda3/envs/py39_afni_tiny/lib/python3.9/site-packages/flask/__init__.py
flask version : 3.1.0
++ module loaded: flask_cors
module file : /Users/zsofiacohen/miniconda3/envs/py39_afni_tiny/lib/python3.9/site-packages/flask_cors/__init__.py
flask_cors version : 5.0.0
-------------------------------- env vars --------------------------------
PATH = /Users/zsofiacohen/miniconda3/envs/py39_afni_tiny/bin:/Users/zsofiacohen/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:/opt/X11/bin:/Library/Apple/usr/bin:/Users/zsofiacohen/abin:/opt/homebrew/opt/python/libexec/bin:/opt/homebrew/opt/python/libexec/bin
PYTHONPATH =
R_LIBS = /Users/zsofiacohen/sw/R-4.3.1
LD_LIBRARY_PATH =
Looks like there are a couple errors for 3dMVM and Rpkgs.