5ttgen error on MAC

Hi All,

If I type 5ttgen on my mac terminal, I get the following error:

Traceback (most recent call last):
  File "/usr/local/bin/5ttgen", line 26, in <module>
    algorithm_list = getAlgorithmList()
  File "/usr/local/Cellar/mrtrix3/0.3.15-305-g5e6eef5/scripts/lib/getAlgorithmList.py", line 8, in getAlgorithmList
    src_file_list = os.listdir(os.path.join(os.path.dirname(os.path.abspath(sys.argv[0])), 'src', path))
OSError: [Errno 2] No such file or directory: '/usr/local/bin/src/_5ttgen'

I installed MRtrix3 fresh using homebrew with all recommended steps. Does anybody have an idea of what is wrong here?

Many thanks,
Kamal

OK, this looks like the same symptom as was recently reported here, so it’s probably not manual moving of the script files…

@dchristiaens: Is the homebrew installation grabbing the script files and placing them in /usr/local/bin/? This won’t work for 5ttgen and dwi2response, we’ll need to figure out a more appropriate way of installing / arranging / detecting these.

@kamal: A quick fix would be to grab the scripts/src/ directory, and place a copy in your /usr/local/bin/ directory (so the path that the error is complaining about - /usr/local/bin/src/_5ttgen - exists). That should allow 5ttgen to find the files it’s expecting to see based on a relative path from its own location.

Cheers
Rob

@rsmith I don’t copy the scripts but homebrew forces me to symlink the scripts from the mrtrix installation directory in homebrew’s Cellar to /usr/local/bin.

So I changed 5ttgen’s algorithm parsing to dereference symbolic links. This might not work on windows but is fine since we don’t symlink there. I couldn’t see any other places where the usage sys.argv[0] might cause problems.

@kamal You should get the update with
brew upgrade mrtrix3 -force # get a cup of tea

:thumbsup:

@ssargolzaei This should be the fix for the first of your reported issues also.

@rsmith That’s right. Liked the “cup of tea!” idea and not “cup of coffee” :slight_smile: