Using mrtrix3 with designer

I am trying to run the designer pipeline (, but I get an error ‘cannot find path to mrtrix’ and 'no module named ‘mrtrix3’
I am working on windows 10 and have installed mrtrix using msys. Mrview works through it normally. I think the problem might be that the mrtrix files are in msys64/mingw64/bin and /lib/mrtrix3 and I can’t add them to path together.
I have little programming knowledge and can’t find the solution on my own.

I’ve no experience with the designer pipeline, but it looks like the check for whether MRtrix is in the PATH assumes that you’ve placed the executables in a folder that contains the token mrtrix3 – which is not a particularly safe assumption, as your case illustrates.

I am however surprised that the executables would be located in /msys64/mingw64/bin, and the library in /lib/mrtrix3. That’s not the way to install MRtrix3. I assume this is a Windows install? Why was the installation split in this way? More information on what’s expected on our docs - particularly this statement:

The only requirement is that these 3 folders are co-located alongside each other, so that the executables can find the MRtrix3 shared library, and the scripts can find the requisite python modules.

I recommend we try to ensure your installation adheres to expectations, and then we can try to sort out the designer script issue.

Assuming you’ve got a ‘compliant’ install (i.e. where the MRtrix3 bin, lib & share folders are co-located), and you’re confident MRtrix is in the PATH (i.e. you can invoked e.g. mrinfo from the command-line), and things still don’t work because the parent folder doesn’t contain the token mrtrix3, then we’ll need to fix things up. I have a feeling we’re going to have to get in touch with the developers and get them to use our recommended approach to locate the MRtrix3 modules.

To cut a long story short, what we would recommend is that you remove lines 6-11 and lines 14 & 15, and then use one of the approaches recommended on our docs to locate the MRtrix3 install. In your case, and assuming you’re on Windows so that symbolic links are not an option, I’d recommend:

  • copy our file and place alongside the designer script.
  • create a file in the parent folder of the designer script, containing simply the location of the MRtrix3 build script (this depends on where it’s installed). Don’t worry if the build script doesn’t actually exist, as long as the location is where it would have been (i.e. in the top-level folder of the MRtrix3 tree, e.g. /usr/build if you’ve installed the executables in /usr/bin, the library in /usr/lib, etc).

Happy to help if this is all a bit confusing…
I’ll contact the designer developer in the meantime, see if we can figure out a long-term solution to this.

I should point out that there is another simpler solution to the suggestions above. Instead of adding our and link/file pointing to the build script, you can simply add the location of your installation’s lib/mrtrix3 folder to your PYTHONPATH (you’ll still need to remove the checks from the file though). It’s not what we’d recommend long-term, but it should allow you to get on with running the script.

Thank you for your response!
As to the installation, I didn’t write clearly in the post. The files are located in C:\msys64\mingw64\lib\mrtrix3, C:\msys64\mingw64\share\mrtrix3 and C:\msys64\mingw64\bin. In the bin folder they’re mixed with all kinds of other executables so I can’t really move them (as in the screenshot). I followed the installation instructions on the mrtrix website.
I removed the lines you mentioned, created a symlink in the designer folder (with mklink) and added the file with C:\msys64\mingw64\build. Now it seems to import with no problems, however it now says that the module ‘’ has none of the attributes used in the code (init, args, etc).
I added ‘C:\msys64\mingw64’ (also tried with lib\mrtrix3) to PATH but the mrtrix commands do not work from cmd, only from msys (mrinfo is a command that has something to do with the router on my system, but mrview is not recognized).
I think I will try doing the preprocessing without this pipeline (it also warns that fsl commands may fail).

OK, no problem with your installation then.

Regarding the ongoing issues with designer, there’s a good chance this might be because things have changed quite a bit on the python side with the latest version of MRtrix3… @rsmith might be able to shed to light on this.

@rsmith might be able to shed to light on this.


PSA for anyone either utilising scripts that operate against the MRtrix3 Python modules, or is writing / using their own scripts: the Python API changed quite a bit between 3.0_RC3 and 3.0.0. Any external script written to execute against 3.0_RC3 will most definitely not work if you install MRtrix3 version 3.0.0.

Porting scripts from the old API to the new API is however pretty easy. Long-term the new API will enable the creation of scripts with more sophisticated logic, so I think the change will be worthwhile.

I’ve not yet written any developer documentation or instructions on the changes because I don’t have a sense of whether or not anyone other than myself is actually using the API. If this number is actually larger than I think, let me know and I’ll try to find the time. Also, since it’s kind of on topic, the MRtrix3 manuscript provides an example script in Python that demonstrates how you can make commands that look and feel like MRtrix3 commands with not too much code.