how to use mriqc_clf in docker

627 views
Skip to first unread message

wenq...@gmail.com

unread,
May 22, 2017, 6:48:09 PM5/22/17
to mriqc-users
Hi, all,

I am new to MRIQC and I am working with docker in Windows, while I got results from Mriqc, I have no idea how to run mriqc_clf in windows, please give me any hints at you convenient time!

Many thanks,
Renjie

Oscar Esteban

unread,
May 25, 2017, 12:17:02 PM5/25/17
to wenq...@gmail.com, mriqc-users
Dear Renjie,

Thanks for using MRIQC. Let me paste here the error you sent me over email:

Here is the error I got:
user@uot-ws MINGW64 ~
$ mriqc_clf --load-classifier -X T1w.csv -o outputs\mypredictionsT1w.csv
2017-05-23 11:27:00,798 duecredit:ERROR Failed to import duecredit due to No mod
ule named 'duecredit'
Traceback (most recent call last):
  File "c:\programdata\anaconda3\lib\runpy.py", line 193, in _run_module_as_main
    "__main__", mod_spec)
  File "c:\programdata\anaconda3\lib\runpy.py", line 85, in _run_code
    exec(code, run_globals)
  File "C:\ProgramData\Anaconda3\Scripts\mriqc_clf.exe\__main__.py", line 9, in
<module>
  File "c:\programdata\anaconda3\lib\site-packages\mriqc\bin\mriqc_clf.py", line
 106, in main
    rate_label='rate')
  File "c:\programdata\anaconda3\lib\site-packages\mriqc\classifier\cv.py", line
 282, in __init__
    raise RuntimeError('Either load_clf or X & Y should be supplied')
RuntimeError: Either load_clf or X & Y should be supplied

First of all, I'd like to point out that we found several important issues in the classifier that led us to remove the classifier from mriqc until it is well tested. That happened in with version 0.9.3 and we hope we can "officially" re-include it in version 0.9.6.

That said, there are a couple of problems with the command line:

