Dcm2niix error using heudiconv

Hello,

I have been trying to run heudiconv on my dcm data. However, I keep having this problem whenever I add the dcm2niix line into my terminal. I have tried to solve this problem by working offline, making sure I do not have any other softwares running, but this error keeps occuring. If anyone knows how to resolve this problem, it would be much appreciated!

Thank you.
heudiconv --files "C:\Users\S\Desktop\TEST" -o "C:\Users\S\Desktop\bids" -s test -c dcm2niix -b -f "C:\Users\S\Desktop\TEST\myh.py" C:\Users\S\AppData\Local\Programs\Python\Python39\lib\site-packages\requests\__init__.py:102: RequestsDependencyWarning: urllib3 (1.26.9) or chardet (5.2.0)/charset_normalizer (2.0.12) doesn't match a supported version! warnings.warn("urllib3 ({}) or chardet ({})/charset_normalizer ({}) doesn't match a supported " INFO: Running heudiconv version 0.13.1 latest 0.13.1 INFO: Analyzing 4548 dicoms WARNING: Ignoring C:\Users\S\Desktop\TEST\__pycache__\myh.cpython-39.pyc since not quite a "normal" DICOM: 'FileDataset' object has no attribute 'SeriesNumber' WARNING: Ignoring C:\Users\S\Desktop\TEST\desktop.ini since not quite a "normal" DICOM: 'FileDataset' object has no attribute 'SeriesNumber' WARNING: Ignoring C:\Users\S\Desktop\TEST\myh.py since not quite a "normal" DICOM: 'FileDataset' object has no attribute 'SeriesNumber' INFO: Generated sequence info for 1 studies with 17 entries total WARNING: Heuristic is missing an infotoidsmethod, assigning empty method and using provided subject id test. Providesessionandlocator` fields for best results.
INFO: Study session for StudySessionInfo(locator=None, session=None, subject=‘test’)
INFO: Need to process 1 study sessions
INFO: PROCESSING STARTS: {‘subject’: ‘test’, ‘outdir’: ‘C:\Users\S\Desktop\bids\’, ‘session’: None}
INFO: Processing 17 pre-sorted seqinfo entries
INFO: Doing conversion using dcm2niix
INFO: Converting C:\Users\S\Desktop\bids\sub-test/anat/sub-test_T1w (1 DICOMs) → C:\Users\S\Desktop\bids\sub-test/anat . Converter: dcm2niix . Output types: (‘nii.gz’, ‘dicom’)
230915-15:49:44,224 nipype.workflow INFO:
[Node] Setting-up “convert” in “C:\Users\S\AppData\Local\Temp\dcm2niixl6jsq2b_\convert”.
INFO: [Node] Setting-up “convert” in “C:\Users\S\AppData\Local\Temp\dcm2niixl6jsq2b_\convert”.
230915-15:49:44,271 nipype.workflow INFO:
[Node] Executing “convert” <nipype.interfaces.dcm2nii.Dcm2niix>
INFO: [Node] Executing “convert” <nipype.interfaces.dcm2nii.Dcm2niix>
230915-15:49:44,413 nipype.interface INFO:
[WinError 10038] An operation was attempted on something that is not a socket
INFO: [WinError 10038] An operation was attempted on something that is not a socket
230915-15:49:44,413 nipype.workflow INFO:
[Node] Finished “convert”, elapsed time 0.015621s.
INFO: [Node] Finished “convert”, elapsed time 0.015621s.
230915-15:49:44,413 nipype.workflow WARNING:
Storing result file without outputs
WARNING: Storing result file without outputs
230915-15:49:44,420 nipype.workflow WARNING:
[Node] Error on “convert” (C:\Users\S\AppData\Local\Temp\dcm2niixl6jsq2b_\convert)
WARNING: [Node] Error on “convert” (C:\Users\S\AppData\Local\Temp\dcm2niixl6jsq2b_\convert)
Traceback (most recent call last):
File “C:\Users\S\AppData\Local\Programs\Python\Python39\lib\runpy.py”, line 197, in _run_module_as_main
return _run_code(code, main_globals, None,
File “C:\Users\S\AppData\Local\Programs\Python\Python39\lib\runpy.py”, line 87, in run_code
exec(code, run_globals)
File "C:\Users\S\AppData\Local\Programs\Python\Python39\Scripts\heudiconv.exe_main
.py", line 7, in
File “C:\Users\S\AppData\Local\Programs\Python\Python39\lib\site-packages\heudiconv\cli\run.py”, line 30, in main
workflow(**kwargs)
File “C:\Users\S\AppData\Local\Programs\Python\Python39\lib\site-packages\heudiconv\main.py”, line 463, in workflow
prep_conversion(
File “C:\Users\S\AppData\Local\Programs\Python\Python39\lib\site-packages\heudiconv\convert.py”, line 255, in prep_conversion
convert(
File “C:\Users\S\AppData\Local\Programs\Python\Python39\lib\site-packages\heudiconv\convert.py”, line 616, in convert
res, prov_file = nipype_convert(
File “C:\Users\S\AppData\Local\Programs\Python\Python39\lib\site-packages\heudiconv\convert.py”, line 829, in nipype_convert
eg = convertnode.run()
File “C:\Users\S\AppData\Local\Programs\Python\Python39\lib\site-packages\nipype\pipeline\engine\nodes.py”, line 527, in run
result = self._run_interface(execute=True)
File “C:\Users\S\AppData\Local\Programs\Python\Python39\lib\site-packages\nipype\pipeline\engine\nodes.py”, line 645, in _run_interface
return self._run_command(execute)
File “C:\Users\S\AppData\Local\Programs\Python\Python39\lib\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 convert.

Cmdline:
dcm2niix -b y -z y -x n -t n -m n -f sub-test_T1w_heudiconv391 -o C:\Users\S\Desktop\bids\sub-test\anat -s n -v n C:\Users\S\AppData\Local\Temp\dcm2niixl6jsq2b_\convert
Stdout:

Stderr:

Traceback:
Traceback (most recent call last):
File “C:\Users\S\AppData\Local\Programs\Python\Python39\lib\site-packages\nipype\interfaces\base\core.py”, line 397, in run
runtime = self._run_interface(runtime)
File “C:\Users\S\AppData\Local\Programs\Python\Python39\lib\site-packages\nipype\interfaces\dcm2nii.py”, line 445, in _run_interface
runtime = super(Dcm2niix, self)._run_interface(
File “C:\Users\S\AppData\Local\Programs\Python\Python39\lib\site-packages\nipype\interfaces\base\core.py”, line 764, in _run_interface
runtime = run_command(
File “C:\Users\S\AppData\Local\Programs\Python\Python39\lib\site-packages\nipype\utils\subprocess.py”, line 141, in run_command
_process()
File “C:\Users\S\AppData\Local\Programs\Python\Python39\lib\site-packages\nipype\utils\subprocess.py”, line 128, in _process
res = select.select(streams, , , timeout)
OSError: [WinError 10038] An operation was attempted on something that is not a socket

Exception ignored in: <function TempDirs.del at 0x00000273F79B0820>
Traceback (most recent call last):
File “C:\Users\S\AppData\Local\Programs\Python\Python39\lib\site-packages\heudiconv\utils.py”, line 102, in del
self.cleanup()
File “C:\Users\S\AppData\Local\Programs\Python\Python39\lib\site-packages\heudiconv\utils.py”, line 114, in cleanup
self.rmtree(t)
File “C:\Users\S\AppData\Local\Programs\Python\Python39\lib\site-packages\heudiconv\utils.py”, line 119, in rmtree
shutil.rmtree(tmpdir)
File “C:\Users\S\AppData\Local\Programs\Python\Python39\lib\shutil.py”, line 759, in rmtree
return _rmtree_unsafe(path, onerror)
File “C:\Users\S\AppData\Local\Programs\Python\Python39\lib\shutil.py”, line 624, in _rmtree_unsafe
_rmtree_unsafe(fullname, onerror)
File “C:\Users\S\AppData\Local\Programs\Python\Python39\lib\shutil.py”, line 633, in _rmtree_unsafe
onerror(os.rmdir, path, sys.exc_info())
File “C:\Users\S\AppData\Local\Programs\Python\Python39\lib\shutil.py”, line 631, in rmtree_unsafe
os.rmdir(path)
PermissionError: [WinError 32] The process cannot access the file because it is being used by another process: 'C:\Users\S\AppData\Local\Temp\dcm2niixl6jsq2b
\convert’`

I keep finding dcm2niix temp files in my system that does not have anything in their convert folder.

thanks for the report. Unfortunately seems to be an existing known issue in nipype which is yet to be fixed: nipype issues with calling dcm2nii · Issue #3302 · nipy/nipype · GitHub