Eddy_squad, second part

Summary of what happened:

Hello there, I tried posting on the FSL list but I’m not able to for some reason.

I have a bunch of topup/eddy preprocessed files with eddy_quad run on them successfully. I’ve also successfully run eddy_squad on those outputs to get group descriptive stats. Now I want to “update” the single subject quad runs so that the little stars appear within the violin plots, effectively pointing out where within the group a particular subject is found (see, e.g. Bastiani et al 2019 figs 2 and beyond).

At this final step eddy_squad seems to choke in the middle of processing the first subject. It leaves correct-looking “qc_tables_tmp.pdf” and “qc_tmp.pdf” files, but then errors out with:

eddy_squad --update squad/group_db.json squad/quad_list.txt
/wynton/protected/home/rad-wynton-only/storrisi/fsl/bin/eddy_squad:4: DeprecationWarning: pkg_resources is deprecated as an API. See [https://setuptools.pypa.io/en/latest/pkg_resources.html](https://urldefense.com/v3/__https://setuptools.pypa.io/en/latest/pkg_resources.html__;!!LQC6Cpwp!oedflVYqokwmxv8B5XwvH4awhj3t7fwDQhbiOifFaAWhOrfW0NUez8lbKEYfH_7hOuAVLblrBUjYxwFAeWV7yzlo7kk$)
import pkg_resources
Reading group database...
Group database imported.
Updating single subject reports...
Traceback (most recent call last):
File "/wynton/protected/home/rad-wynton-only/storrisi/fsl/bin/eddy_squad", line 39, in <module>
main(args.list, args.grouping, args.group_db, args.update, args.output_dir)
File "/wynton/protected/home/rad-wynton-only/storrisi/fsl/lib/python3.12/site-packages/eddy_qc/SQUAD/squad.py", line 146, in main
squad_update.main(db, sList, group, group_db)
File "/wynton/protected/home/rad-wynton-only/storrisi/fsl/lib/python3.12/site-packages/eddy_qc/SQUAD/squad_update.py", line 166, in main
file1 = PdfFileReader(line + '/qc_tables_tmp.pdf', 'rb')
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/wynton/protected/home/rad-wynton-only/storrisi/fsl/lib/python3.12/site-packages/PyPDF2/_reader.py", line 1974, in __init__
deprecation_with_replacement("PdfFileReader", "PdfReader", "3.0.0")
File "/wynton/protected/home/rad-wynton-only/storrisi/fsl/lib/python3.12/site-packages/PyPDF2/_utils.py", line 369, in deprecation_with_replacement
deprecation(DEPR_MSG_HAPPENED.format(old_name, removed_in, new_name))
File "/wynton/protected/home/rad-wynton-only/storrisi/fsl/lib/python3.12/site-packages/PyPDF2/_utils.py", line 351, in deprecation
raise DeprecationError(msg)
PyPDF2.errors.DeprecationError: PdfFileReader is deprecated and was removed in PyPDF2 3.0.0. Use PdfReader instead.

Command used (and if a helper script was used, a link to the helper script or the command generated):

eddy_squad --update squad/group_db.json squad/quad_list.txt

Version:

FSL ver 6.0.7.15

Environment (Docker, Singularity / Apptainer, custom installation):

i’m within a Conda environment on an HPC cluster. is PdfReader something i could add to my environment, should i do the teeny incremental FSL update to 6.0.7.16, or has this not been updated in eddy_squad itself?

thanks!

-Sam

Hi @stbmtx,

Have you tried changing the code in


File "/wynton/protected/home/rad-wynton-only/storrisi/fsl/lib/python3.12/site-packages/eddy_qc/SQUAD/squad_update.py", line 166, in main
file1 = PdfFileReader(line + '/qc_tables_tmp.pdf', 'rb')

To use the non-deprecated function?

Or you could try rolling back the PyPDF version to a point where that wasn’t deprecated.

Best,
Steven

Hi @stbmtx, it looks like the eddy_qc code needs to be updated due to changes in the pypdf library. We’ll get this fixed for a future FSL release, but this may take a month or two. In the meantime, you could try @Steven’s suggestion of hand-modifying the code, replacing PdfFileReader with PdfReader.

1 Like

hi there @Steven and @paulmccarthy

i’ve tried this and it broke a line later, i modified that, and it broke later, i modified that and it broke later, etc etc; you know the drill.

after about 6 of those i’ve decided we’ll just roll our own (pulling from the quad .jsons) and have more control over the situation.

looking forward to an updated FSL release and thank you so much for your responses

Hi @stbmtx,

Did you try rolling back PyPDF with the unaltered code? Perhaps using the latest 2.x.x?

Best,
Steven