Qsiprep illegal instruction

Summary of what happened:

Hello guys, I am trying to do preprocessing of my dwi data via qsiprep container app by text script (attached screenshot) but after around 5 minutes of preprocessing shows me error attached in code down below. I am new user and will be happy about any help of you guys. Thanks

Command used (and if a helper script was used, a link to the helper script or the command generated):

PASTE CODE HERE

Version:

Latest (0.21.4)

Environment (Docker, Singularity / Apptainer, custom installation):

I used Mac OS and 4.30 docker version

Data formatted according to a validatable standard? Please provide the output of the validator:

PASTE VALIDATOR OUTPUT HERE

Relevant log outputs (up to 20 lines):

QSIPrep failed: 4 raised. Re-raising first.
RuntimeError: Traceback (most recent call last):
  File "/opt/conda/envs/qsiprep/lib/python3.10/site-packages/nipype/pipeline/plugins/multiproc.py", line 67, in run_node
    result["result"] = node.run(updatehash=updatehash)
  File "/opt/conda/envs/qsiprep/lib/python3.10/site-packages/nipype/pipeline/engine/nodes.py", line 527, in run
    result = self._run_interface(execute=True)
  File "/opt/conda/envs/qsiprep/lib/python3.10/site-packages/nipype/pipeline/engine/nodes.py", line 645, in _run_interface
    return self._run_command(execute)
  File "/opt/conda/envs/qsiprep/lib/python3.10/site-packages/nipype/pipeline/engine/nodes.py", line 771, in _run_command
    raise NodeExecutionError(msg)
nipype.pipeline.engine.nodes.NodeExecutionError: Exception raised while executing Node n4_correct.

Cmdline:
	N4BiasFieldCorrection --bspline-fitting [ 200 ] -d 3 --input-image /scrtch/qsiprep_wf/single_subject_02_wf/anat_preproc_wf/anat_template_wf/anat_conform/mapflow/_anat_conform0/sub-02_T1w_lps.nii.gz --convergence [ 50x50x50x50, 1e-07 ] --output sub-02_T1w_lps_corrected.nii.gz --shrink-factor 4
Stdout:

Stderr:
	Illegal instruction
Traceback:
	Traceback (most recent call last):
	  File "/opt/conda/envs/qsiprep/lib/python3.10/site-packages/nipype/interfaces/base/core.py", line 453, in aggregate_outputs
	    setattr(outputs, key, val)
	  File "/opt/conda/envs/qsiprep/lib/python3.10/site-packages/nipype/interfaces/base/traits_extension.py", line 330, in validate
	    value = super(File, self).validate(objekt, name, value, return_pathlike=True)
	  File "/opt/conda/envs/qsiprep/lib/python3.10/site-packages/nipype/interfaces/base/traits_extension.py", line 135, in validate
	    self.error(objekt, name, str(value))
	  File "/opt/conda/envs/qsiprep/lib/python3.10/site-packages/traits/base_trait_handler.py", line 74, in error
	    raise TraitError(
	traits.trait_errors.TraitError: The 'output_image' trait of a N4BiasFieldCorrectionOutputSpec instance must be a pathlike object or string representing an existing file, but a value of '/scrtch/qsiprep_wf/single_subject_02_wf/anat_preproc_wf/anat_template_wf/n4_correct/sub-02_T1w_lps_corrected.nii.gz' <class 'str'> was specified.

	During handling of the above exception, another exception occurred:

	Traceback (most recent call last):
	  File "/opt/conda/envs/qsiprep/lib/python3.10/site-packages/nipype/interfaces/base/core.py", line 398, in run
	    runtime = self._post_run_hook(runtime)
	  File "/opt/conda/envs/qsiprep/lib/python3.10/site-packages/nipype/interfaces/mixins/fixheader.py", line 127, in _post_run_hook
	    outputs = self.aggregate_outputs(runtime=runtime).get_traitsfree()
	  File "/opt/conda/envs/qsiprep/lib/python3.10/site-packages/nipype/interfaces/base/core.py", line 460, in aggregate_outputs
	    raise FileNotFoundError(msg)
	FileNotFoundError: No such file or directory '/scrtch/qsiprep_wf/single_subject_02_wf/anat_preproc_wf/anat_template_wf/n4_correct/sub-02_T1w_lps_corrected.nii.gz' for output 'output_image' of a N4BiasFieldCorrection interface



The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "/opt/conda/envs/qsiprep/bin/qsiprep", line 8, in <module>
    sys.exit(main())
  File "/opt/conda/envs/qsiprep/lib/python3.10/site-packages/qsiprep/cli/run.py", line 818, in main
    qsiprep_wf.run(**plugin_settings)
  File "/opt/conda/envs/qsiprep/lib/python3.10/site-packages/nipype/pipeline/engine/workflows.py", line 638, in run
    runner.run(execgraph, updatehash=updatehash, config=self.config)
  File "/opt/conda/envs/qsiprep/lib/python3.10/site-packages/nipype/pipeline/plugins/base.py", line 224, in run
    raise error from cause
RuntimeError: 4 raised. Re-raising first.
---> Summary: Total runtime: 0hrs 5min 26sec

Screenshots / relevant information:


Hi @Simon_Janovic and welcome to neurostars!

For future posts, please do not delete the prepopulated Software Support post template, which I added back in for you. It helps organize your post, prompts you for important information, and helps format the text for better readability. You can edit your post to add in this information so we can better help you.

Best,
Steven

The Illegal instruction error happens on the new mac chips. Do you have access to an intel machine?

Hi Matt, actually no, is there another possibility how to run it on M3 chip of Mac ?

You would probably need to build all of qsiprep’s dependencies (as is done here) on your m3 chip and then build qsiprep. Even then it’s possible that the illegal instruction is in one of the pieces of software that don’t compile ourselves in the build.

I remember seeing a lot of Illegal instruction errors outside of QSIPrep when playing around with the Tensorflow-based FreeSurfer synth tools on Apple silicon. This might include Synthstrip and Synthseg, which QSIPrep uses. So I imagine that a rebuild from source on Mac would still fail there. I’d be interested if the rebuild as Matt suggested would work, but I doubt it will be worth the time and headache.

Hi,

I got the same error on a different docker image using ANTs bias field correction on an M3.

Turning off “Use Rosetta for x86_64/amd64 emulation on Apple Silicon” in Docker settings did work for me. I also built the image using --platform linux/amd64.

With this N4BiasFieldCorrection ran as expected.

Cheers,
Corina

2 Likes