Heudiconv 'ModuleNotFoundError: No module named 'heuristic'

Dear Heudiconvers,

I’ve been following the http://reproducibility.stanford.edu/bids-tutorial-series-part-2a/ tutorial. However, when I run the final call, I end up with an error.

docker run --rm -it -v /mnt/mount/group/:/base nipy/heudiconv:latest -d /base/sub-{subject}/scans//DICOM/.dcm -o /base/Nifti/ -f /base/Nifti/code/{subject}/heuristic.py -s 1103 -c dcm2niix -b --overwrite

INFO: Running heudiconv version 0.6.0.dev1
Traceback (most recent call last):
File “/opt/miniconda-latest/bin/heudiconv”, line 11, in
load_entry_point(‘heudiconv’, ‘console_scripts’, ‘heudiconv’)()
File “/src/heudiconv/heudiconv/cli/run.py”, line 127, in main
File “/src/heudiconv/heudiconv/cli/run.py”, line 256, in process_args
heuristic = load_heuristic(args.heuristic)
File “/src/heudiconv/heudiconv/utils.py”, line 308, in load_heuristic
mod = import(fname.split(’.’)[0])
ModuleNotFoundError: No module named ‘heuristic’

I am sure I have done something moronic but am not sure what exactly.

If anyone has encountered a similar problem and solved it - or haven’t but have some advice - would love to hear from you.

Cheers, Eunice

Hi Eunice,

A fresh pair of eyes always helps :slight_smile:

It’s been a little while since I’ve used heudiconv, but looking at the named arguments of the documentation, I see -f should point to a single heuristic file if I’m not mistaken. If I’m right, then the {subject} placeholder in /base/Nifti/code/{subject}/heuristic.py should be removed and replaced with an actual path to a heuristic file. Ideally the heuristic file can handle the heterogeneity of the scans the file may run into.

Does each subject have their own heuristic file that you would like to run independently?


Dear James,

THANK YOU for your email!

I made 3 mistakes. First my ‘base’ pathway was not going to the correct place and then second, you were correct, the code did not work when I put the ‘heuristic.py’ file in a subject-specific folder. Third - I needed to get enough sleep to be wakeful enough to see the first problem.

In the process I also watched your video

Which was a superuseful resource. Thank you again.

Cheers, Eunice

1 Like