1. I just filed a bug you found with your command line (https://github.com/poldracklab/mriqc/issues/521)

2. The pre-trained classifier was stored with Python 2, so there are chances that it won't load correctly in your Python 3 environment. Since 0.9.4, MRIQC stopped supporting Python 2.

For the time being, and until 0.9.6 sees the light, you can play around mriqc_clf providing a path for --load-classifier:

mriqc_clf --load-classifier c:\programdata\anaconda3\lib\site-packages\mriqc\data\rfc-nzs-full-1.0.pklz -X T1w.csv -o outputs\mypredictionsT1w.csv


HTH

All the best,
Oscar



--
You received this message because you are subscribed to the Google Groups "mriqc-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to mriqc-users+unsubscribe@googlegroups.com.
To post to this group, send email to mriqc...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/mriqc-users/33cf78a0-a5e8-4ade-a2d7-3be391a4d8e4%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.



--
___________________________
Oscar Esteban, Ph.D.
Postdoctoral Fellow, Poldrack Lab
Stanford University

antoni...@gmail.com

unread,
Aug 16, 2017, 4:37:49 PM8/16/17
to mriqc-users, wenq...@gmail.com
Hello,

I am also running mriqc (v0.9.6) using docker on a Mac and would like to try mriqc_clf. I would appreciate it if you could please translate the first command on the documentation, i.e.

mriqc_clf --load-classifier -X aMRIQC.csv -o mypredictions.csv

to something that docker would understand.

Thanks!

Antonio
To unsubscribe from this group and stop receiving emails from it, send an email to mriqc-users...@googlegroups.com.

To post to this group, send email to mriqc...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/mriqc-users/33cf78a0-a5e8-4ade-a2d7-3be391a4d8e4%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Oscar Esteban

unread,
Aug 16, 2017, 4:44:10 PM8/16/17
to antoni...@gmail.com, mriqc-users
docker run -v $PWD:/scratch -w /scratch --entrypoint=mriqc_clf poldracklab/mriqc:0.9.6 --load-classifier -X aMRIQC.csv -o mypredictions.csv

Basically, I'm addressing two issues:
  • Instruct docker to run a different binary (mriqc_clf) rather than the default (mriqc) with --entrypoint=mriqc_clf
  • Provide a folder to communicate data into the container (the aMRIQC.csv file) and off the container (the final result mypredictions.csv). That is done with -v $PWD:/scratch. Then the working directory is changed to /scratch (the -w /scratch bit) to read aMRIQC.csv and write mypredictions.csv


To unsubscribe from this group and stop receiving emails from it, send an email to mriqc-users+unsubscribe@googlegroups.com.

To post to this group, send email to mriqc...@googlegroups.com.

For more options, visit https://groups.google.com/d/optout.

Oscar Esteban

unread,
Aug 16, 2017, 5:16:29 PM8/16/17
to Antonio Algaze, mriqc-users
Is the T1w.csv file in your current working directory?

If so, the command should have worked out replacing aMRIQC.csv with T1w.csv.

You can do:
docker run -v $PWD:/scratch -w /scratch --entrypoint=ls poldracklab/mriqc:0.9.6

to check what you see in the /scratch 
directory, which should be exactly as doing ls outside the container.

On Wed, Aug 16, 2017 at 4:10 PM, Antonio Algaze <antoni...@gmail.com> wrote:
Thanks for your reply. I tried your suggested command and am getting an error complaining that the T1w.csv file does not exist (FileNotFoundError: File b'T1w.csv' does not exist)

I tried two things that gave me the same error.

- pointing to the T1w.csv using its absolute path instead of the aMRIQC.csv in the command you sent

- creating a /scratch directory in the $PWD directory and placing the T1w.csv file inside

Any suggestions as to what I need to correct?

Thanks again.

Antonio Algaze

unread,
Aug 16, 2017, 5:20:42 PM8/16/17
to Oscar Esteban, mriqc-users
I put T1w.csv on the current working directory and it ran.

I appreciate the help.

Thanks!
Message has been deleted

Nicolas Farrugia

unread,
Feb 28, 2021, 4:06:03 AM2/28/21
to mriqc-users
Hi everyone,

It seems the "-o" option does not exist anymore in MRIQC version 0.16.1. 

In order to get the csv file, one has to mount the /tmp container path locally.




--
___________________________
Oscar Esteban, Ph.D.
Postdoctoral Fellow, Poldrack Lab
Stanford University

Na Zhou

unread,
Jan 10, 2022, 12:59:43 AM1/10/22
to mriqc-users
Hi,
I am running the latest version of mriqc (21.0.0rc2), and are trying mriqc_clf on singularity.
I've tried the following command, but it didn't work.

command: $ singularity exec $IMG mriqc_clf --load-classifier -X $T1
 Error:
Traceback (most recent call last): 
  File "/opt/conda/bin/mriqc_clf", line 8, in <module>
    sys.exit(main())
  File "/opt/conda/lib/python3.8/site-packages/mriqc/bin/mriqc_clf.py", line 303, in main
    cv_helper = CVHelper(
  File "/opt/conda/lib/python3.8/site-packages/mriqc/classifier/helper.py", line 200, in __init__
    self.load(load_clf)
  File "/opt/conda/lib/python3.8/site-packages/mriqc/classifier/helper.py", line 716, in load
     from sklearn.externals.joblib import load as loadpkl
  ModuleNotFoundError: No module named 'sklearn.externals.joblib'  

and if I replace exec with run in the command line, I get "mriqc: error: Path does not exist: <mriqc_clf>."




Please give me some advice.

Many Thanks!
Na
To unsubscribe from this group and stop receiving emails from it, send an email to mriqc-users...@googlegroups.com.

To post to this group, send email to mriqc...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/mriqc-users/33cf78a0-a5e8-4ade-a2d7-3be391a4d8e4%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Andrew Sun

unread,
Jan 15, 2022, 4:44:36 PM1/15/22
to mriqc-users
Hi all, 

I am running into the same issue as Na, except with docker.

command:
docker run -v $PWD:/scratch -w /scratch --entrypoint=mriqc_clf nipreps/mriqc:21.0.0rc2 --load-classifier -X group_T1w.tsv 

error:
Traceback (most recent call last): File "/opt/conda/bin/mriqc_clf", line 8, in <module> sys.exit(main()) File "/opt/conda/lib/python3.8/site-packages/mriqc/bin/mriqc_clf.py", line 303, in main cv_helper = CVHelper( File "/opt/conda/lib/python3.8/site-packages/mriqc/classifier/helper.py", line 200, in __init__ self.load(load_clf) File "/opt/conda/lib/python3.8/site-packages/mriqc/classifier/helper.py", line 716, in load from sklearn.externals.joblib import load as loadpkl ModuleNotFoundError: No module named 'sklearn.externals.joblib'  

Best wishes,
Andrew

Hasnae Ag

unread,
Jan 31, 2022, 10:01:52 AM1/31/22
to mriqc-users
Hi, 
I have the same issue as Na Zhou, I am running the latest version of mriqc (21.0.0rc2), and am trying mriqc_clf on singularity. I am using this command line :  
        cmd="srun singularity run \
        ${MRIQC_SINGULARITY_IMG} \
        mriqc_clf --load-classifier \
        -X /paths/to/derviatives /group_T1w.tsv"


Thanks in advance!

Wenjun Huang

unread,
Mar 22, 2022, 10:18:10 AM3/22/22
to mriqc-users
Hi,

I am running the latest version of mriqc (21.0.0rc2), and are trying mriqc_clf on docker.
I've tried the following command:

docker run -v $PWD:/scratch -w /scratch --entrypoint=mriqc_clf nipreps/mriqc:21.0.0rc2 --load-classifier -X group_T1w_copy.tsv

But it didn't work.

Error:
Traceback (most recent call last):
File "/opt/conda/bin/mriqc_clf", line 8, in

sys.exit(main())
File "/opt/conda/lib/python3.8/site-packages/mriqc/bin/mriqc_clf.py", line 303, in main
cv_helper = CVHelper(

File "/opt/conda/lib/python3.8/site-packages/mriqc/classifier/helper.py", line 200, in init


self.load(load_clf)
File "/opt/conda/lib/python3.8/site-packages/mriqc/classifier/helper.py", line 716, in load
from sklearn.externals.joblib import load as loadpkl
ModuleNotFoundError: No module named 'sklearn.externals.joblib'

and I tried command: from sklearn.externals import joblib on spyder, and did't get any errors.





And I installed mriqc on a Python 3 environment and ran 'mriqc_clf --load-classifier -X group_T1w.tsv'

it didn't work o(╥﹏╥)o

Error:

Traceback (most recent call last):

  File "/home/lipalab/anaconda3/bin/mriqc_clf", line 8, in <module>
    sys.exit(main())
  File "/home/lipalab/anaconda3/lib/python3.8/site-packages/mriqc/bin/mriqc_clf.py", line 241, in main
    cvhelper = CVHelper(
  File "/home/lipalab/anaconda3/lib/python3.8/site-packages/mriqc/classifier/helper.py", line 184, in __init__
    self.load(load_clf)
  File "/home/lipalab/anaconda3/lib/python3.8/site-packages/mriqc/classifier/helper.py", line 705, in load
    self._estimator = loadpkl(filehandler)
  File "/home/lipalab/anaconda3/lib/python3.8/site-packages/sklearn/externals/joblib/numpy_pickle.py", line 585, in load
    obj = _unpickle(fobj, filename, mmap_mode)
  File "/home/lipalab/anaconda3/lib/python3.8/site-packages/sklearn/externals/joblib/numpy_pickle.py", line 504, in _unpickle
    obj = unpickler.load()
  File "/home/lipalab/anaconda3/lib/python3.8/pickle.py", line 1210, in load
    dispatch[key[0]](self)
  File "/home/lipalab/anaconda3/lib/python3.8/pickle.py", line 1526, in load_global
    klass = self.find_class(module, name)
  File "/home/lipalab/anaconda3/lib/python3.8/pickle.py", line 1577, in find_class
    __import__(module, level=0)
  File "/home/lipalab/anaconda3/lib/python3.8/site-packages/mriqc/classifier/sklearn/__init__.py", line 5, in <module>
    from .cv_nested import ModelAndGridSearchCV
  File "/home/lipalab/anaconda3/lib/python3.8/site-packages/mriqc/classifier/sklearn/cv_nested.py", line 34, in <module>
    from sklearn.model_selection._validation import (
ImportError: cannot import name '_index_param_value' from 'sklearn.model_selection._validation' (/home/lipalab/anaconda3/lib/python3.8/site-packages/sklearn/model_selection/_validation.py)



Please give me some advice.

Many Thanks!


Oscar Esteban

unread,
Mar 24, 2022, 6:55:15 PM3/24/22
to mriqc-users
Hi all,

Thanks for your patience. Unfortunately, MRIQC hasn't enjoyed the resources it needs to keep it up-to-date. For that reason, the classifier has not been updated in a long time. So all these errors are, somewhat, expected.

To fix this situation, we have split the classifier into a new project called MRIQC-learn. Please, check it out at https://github.com/nipreps/mriqc-learn and feel free to file new support requests under the tab "Issues". A good starting point is found on the jupyter notebooks: https://github.com/nipreps/mriqc-learn/tree/main/docs/notebooks.

Hope this helps

Best,
Oscar
___________________________
Oscar Esteban, Ph.D.
Research and Teaching Ambizione FNS Fellow
Dept. of Radiology, CHUV, University of Lausanne

+1 (650) 733 33 82


Wenjun Huang

unread,
Mar 26, 2022, 11:36:46 AM3/26/22
to mriqc-users
Hi all, 

I ran the Tutorial.ipynb on on the jupyter notebooks: https://github.com/nipreps/mriqc-learn/tree/main/docs/notebooks. And got two errors: GridSearchCV and pipe are not defined.

first can be fixed by adding "from sklearn.model_selection import GridSearchCV"
but I don't know how to fix pipe error.

and scripts with errors:
clf = GridSearchCV(
    estimator=pipe,
    param_grid=p_grid,
    cv=inner_cv,
    n_jobs=30,
    scoring="roc_auc",
 

And I'm freshman with python and mriqc, so I'm not very sure how to  evaluate my own group_T1w.tsv using the tutorial.py


Please give me some advice.

Many Thanks!

Best,

Wenjun


Reply all
Reply to author
Forward
0 new messages