Help getting MRIQC to start - first time user

Hi Folks!
We have tried installing MRIQC using an anaconda environment (python 3.11.5). The following environment variable for python 3.11.5 was set in advanced system settings (windows 11): C:\Users\hp\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.11_qbz5n2kfra8p0\LocalCache\local-packages\Python311\Scripts.
The installation went without any error, however, the ,mriqc throws up an error:
(newenv) C:\Users\hp>mriqc --version
Traceback (most recent call last):
File “”, line 198, in _run_module_as_main
File “”, line 88, in run_code
File "C:\Users\hp\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.11_qbz5n2kfra8p0\LocalCache\local-packages\Python311\Scripts\mriqc.exe_main
.py", line 7, in
File “C:\Users\hp\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.11_qbz5n2kfra8p0\LocalCache\local-packages\Python311\site-packages\mriqc\cli\run.py”, line 34, in main
from mriqc import config, messages
File “C:\Users\hp\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.11_qbz5n2kfra8p0\LocalCache\local-packages\Python311\site-packages\mriqc\config.py”, line 157, in
os.path.join(os.getenv(“HOME”), “.cache”, “templateflow”),
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File “”, line 108, in join
TypeError: expected str, bytes or os.PathLike object, not NoneType

the attachment is shown below

kindly provide your opinion on this issue.

Thanks and Regards
Himanshu

Hi @anshuhim20,

Is there a reason you are not using the containerized version (e.g., Docker or Singularity), which is recommended over installing via Anaconda?

How did you define the environment variable “HOME”? I am not sure if it is defined natively like in Mac and Linux.

Also, for future reference, there is a “Software Support” category on neurostars that is more suitable for posts like this, and when you put code in here, it helps for readability if you surround the text with tickmarks or use the </> button in the text editor

so the code looks nice like this

Best,
Steven

We tried with docker and singularity but it threw up errors on both the occasions. Therefore we installed Anaconda and activated a new environment by name “newenv”. For setting up the environment variable we used open System Properties > Advanced > Environment Variables, and under “User variables for,” click “New,” configure the new variable, pasted “C:\Users\hp\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.11_qbz5n2kfra8p0\LocalCache\local-packages\Python311\Scripts”
and click “OK.”

Hi @anshuhim20,

I would make a new post about the errors you are getting from containers in the Software Support category. And based on the error you are getting, you need to define the environment variable HOME.

Best,
Steven

Hi @Steven,
That is okay, however, is there a solution for my current error which uses Anaconda prompt in windows 11.
Rgds
Himanshu

Thanks for the idea, inclusion of HOME worked!
However we are unsure where exactly is this path required by MRIQC.
(newenv) C:\Users\hp>mriqc --version
MRIQC v23.1.0

After installation of MRIQC, we tried running it but got an empty result for our data as given below:
(newenv) C:\Users\hp>set HOME=C:\Users\hp\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.11_qbz5n2kfra8p0\LocalCache\local-packages\Python311\Scripts

(newenv) C:\Users\hp>mriqc D:\test_29 D:\test_29_output participant
usage: mriqc [-h] [–version] [-v] [–species {human,rat}]
[–participant-label PARTICIPANT_LABEL [PARTICIPANT_LABEL …]] [–session-id [SESSION_ID …]]
[–run-id [RUN_ID …]] [–task-id [TASK_ID …]] [-m [{T1w,T2w,bold,dwi} …]] [–dsname DSNAME]
[–bids-database-dir PATH] [–bids-database-wipe] [–nprocs NPROCS] [–omp-nthreads OMP_NTHREADS]
[–mem MEMORY_GB] [–testing] [-f] [–pdb] [-w WORK_DIR] [–verbose-reports] [–reports-only]
[–write-graph] [–dry-run] [–resource-monitor] [–use-plugin USE_PLUGIN] [–no-sub] [–email EMAIL]
[–webapi-url WEBAPI_URL] [–webapi-port WEBAPI_PORT] [–upload-strict] [–notrack] [–ants-float]
[–ants-settings ANTS_SETTINGS] [–fft-spikes-detector] [–fd_thres FD_THRES] [–deoblique] [–despike]
[–start-idx START_IDX] [–stop-idx STOP_IDX]
bids_dir output_dir {participant,group} [{participant,group} …]
mriqc: error: Querying BIDS dataset at <D:\test_29> got an empty result.
Please, check out your currently set filters:

