AttributeError: 'list' object has no attribute 'get'

Hi,
I am trying to get dcm2bids to run through singularity on my remote supercomputer. I keep getting the same error and it makes no sense.

The supercomputer automatically binds everything when I run things through singularity. Here is what I am typing through the command line…

singularity run dcm2bids_latest.sif

I have also tried binding the files just in case something weird happened when I ran singularity.

within the dcm2bids container

dcm2bids -d /scratch/dicoms/dicom_folder/ -p 005 -c /scratch/config.json -o /scratch/bids_directory/

every time I run this, I get the following error…

AttributeError: ‘list’ object has no attribute 'get"

I think this is pertaining to my -d location. I have tried to change this to many different variations and still the same output. Could someone please help? I’ve recently update my version of dcm2bids and am wondering if there is a bug?

This directory does exist and I can access it within the container. I can’t for the life of me figure out what the issue is?

Hi,

Is that error message the full traceback? Are they any other clues as to what function or line the code is crashing in?

How does that work?

Are you able to test using python in a dedicated virtual environment? Is the singularity container the latest version?

Is that your full command? I do not know what the default run command is for the dcm2bids container, but what if you do singularity exec -e -B /DRIVE/TO/BIND dcm2bids_latest.sif dcm2bids $ARGS?

Best,
Steven

Continuing the discussion from AttributeError: 'list' object has no attribute 'get':

Hi Steven,

Firstly, thank you so much for your help. Here is the exact output when I run several variations of your command above. It looks like it is not accepting my -d argument? Every time I get “expected one argument” when I add the -I flag. -d is the location of my dicom scans.

The version of singularity is not the latest, but not too dated (singularity 3.7.2-3.e18). What obvious thing am I missing here?

Hi Steven,

Firstly, thank you so much for your help. Here is the exact output when I run several variations of your command above. It looks like it is not accepting my -d argument? Every time I get “expected one argument” when I add the -I flag. -d is the location of my dicom scans.

The version of singularity is not the latest, but not too dated (singularity 3.7.2-3.e18). What obvious thing am I missing here?

Hi,

Sorry this sounds frustrating. It would help to see the versions of the command that led to these errors.

Best,
Steven

Sure, here are some of the command versions I have tried. Not sure if the screenshot I included previously was clear enough.

singularity exec dcm2bids.sif dcm2bids -d /scratch/06952/jes6785/dicoms/a017 -p a017
-c /locationofconfig/config_2.json -o /locationofbidsdirectory/sourcedata/

singularity exec dcm2bids.sif dcm2bids -d /scratch/06952/jes6785/dicoms/a017/ -p a017
-c /locationofconfig/config_2.json -o /locationofbidsdirectory/sourcedata/

singularity exec -e dcm2bids_latest.sif dcm2bids -d /scratch/06952/jes6785/dicoms/a017 -p a017 -c /locationofconfig/config_2.json -o /locationofbidsdirectory/sourcedata/

singularity exec -B /scratch/06952/jes6785/dicoms/a017 -B /locationofconfig/config_2.json -B /locationofconfig/config_2.json dcm2bids_latest.sif dcm2bids -d /scratch/06952/jes6785/dicoms/a017 -p a017 -c /locationofconfig/config_2.json -o /locationofbidsdirectory/sourcedata/

Also tried…
singularity run dcm2bids_latest.sif (also tried binding the directories here)

Then in the container
dcm2bids -d /scratch/06952/jes6785/dicoms/a017/ -p a017 -c /locationofconfig/config_2.json -o /locationofbidsdirectory/sourcedata/

Same error no matter what. I also tried older version of dcm2bids and no change.

Are you referring to the first error in the screenshot (the fatal “could not open image” error), the unrecognized argument error in the screenshot, or the original error of this post?

If you look at the dcm2bids help documentation, you can see that -l should be proceeded by the desired debug level ({DEBUG,INFO,WARNING,ERROR,CRITICAL}).

Have you tried making a dedicated conda environment for dcm2bids?

