BATMAN tutorial step 2.4 – zsh: command not found: dwipreproc

Hi everyone,

I am using the BATMAN tutorial in order to get familiar with MRtrix3, but at step 2.4:
dwipreproc dwi_den_unr.mif dwi_den_unr_preproc.mif –pe_dir AP –rpe_pair–se_epi b0_pair.mif –eddy_options “ --slm=linear”

There occurs an error:
zsh: command not found: dwipreproc

I think that I did not set up MRtrix3 correctly, because I did not enter ./set_path when building MRtrix. Therefore, I need to navigate back to the root MRtrix3 directory to do the setup retrospectively. Which steps are necessary in order to avigate to the root MRtrix3 directory?

Or are there any other reasons for the error?

I am working on a MacBook with the latest version of MRtrix3.

Thank you so much in advance! I am completely new to this so any advice would be greatly appreciated. :slight_smile:

Best,
Lea

Hi Lea,

sorry for the confusion. The tutorial is indeed a bit outdated and I should be providing an updat one of these days… Indeed, the command “dwipreproc” does no longer exist in the current MRtrix3 verison. It has now been replaced with “dwifslpreproc”. You can try the following command (also notice the different eddy options as compared to the tutorial, but this is what I myself am using right now):

dwifslpreproc dwi_den_unr.mif dwi_den_unr_preproc.mif -pe_dir AP -rpe_pair -se_epi b0s_pair.mif -eddy_options " --repol"

Hope this helps!
Marlene.

Hi Marlene,

thanks for your reply. This helps a lot! I will try it out. :slight_smile:

Due to the fact that this command needs to run overnight, I already tried to continue with the next step for Bias Field correction yesterday (using the provided supplementary file), but there occurs an error as well if I enter: dwibiascorrect ants dwi_den_unr_preproc.mif dwi_den_unr_preproc_unbiased.mif –bias bias.mif

Traceback (most recent call last):
File “/Users/ls/mrtrix3/bin/dwibiascorrect”, line 82, in
import mrtrix3
File “/Users/ls/mrtrix3/bin/mrtrix3.py”, line 17, in
import imp, os, sys

ModuleNotFoundError: No module named ‘imp’

According to some advice I found online, I would be supposed to change the path or even the python set-up, but I do not know how to do this yet. So it is turning out to be a challenge right now - do you have any tips on how I can solve this problem?

Best,
Lea

Ouch. According to the documentation for the imp module, it is now deprecated:

Deprecated since version 3.4, will be removed in version 3.12: The imp module is deprecated in favor of importlib.

Looks like we’re going to have to make a few changes…

Hi Marlene,

I just tried to run the new command overnight, but there still occurs an error, if I enter:

dwifslpreproc dwi_den_unr.mif dwi_den_unr_preproc.mif -pe_dir AP -rpe_pair -se_epi b0s_pair.mif -eddy_options " --repol"

Traceback (most recent call last):
File “/Users/ls/mrtrix3/bin/dwifslpreproc”, line 26, in
from distutils.spawn import find_executable

ModuleNotFoundError: No module named ‘distutils’

Is there another way to solve the problem with an alternative command?

Best,
Lea

Hi Lea,

hm, looks like another Python issue to me… unfortunately, this is a little off my area of expertise… @jdtournier: Any ideas from your side - needs the " distutils" package need to be installed separately?

Cheers,
Marlene.

Yes, you’ll need to install the python3-distutils package – though it might be called something slightly different depending on the specifics of your system.

There are often minor changes to the list of dependencies required as different distributions call the different packages by different names and sometimes change which modules are available as part of which package, etc. Makes it quite hard to keep everything up to date! Though I have to admit, the distutils thing is not new…

1 Like

Reviving this old thread because I was wondering if anyone has found a solution for the imp module issue? I can’t use a different version of python due to other issues so was hoping there’d be a more elegant solution…