*participant_label:
*session: None
*run: None
*task: None
*bids_type: (‘T1w’, ‘T2w’, ‘bold’, ‘dwi’)

When we used the Bids Validator (https://bids-standard.github.io/bids-validator/) to validate our dataset, it threw up 2 errors;

Error 1: [Code 32] DWI_MISSING_BVEC

Error 1: [Code 33] DWI_MISSING_BVAL

@Steven If these errors are reported somewhere else, please feel free to make a new post about these errors in the Software Support category.

Regards,
Himanshu

Hi @anshuhim20,

For future posts, please format your code text by surrounding it with tickmarks or use the </> button in the text editor

so the code looks nice like this

It is used to locate or download the templateflow cache, which contains many templates that BIDS apps use.

Please return the outputs of this directory, e.g., with the tree command.

Sounds like your DWI data are missing the bvec and bval files. Were dicoms converted to niftis with dcm2niix?

Best,
Steven

Thanks @Steven
Would be updating the contents of output directory with </>tree</> command
We have used dcm2bids which inturn uses dcm2niix for converting dicom to nifti.

Hi @anshuhim20,

Yes, please return the contents of tree on your input BIDS directory, so we can see why it is not working with MRIQC.

Also </> is a button in the text editor that will do the tickmark formatting for you.
image

Best,
Steven

Hi @Steven
Please find the input Bids directory using tree ;


C:\Users\hp>tree D:\test_30
Folder PATH listing for volume New Volume
Volume serial number is 1626-11F5
D:\TEST_30
├───header_json
└───sub-30
    └───ses-001
        ├───anat
        ├───dwi
        └───func

Regards,
Himanshu

Thanks,

That header_json file is not BIDS valid, so it may lead to errors. Can you also run tree such that we can see inside a subject folder?

Best,
Steven

Thanks @Steven,
we have kept header_json folder empty as per the sample data that we have come across. Could you please advise us on the contents of the header_json folder or if it is necessary?
We have also ran the validator on our input data containing the subject folder, dataset_description.json, participants.tsv and readme.txt file after excluding the header_json folder and the same errors remain.
Do you mean to run tree structure inside the subfolders (anat, func,dwi) instead of the subject folder, which is given below.

C:\Users\hp>tree D:\test_30
Folder PATH listing for volume New Volume
Volume serial number is 1626-11F5
D:\TEST_30
└───sub-30
└───ses-001
├───anat
├───dwi
└───func
Regards,
Himanshu

This folder is not a BIDS folder so it will probably only cause issues, but also do not know what kind of data you are keeping in there.

Yup!

Best,
Steven

Hi @Steven , Now though we were able to resolve the issue of bids validation after independently getting in touch with Dr Dianne Patterson @bids-maintenance]. Bids validator now does not throw error any more, However the MRIQC ended up again in empty result.
Kindly provide help on mriqc installation using an anaconda environment (python 3.11.5) because it is very difficult to install docker version on a windows system. I have no idea about the virtualbox; and how it works.
Thanks and Regards
Himanshu

Hi @anshuhim20,

Can you share the output of any logs output produced by MRIQC? And what kind of troubles do you run into with Docker?

Best,
Steven

Hi @Steven,

Please find the output of the docker version below:

C:\Users\hp>docker run -it nipreps/mriqc:latest --version
MRIQC v23.1.0

C:\Users\hp>docker run -it --rm -v D:/test_29_final2:/data:ro -v D:/test_29_output:/out nipreps/mriqc:latest /data /out participant --participant_label 29
231120-06:39:35,810 cli IMPORTANT:

    Running MRIQC version 23.1.0:
      * BIDS dataset path: /data.
      * Output folder: /out.
      * Analysis levels: ['participant'].

231120-06:39:47,545 cli WARNING:
         IMPORTANT: Anonymized quality metrics (IQMs) will be submitted to MRIQC's metrics repository. Submission of IQMs can be disabled using the ``--no-sub`` argument. Please visit https://mriqc.readthedocs.io/en/latest/dsa.html to revise MRIQC's Data Sharing Agreement.
231120-06:40:22,287 nipype.workflow WARNING:
         Storing result file without outputs
231120-06:40:22,287 nipype.workflow WARNING:
         [Node] Error on "mriqc_wf.dwiMRIQC.dwi_reference_wf.epi_merge" (/tmp/work/mriqc_wf/dwiMRIQC/dwi_reference_wf/_in_file_..data..sub-29..ses-001..dwi..sub-29_ses-001_acq-DTI_run-01_dwi.nii.gz/epi_merge)