If continuing down singulairty, it looks like you only need to bind /scratch since all relevant subfolders are contained with it.

singularity exec -e -B /scratch dcm2bids.sif dcm2bids $args

Hi Steven,
My bad about the -l command. I’ve updated but the error is still there. Is there any documentation on setting up a dedicated conda environment? I’ve not done this before.

This all seems weird to me, so I contacted our supercomputer IT to check that this issue wasn’t on our end. Long story short, it appears that the “there is an attribute error in the underlying python package”.

Here is the full response from our IT supercomputer people…
Hi Jen,

Thanks for providing the information. This is not quite what I expected, but I was able to run your container with some guessing. So, I did the following in a idev session under your account:

v320-001.ls6(933)$ ml tacc-singularity

v320-001.ls6(934)$ singularity exec /work/06953/jes6785/Containers/dcm2bids_latest.sif dcm2bids -d /scratch/06953/jes6785/NECTARY_DICOMS/ -o /scratch/06953/jes6785/Pre_Process_Test/sourcedata/ -c /scratch/06953/jes6785/NECTARY_DATA/code/config_2.json -p a017

ERROR: ld.so: object ‘/opt/apps/xalt/xalt/lib64/libxalt_init.so’ from LD_PRELOAD cannot be preloaded (cannot open shared object file): ignored.

INFO:dcm2bids.dcm2bids:— dcm2bids start —

INFO:dcm2bids.dcm2bids:OS:version: Linux-4.18.0-305.12.1.el8_4.x86_64-x86_64-with-glibc2.35

INFO:dcm2bids.dcm2bids:python:version: 3.10.4 (main, Apr 2 2022, 09:04:19) [GCC 11.2.0]

INFO:dcm2bids.dcm2bids:dcm2bids:version: 2.1.7

ERROR: ld.so: object ‘/opt/apps/xalt/xalt/lib64/libxalt_init.so’ from LD_PRELOAD cannot be preloaded (cannot open shared object file): ignored.

INFO:dcm2bids.dcm2bids:dcm2niix:version: v1.0.20201102

INFO:dcm2bids.dcm2bids:participant: sub-a017

INFO:dcm2bids.dcm2bids:session:

INFO:dcm2bids.dcm2bids:config: /scratch/06953/jes6785/NECTARY_DATA/code/config_2.json

INFO:dcm2bids.dcm2bids:BIDS directory: /scratch/06953/jes6785/Pre_Process_Test/sourcedata

Traceback (most recent call last):

File “/usr/local/bin/dcm2bids”, line 8, in

sys.exit(main())

File “/usr/local/lib/python3.10/dist-packages/dcm2bids/dcm2bids.py”, line 244, in main

return app.run()

File “/usr/local/lib/python3.10/dist-packages/dcm2bids/dcm2bids.py”, line 104, in run

self.config.get(“dcm2niixOptions”, DEFAULT.dcm2niixOptions),

AttributeError: ‘list’ object has no attribute ‘get’

v320-001.ls6(935)$ pwd

/scratch/06953/jes6785/NECTARY_DICOMS

As you can see, the run does error out due to an attribute error in the underlying python package. (note that the “ld.so” related error can be ignored, this is created by the xalt module and is irrelevant.) I do not see any error message about the argument though. Could you please verify and let me know if this is the issue? If so, I guess you will need to send this to the developer then.

Do you have Anaconda installed on your supercomputer?

When you have anaconda installed, you can create an environment by running

conda create -n dcm2bids -c conda-forge dcm2bids

then you can activate the environment with conda activate dcm2bids

Then you can run dcm2bids.

Ok, thanks. Just wondering if that is that the only solution to this problem? I am running dcm2bids off a supercomputer and I’d like it to run on other users computers. So, I could install anaconda, but this would probably be a big process and learning curve. Failing that, I may have to start over with another software program, I suppose.

You can open an issue on the Github repository and see if the devs can fix it if it is a software bug Issues · UNFmontreal/Dcm2Bids · GitHub

Thanks for all your help :slight_smile: Much appreciate it. Didn’t know I could do that