FSLeyes was crashing on launch when installed via Conda-forge or PyPi, I finally installed full FSL. I had the following crash when opening a MRI file.
Traceback (most recent call last):
File "/usr/local/lib/python3.9/site-packages/fsl/utils/memoize.py", line 139, in __call__
result = self.__cache[key]
KeyError: ('_memoize_noargs_',)
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/usr/local/lib/python3.9/site-packages/fsleyes/gl/__init__.py", line 728, in create
ready()
File "/usr/local/lib/python3.9/site-packages/fsleyes/main.py", line 583, in realCallback
callback()
File "/usr/local/lib/python3.9/site-packages/fsleyes/main.py", line 370, in buildGui
frame = makeFrame(namespace[0],
File "/usr/local/lib/python3.9/site-packages/fsleyes/main.py", line 795, in makeFrame
frame = fsleyesframe.FSLeyesFrame(
File "/usr/local/lib/python3.9/site-packages/fsleyes/frame.py", line 310, in __init__
self.__makeMenuBar()
File "/usr/local/lib/python3.9/site-packages/fsleyes/frame.py", line 1532, in __makeMenuBar
self.__makeFileMenu()
File "/usr/local/lib/python3.9/site-packages/fsleyes/frame.py", line 1661, in __makeFileMenu
actionObj = action(self.__overlayList, self.__displayCtx, self)
File "/usr/local/lib/python3.9/site-packages/fsleyes/actions/loaddicom.py", line 65, in __init__
self.enabled = fsldcm.enabled()
File "/usr/local/lib/python3.9/site-packages/fsl/data/dicom.py", line 176, in enabled
installed = installedVersion()
File "/usr/local/lib/python3.9/site-packages/fsl/utils/memoize.py", line 145, in __call__
result = self.__func(*a, **kwa)
File "/usr/local/lib/python3.9/site-packages/fsl/data/dicom.py", line 128, in installedVersion
cmd = f'{dcm2niix()} -h'
File "/usr/local/lib/python3.9/site-packages/fsl/data/dicom.py", line 76, in dcm2niix
if op.exists(c):
File "/usr/local/Cellar/python@3.9/3.9.7/Frameworks/Python.framework/Versions/3.9/lib/python3.9/genericpath.py", line 19, in exists
os.stat(path)
TypeError: stat: path should be string, bytes, os.PathLike or integer, not NoneType
I was able to temporally solve the issue by adding c is not None line 76 in /usr/local/lib/python3.9/site-packages/fsl/data/dicom.py leading to the code below. shutil.which('dcm2niix') returns None in my setup.
def dcm2niix() -> str:
"""Tries to find an absolute path to the ``dcm2niix`` command. Returns
``'dcm2niix'`` (unqualified) if a specific executable cannot be found.
"""
candidates = [
op.join(fslplatform.platform.fsldir, 'bin', 'dcm2niix'),
shutil.which('dcm2niix')
]
for c in candidates:
if c is not None and op.exists(c):
return c
return 'dcm2niix'
Mac Monterey version 12.6.2
FSLeyes was crashing on launch when installed via Conda-forge or PyPi, I finally installed full FSL. I had the following crash when opening a MRI file.
I was able to temporally solve the issue by adding
c is not None
line 76 in /usr/local/lib/python3.9/site-packages/fsl/data/dicom.py leading to the code below.shutil.which('dcm2niix')
returns None in my setup.