Can not run uber_subject.py with "failed to import PyQt4.QtGui"

Hi experts,

I am new to AFNI, and today I installed the latest version of AFNI on my MacBook Pro with Sonoma 14.1.2. All install process seems successful. However, when I run uber_suject.py, it failed with error messages "failed to import PyQt4.QtGui".

**** failed to import PyQt4.QtGui ****

PyQt4 must be installed to run the uber_subject.py GUI
--> see the output of: uber_subject.py -help_install

Then I tried uber_subject.py -help_install, and I install PyQt4 with " brew install pyqt". It seems successful as well. But it does not work. And I tried to modified PATH file to add "/sw/bin " or " setenv PYTHONPATH /usr/local/lib/python2.7/site-packages". Anyway, it does not work.

Here is my PATH file:

# >>> conda initialize >>>
# !! Contents within this block are managed by 'conda init' !!
__conda_setup="$('/Users/roger/miniconda3/bin/conda' 'shell.zsh' 'hook' 2> /dev/null)"
if [ $? -eq 0 ]; then
eval "$__conda_setup"
else
if [ -f "/Users/roger/miniconda3/etc/profile.d/conda.sh" ]; then
. "/Users/roger/miniconda3/etc/profile.d/conda.sh"
else
export PATH="/Users/roger/miniconda3/bin:$PATH"
fi
fi
unset __conda_setup

<<< conda initialize <<<
# I add the path here:
setenv PYTHONPATH /usr/local/lib/python2.7/site-packages
export PATH=${PATH}:/sw/bin

export PATH=${PATH}:/opt/homebrew/opt/python/libexec/bin
export PATH=${PATH}:/opt/homebrew/opt/python/libexec/bin

# -------------------------------------------------------
# for AFNI: auto-inserted by init_user_dotfiles.py

# add AFNI abin to PATH
export PATH=${PATH}:/Users/Roger/abin

# set up tab completion for AFNI programs
if [ -f $HOME/.afni/help/all_progs.COMP.zsh ]
then
autoload -U +X bashcompinit && bashcompinit
autoload -U +X compinit && compinit -I
&& source $HOME/.afni/help/all_progs.COMP.zsh
fi
# -------------------------------------------------------

export R_LIBS=/Users/roger/sw/R-4.3.1

Here is my afni_system_check.py -check_all output:

-------------------------------- general ---------------------------------
architecture: 64bit
cpu type: arm
system: Darwin
release: 23.1.0
version: Darwin Kernel Version 23.1.0: Mon Oct 9 21:27:24 PDT 2023; root:xnu-10002.41.9~6/RELEASE_ARM64_T6000
distribution: 14.1.2
number of CPUs: 10
apparent login shell: zsh
shell RC file: .zshrc (exists)

--------------------- AFNI and related program tests ---------------------
which afni : /Users/roger/abin/afni
afni version : Precompiled binary macos_13_ARM_clang: Dec 7 2023
: AFNI_23.3.10 'Septimius Severus'
AFNI_version.txt : AFNI_23.3.10, macos_13_ARM_clang, Dec 07 2023, build
which python : /Users/roger/miniconda3/envs/AFNI/bin/python
python version : 3.11.5
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/roger/abin/afni)
R : 1 (/Library/Frameworks/R.framework/Versions/4.3-arm64/Resources/bin/R)
python : 2
/Users/roger/miniconda3/envs/AFNI/bin/python3.11
/opt/homebrew/Cellar/python@3.11/3.11.6_1/Frameworks/Python.framework/Versions/3.11/bin/python3.11
python2 : 0
python3 : 3
/Users/roger/miniconda3/envs/AFNI/bin/python3.11
/opt/homebrew/Cellar/python@3.11/3.11.6_1/Frameworks/Python.framework/Versions/3.11/bin/python3.11
/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 : /bin/tcsh
which Xvfb : /opt/X11/bin/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/roger/miniconda3/envs/AFNI/lib/python3.11/site-packages/matplotlib/pyplot.py
matplotlib version : 3.8.0

++ module loaded: flask
module file : /Users/roger/miniconda3/envs/AFNI/lib/python3.11/site-packages/flask/init.py
flask version : 2.2.2

++ module loaded: flask_cors
module file : /Users/roger/miniconda3/envs/AFNI/lib/python3.11/site-packages/flask_cors/init.py
flask_cors version : 4.0.0

-------------------------------- env vars --------------------------------
PATH = /Users/roger/miniconda3/envs/AFNI/bin:/Users/roger/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:/sw/bin:/opt/homebrew/opt/python/libexec/bin:/opt/homebrew/opt/python/libexec/bin:/Users/roger/abin:/sw/bin:/opt/homebrew/opt/python/libexec/bin:/opt/homebrew/opt/python/libexec/bin:/Users/Roger/abin

PYTHONPATH =
R_LIBS = /Users/roger/sw/R-4.3.1

LD_LIBRARY_PATH =
DYLD_LIBRARY_PATH (sub-shell) =
DYLD_FALLBACK_LIBRARY_PATH (sub-shell) =

----------------------------- 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 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/Roger/abin

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

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

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

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

  • just be aware: login shell 'zsh', but our code examples use 'tcsh'
  • insufficient data for AFNI bootcamp
    (see "Prepare for Bootcamp" on install pages)

Could you please give me some solutions for this problem? Thanks a lot!

Best,
Roger

Hi, Roger-

That setup looks good---yay!---and the specific issue with uber_subject.py is that we don't use it anymore---potentially a reason for "boo!", but actually not so problematic.

Firstly, the PyQt4 in which it was written became obsolete/impossible to install in Python. But the reason we didn't move so swiftly to replace it with a like-for-like program (though we might some day) is twofold:

To note, uber_subject.py was simply a program with a popup form to help users instantiate options and build and afni_proc.py command. It is afni_proc.py that actually does all the work of building an FMRI processing script with your designated choices (and one that is commented, so you can check in detail about each step---no mysteries here!), which can then be executed to process your data. So, it is still possible to use afni_proc.py directly, even without the uber_subject.py pre-step.

  • afni_proc.py has a large number of possible options, and uber_subject.py only had access to a smaller subset of them; so, it wasn't as powerful as using afni_proc.py directly.

  • we have several starter examples for different afni_proc.py commands in different scenarios in the help docs, and these tend to be more useful starting points than building up something totally from scratch---we can describe why different options exist and why.

    • There are also a growing set of example afni_proc.py commands within full paper context in the AFNI Codex, i.e., the Code Example section of the docs. Within each link, there are further descriptions of the paper itself and then either full scripts embedded in those pages or things like GitHub repositories that have been linked to. For example, here is the afni_proc.py script used in Reynolds et al. description of how to do QC in AFNI, with comments on why certain options are used. You can start with an example like that, and built outward, changing options as you see appropriate (there is also a task example in the same study).
  • it is easier for users to interact with us and other users for comments on code by simply posting the afni_proc.py command they are building here---if you are describing an issue with uber_subject.py, since that is a GUI, it is harder to describe. If you copy+paste your afni_proc.py-in-progress command here, we can easily comment, discuss, etc.

How does that sound?

--pt

1 Like

Hi Ptaylor,

Thank you for your detailed reply. I have had a cold these days, and I am sorry to read your reply today. I have found the examples and help docs you provided. As you said, I also think it is a good way to study and process fMRI data with AFNI_proc.py commands. I will try it. Thank you again!

Yours,
Roger