Strange Error:

During preprocessing AFNI crashes (seems like it can’t find the python directory) but this error only occurs for a handful of our subjects. What might be the source of the problem and why is it not a consistent issue? Any input would be great appreciated.

3dbucket -prefix vr_base pb02.s8.r01.tshift+orig[2]
++ 3dbucket: AFNI version=AFNI_18.2.19 (Sep 27 2018) [64-bit] -anat2epi -anat t1_MPRAGE+orig -save_skullstrip -suffix _al_junk -epi vr_base+orig -epi_base 0 -epi_strip 3dAutomask -AddEdge -volreg off -tshift off
/usr/bin/env: ‘python’: No such file or directory

That actually suggests ‘python’ is not in your PATH. Is that possible?

  • rick

I don’t think that is the case I can talk to our system administrator but first I will try to run these subjects again. The strangest thing is that things ran fine for some subjects and not others. I don’t know how the python path could temporarily disappeared.

It is hard to guess how that might be happening, but it does look like /usr/bin/env complaining that there is no ‘python’ to run.
That is the first line of Is this in the context of an script?

  • rick

I’m new to AFNI and just installed it, but I’d like to add that I’m receiving a similar error: env: python: No such file or directory when using and even I think the issue may be that AFNI is looking for “python” when it should be looking for “python3”, because python3 is on usr/local/bin path in my case. Would appreciate any help


What is the output of: -check_all

? Can you please copy+paste the text here.


env: python: No such file or directory

So, yes, it looks like you don’t have Python at all on your computer then. I have never really seen this before, because most operating systems come with at least some Python in the path, to be used.

What is the output of A):

lsb_release -a

and B)

echo $PATH



I have python on my computer, I know this because I installed it. The problem, I believe, is that it’s called “python3” and not “python”.

lsb_release -a lends command not found, I’m on a new Mac with M1.
Output of echo $PATH:


Consider installing miniconda to manage python and other software for you. On my M1 Mac, I do have python installed by default in /usr/bin. It’s version 2.7.18 on a Mac with 12.2.1 (Monterey) that is just a symbolic link to the system library framework version. The instructions are shown below for conda.

% which python
dglen@Brians-MacBook-Air python_scripts % conda
% where python
% /usr/bin/python --version
Python 2.7.18
% ls -l /usr/bin/python
lrwxr-xr-x 1 root wheel 75 Feb 6 16:22 /usr/bin/python → …/…/System/Library/Frameworks/Python.framework/Versions/2.7/bin/python2.7
% file /usr/bin/python
/usr/bin/python: Mach-O universal binary with 2 architectures: [x86_64:Mach-O 64-bit executable x86_64] [arm64e:Mach-O 64-bit executable arm64e]
/usr/bin/python (for architecture x86_64): Mach-O 64-bit executable x86_64
/usr/bin/python (for architecture arm64e): Mach-O 64-bit executable arm64e

Solved, thank you!

What was your solution, may I ask?

Did you make your own symbolic link from /usr/local/bin/pyhton3 to /usr/local/bin/python?

This suggests that homebrew might not be putting any ‘python’ in the path dirs, but it is also strange for there to be no system python under /usr/bin.

To be sure:

  • What OS version are you running?
  • What it just view homebrew that you installed python?
  • Was anything special done for python in your case?


  • rick


I did not create a symlink because I didn’t want to disable SIP on my Mac. I’m using Monterey 12.3, and I downloaded python3 using the installer from the python website; I didn’t do anything with homebrew other than what was required for setting up AFNI. I downloaded miniconda and created a conda environment for AFNI. I was able to run after activating this environment, as described here:


Hi Rick,

I am sorry for the late reply my attention had to move away from this issue. I am using a Linux machine and I ran -check_all. I certainly have python on my machine. Below are excerpts from the output.

which python : /usr/bin/python
python version : 2.7.5

instances of various programs found in PATH:
afni : 1 (/usr/local/afni/bin/afni)
R : 1 (/usr/bin/R)
python : 1 (/usr/bin/python2.7)
python2 : 1 (/usr/bin/python2.7)
python3 : 1 (/usr/bin/python3.6)

Is there a context difference, meaning are you sometimes running under a conda environment?
One thing that is odd is that afni_system_check and invoke python in exactly the same way. So it is curious that runs well, but gives an error. There seems to be an environmental difference between how they are being run.

To be sure, what is the output from:

which python
python -V
/usr/bin/env python -V

And if you have a conda env, would you run the same commands from there?


  • rick