231120-06:40:24,122 nipype.workflow ERROR:
         Node epi_merge.a0 failed to run on host ff7758b6a615.
231120-06:40:24,128 nipype.workflow ERROR:
         Saving crash info to /out/logs/crash-20231120-064024-root-epi_merge.a0-85ca863d-80f2-45a0-98b6-5e0109670366.txt
Traceback (most recent call last):
  File "/opt/conda/lib/python3.9/site-packages/mriqc/engine/plugin.py", line 60, in run_node
    result["result"] = node.run(updatehash=updatehash)
  File "/opt/conda/lib/python3.9/site-packages/nipype/pipeline/engine/nodes.py", line 527, in run
    result = self._run_interface(execute=True)
  File "/opt/conda/lib/python3.9/site-packages/nipype/pipeline/engine/nodes.py", line 645, in _run_interface
    return self._run_command(execute)
  File "/opt/conda/lib/python3.9/site-packages/nipype/pipeline/engine/nodes.py", line 771, in _run_command
    raise NodeExecutionError(msg)
nipype.pipeline.engine.nodes.NodeExecutionError: Exception raised while executing Node epi_merge.

Cmdline:
        echo Only one time point!
Stdout:

Stderr:

Traceback:
        Traceback (most recent call last):
          File "/opt/conda/lib/python3.9/site-packages/nipype/interfaces/base/core.py", line 397, in run
            runtime = self._run_interface(runtime)
          File "/opt/conda/lib/python3.9/site-packages/nipype/interfaces/base/core.py", line 752, in _run_interface
            raise IOError(
        OSError: No command "mri_robust_template" found on host ff7758b6a615. Please check that the corresponding package is installed.


Traceback (most recent call last):
  File "/opt/conda/bin/mriqc", line 8, in <module>
    sys.exit(main())
  File "/opt/conda/lib/python3.9/site-packages/mriqc/cli/run.py", line 168, in main
    mriqc_wf.run(**_plugin)
  File "/opt/conda/lib/python3.9/site-packages/nipype/pipeline/engine/workflows.py", line 638, in run
    runner.run(execgraph, updatehash=updatehash, config=self.config)
  File "/opt/conda/lib/python3.9/site-packages/mriqc/engine/plugin.py", line 184, in run
    self._clean_queue(jobid, graph, result=result)
  File "/opt/conda/lib/python3.9/site-packages/mriqc/engine/plugin.py", line 256, in _clean_queue
    raise RuntimeError("".join(result["traceback"]))
RuntimeError: Traceback (most recent call last):
  File "/opt/conda/lib/python3.9/site-packages/mriqc/engine/plugin.py", line 60, in run_node
    result["result"] = node.run(updatehash=updatehash)
  File "/opt/conda/lib/python3.9/site-packages/nipype/pipeline/engine/nodes.py", line 527, in run
    result = self._run_interface(execute=True)
  File "/opt/conda/lib/python3.9/site-packages/nipype/pipeline/engine/nodes.py", line 645, in _run_interface
    return self._run_command(execute)
  File "/opt/conda/lib/python3.9/site-packages/nipype/pipeline/engine/nodes.py", line 771, in _run_command
    raise NodeExecutionError(msg)
nipype.pipeline.engine.nodes.NodeExecutionError: Exception raised while executing Node epi_merge.

Cmdline:
        echo Only one time point!
Stdout:

Stderr:

Traceback:
        Traceback (most recent call last):
          File "/opt/conda/lib/python3.9/site-packages/nipype/interfaces/base/core.py", line 397, in run
            runtime = self._run_interface(runtime)
          File "/opt/conda/lib/python3.9/site-packages/nipype/interfaces/base/core.py", line 752, in _run_interface
            raise IOError(
        OSError: No command "mri_robust_template" found on host ff7758b6a615. Please check that the corresponding package is installed.

Thanks & Regards,
Himanshu

Hi @anshuhim20,

It doesn’t seem like you have any issue with installing docker, as you got it to run above. The error you encountered is a known one that will be fixed in the next release (see here: OSError: No command "mri_robust_template" found with MRIQC v 23.1.0 · Issue #1125 · nipreps/mriqc · GitHub). For the moment you could try using an earlier version (like 22.0.6). What logs do you see with your anaconda version?

1 Like