Sct_run_batch failed - SCT 4.3

Hi,
I got this error when running sct_run_batch. Would you please tell me how I can solve it?
Thanks.

sct_run_batch -jobs -1 -path-data ‘/home/sahar/Teh_spineGeneric/sub-milan03/anat’ -path-output ~/spineGeneric_results/ process_data.sh
Traceback (most recent call last):
File “/home/sahar/sct_4.3/scripts/sct_run_batch.py”, line 151, in
with multiprocessing.Pool(jobs) as p:
File “/home/sahar/sct_4.3/python/envs/venv_sct/lib/python3.6/multiprocessing/context.py”, line 119, in Pool
context=self.get_context())
File “/home/sahar/sct_4.3/python/envs/venv_sct/lib/python3.6/multiprocessing/pool.py”, line 167, in init
raise ValueError(“Number of processes must be at least 1”)
ValueError: Number of processes must be at least 1

Hi, Julien
Please answer me.

Hi Sahar. Thank you for your patience. :slightly_smiling_face:

At the start of the output from sct_run_batch, there is a section called INFO SYSTEM. For example, on my computer, it looks like this:

INFO SYSTEM
-----------
OS: linux (Linux-5.4.0-7642-generic-x86_64-with-debian-bullseye-sid)
CPU cores: Available: 8 | Threads used by ITK Programs: 1
RAM: Total 7812 MB | Available 2801 MB | Used 3846 MB

Could you please re-run sct_run_batch, then copy and paste this from your terminal? Thanks much!

Hi, Thank you for your answer.
I changed my CPU core from 4 to 8 according to your INFO SYSTEM.
Sorry, I could not get the INFO SYSTEM with sct_run_batch, but I have this:

Dear, joshua
After changing the CPU core, I performed the sct_run_batch and got a new error. Please tell me what it is.
Many thanks.
sct_run_batch -jobs -1 -path-data ‘/home/sahar/Desktop/sub-tehran07/anat’ -path-output ~/spineGeneric_results/ ‘/home/sahar/spine-generic/process_data.sh’
Running sub-tehran07_acq-T1w_MTS.json. See log file /home/sahar/spineGeneric_results/log/process_data_sub-tehran07_acq-T1w_MTS.json.log
Running sub-tehran07_acq-MToff_MTS.json. See log file /home/sahar/spineGeneric_results/log/process_data_sub-tehran07_acq-MToff_MTS.json.log
Running sub-tehran07_acq-MTon_MTS.json. See log file /home/sahar/spineGeneric_results/log/process_data_sub-tehran07_acq-MTon_MTS.json.log
Running sub-tehran07_T2w.json. See log file /home/sahar/spineGeneric_results/log/process_data_sub-tehran07_T2w.json.log
Running sub-tehran07_T1w.json. See log file /home/sahar/spineGeneric_results/log/process_data_sub-tehran07_T1w.json.log
Running sub-tehran07_T2star.json. See log file /home/sahar/spineGeneric_results/log/process_data_sub-tehran07_T2star.json.log
Running sub-tehran07_T2star.nii.gz. See log file /home/sahar/spineGeneric_results/log/process_data_sub-tehran07_T2star.nii.gz.log
Running sub-tehran07_acq-MToff_MTS.nii.gz. See log file /home/sahar/spineGeneric_results/log/process_data_sub-tehran07_acq-MToff_MTS.nii.gz.log
Running sub-tehran07_T1w.nii.gz. See log file /home/sahar/spineGeneric_results/log/process_data_sub-tehran07_T1w.nii.gz.log
Running sub-tehran07_acq-MTon_MTS.nii.gz. See log file /home/sahar/spineGeneric_results/log/process_data_sub-tehran07_acq-MTon_MTS.nii.gz.log
Running sub-tehran07_T2w.nii.gz. See log file /home/sahar/spineGeneric_results/log/process_data_sub-tehran07_T2w.nii.gz.log
Running sub-tehran07_acq-T1w_MTS.nii.gz. See log file /home/sahar/spineGeneric_results/log/process_data_sub-tehran07_acq-T1w_MTS.nii.gz.log
multiprocessing.pool.RemoteTraceback:
“”"
Traceback (most recent call last):
File “/home/sahar/sct_4.3/python/envs/venv_sct/lib/python3.6/multiprocessing/pool.py”, line 119, in worker
result = (True, func(*args, **kwds))
File “/home/sahar/sct_4.3/python/envs/venv_sct/lib/python3.6/multiprocessing/pool.py”, line 44, in mapstar
return list(map(*args))
File “/home/sahar/sct_4.3/scripts/sct_run_batch.py”, line 140, in run_single
assert res.returncode == 0, ‘Processing of subject {} failed’.format(subject)
AssertionError: Processing of subject sub-tehran07_acq-MTon_MTS.json failed
“”"

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

Traceback (most recent call last):
File “/home/sahar/sct_4.3/scripts/sct_run_batch.py”, line 152, in
p.map(run_single, subject_dirs)
File “/home/sahar/sct_4.3/python/envs/venv_sct/lib/python3.6/multiprocessing/pool.py”, line 266, in map
return self._map_async(func, iterable, mapstar, chunksize).get()
File “/home/sahar/sct_4.3/python/envs/venv_sct/lib/python3.6/multiprocessing/pool.py”, line 644, in get
raise self._value
AssertionError: Processing of subject sub-tehran07_acq-MTon_MTS.json failed

Hi Sahar,

This new error is happening inside process_data.sh. So, what would help most is the log from the subject that failed.

Could you please share the contents of the file /home/sahar/spineGeneric_results/log/process_data_sub-tehran07_acq-MTon_MTS.nii.gz.log?

Thanks much!

@Sahar sorry for the late reply-- the input of -path-data should be the BIDS directory, not the subject folder. E.g.: /bob/data-multi-subject/ instead of /bob/data-multi-subject/sub-amu01/anat/

2 Likes

Hi, thanks, Julien & Joshua, I replaced the "-path-data ‘/home/sahar/sub-tehran07/anat’ path.
But the error is still somewhere else.
I have attached one of the log files.

‘/home/sahar/spinalcordtoolbox/bin/sct_run_batch’ -jobs -1 -path-data ‘/home/sahar/sub-tehran07/anat’ -path-output ~/spineGeneric_results/ -script ‘/home/sahar/Downloads/spine-generic/process_data.sh’


Spinal Cord Toolbox (git-master-9b91b1ae36b22a92cc0421aa78ebd5be76e2d0b3)

INFO SYSTEM

OS: linux (Linux-5.4.0-48-generic-x86_64-with-debian-bullseye-sid)
CPU cores: Available: 8 | Threads used by ITK Programs: 1
RAM: Total 5188 MB | Available 4005 MB | Used 925 MB

INPUT ARGUMENTS

batch_log: sct_run_batch_log.txt
config: null
continue_on_error: 1
email_from: null
email_host: smtp.gmail.com:587
email_to: null
exclude: null
exclude_list: null
include: null
include_list: null
itk_threads: 1
jobs: -1
path_data: /home/sahar/sub-tehran07/anat
path_output: /home/sahar/spineGeneric_results/
path_segmanual: .
script: /home/sahar/Downloads/spine-generic/process_data.sh
script_args: ‘’
subject_prefix: sub-
zip: false

SCRIPT

git commit: a3a4b4f71aea271335ab9617c634ab62718c87ea
git origin: https://github.com/spine-generic/spine-generic.git
Copying script to output folder…
/home/sahar/Downloads/spine-generic/process_data.sh -> /home/sahar/spineGeneric_results

DATA

git commit: ?!?
git origin: ?!?

RUNNING

Running 7 jobs in parallel.

Started at 12h40m36s: sub-tehran07_T2star.nii.gz. See log file /home/sahar/spineGeneric_results/log/process_data_sub-tehran07_T2star.nii.gz.log
Started at 12h40m36s: sub-tehran07_T2w.nii.gz. See log file /home/sahar/spineGeneric_results/log/process_data_sub-tehran07_T2w.nii.gz.log
Started at 12h40m36s: sub-tehran07_acq-MToff_MTS.json. See log file /home/sahar/spineGeneric_results/log/process_data_sub-tehran07_acq-MToff_MTS.json.log
Started at 12h40m36s: sub-tehran07_T1w.nii.gz. See log file /home/sahar/spineGeneric_results/log/process_data_sub-tehran07_T1w.nii.gz.log
Started at 12h40m36s: sub-tehran07_acq-MTon_MTS.json. See log file /home/sahar/spineGeneric_results/log/process_data_sub-tehran07_acq-MTon_MTS.json.log
Started at 12h40m36s: sub-tehran07_acq-T1w_MTS.json. See log file /home/sahar/spineGeneric_results/log/process_data_sub-tehran07_acq-T1w_MTS.json.log
Started at 12h40m36s: sub-tehran07_T2star.json. See log file /home/sahar/spineGeneric_results/log/process_data_sub-tehran07_T2star.json.log
Started at 12h40m36s: sub-tehran07_T1w.json. See log file /home/sahar/spineGeneric_results/log/process_data_sub-tehran07_T1w.json.log
Started at 12h40m36s: sub-tehran07_T2w.json. See log file /home/sahar/spineGeneric_results/log/process_data_sub-tehran07_T2w.json.log
Started at 12h40m36s: sub-tehran07_acq-MTon_MTS.nii.gz. See log file /home/sahar/spineGeneric_results/log/process_data_sub-tehran07_acq-MTon_MTS.nii.gz.log
Started at 12h40m36s: sub-tehran07_acq-T1w_MTS.nii.gz. See log file /home/sahar/spineGeneric_results/log/process_data_sub-tehran07_acq-T1w_MTS.nii.gz.log
Started at 12h40m36s: sub-tehran07_acq-MToff_MTS.nii.gz. See log file /home/sahar/spineGeneric_results/log/process_data_sub-tehran07_acq-MToff_MTS.nii.gz.log

Your batch completed but some subjects may have not completed successfully, please consult the logs for:
sub-tehran07_T2star.nii.gz
sub-tehran07_T2w.nii.gz
sub-tehran07_acq-MToff_MTS.json
sub-tehran07_T1w.nii.gz
sub-tehran07_T2star.json
sub-tehran07_acq-MTon_MTS.json
sub-tehran07_acq-T1w_MTS.json
sub-tehran07_T1w.json
sub-tehran07_T2w.json
sub-tehran07_acq-MTon_MTS.nii.gz
sub-tehran07_acq-T1w_MTS.nii.gz
sub-tehran07_acq-MToff_MTS.nii.gz

Started: 12h40m36s | Ended: 12h40m36s | Duration: 00h00m00s

To open the Quality Control (QC) report on a web-browser,

ERROR- Log file:
set -e -o pipefail

  • trap ‘echo Caught Keyboard Interrupt within script. Exiting now.; exit’ INT
  • SUBJECT=sub-tehran07_acq-MToff_MTS.json
    ++ date +%s
  • start=1602013236
  • sct_check_dependencies -short
    /home/sahar/Downloads/spine-generic/process_data.sh: line 128: sct_check_dependencies: command not found

sct_check_dependencies: command not found

it seems like SCT is not properly installed. You should not call SCT commands by pointing to their /bin folder, as you do here:

‘/home/sahar/spinalcordtoolbox/bin/sct_run_batch’ -jobs -1 -path-data ‘/home/sahar/sub-tehran07/anat’ -path-output ~/spineGeneric_results/ -script ‘/home/sahar/Downloads/spine-generic/process_data.sh’

Could you:

  • run ./install_sct again
  • copy/paste the terminal output here
  • open a new terminal after finishing installation
  • re-run: sct_run_batch -jobs -1 -path-data /home/sahar/sub-tehran07/anat -path-output ~/spineGeneric_results/ -script /home/sahar/Downloads/spine-generic/process_data.sh
  • copy/paste terminal output here

Ok, Thanks.

Hi, I run the SCT4.3 again. But I have the error yet.

sahar@ubuntu:~$ sct_check_dependencies


Spinal Cord Toolbox (4.3)

SCT info:

  • version: 4.3
  • path: /home/sahar/sct_4.3
    OS: linux (Linux-5.4.0-48-generic-x86_64-with-debian-bullseye-sid)
    CPU cores: Available: 4, Used by SCT: 4
    RAM: MemTotal: 4612552 kB
    total used free shared buff/cache available
    Mem: 4504 938 2799 2 766 3280
    Swap: 2047 0 2047
    Check Python executable…[OK]
    Using bundled python 3.6.12 |Anaconda, Inc.| (default, Sep 8 2020, 23:10:56)
    [GCC 7.3.0] at /home/sahar/sct_4.3/python/envs/venv_sct/bin/python
    Check if data are installed…[OK]
    Check if numpy is installed…[OK] (1.18.5)
    Check if colored is installed…[OK] (1.4.2)
    Check if dipy is installed…[OK] (1.1.1)
    Check if futures is installed…[OK]
    Check if h5py is installed…[OK] (2.10.0)
    Check if ivadomed (1.2.1) is installed…[OK] (1.2.1)
    Check if Keras (2.1.5) is installed…[OK] (2.1.5)
    Check if matplotlib is installed…[OK] (3.2.1)
    Check if nibabel is installed…[OK] (3.1.0)
    Check if pandas is installed…[OK] (1.0.4)
    Check if pyqt5 (5.11.3) is installed…[OK] (5.11.3)
    Check if pytest is installed…[OK] (5.4.3)
    Check if pytest-cov is installed…[OK] (2.9.0)
    Check if raven is installed…[OK]
    Check if requests is installed…[OK] (2.23.0)
    Check if requirements-parser is installed…[OK] (0.2.0)
    Check if scipy is installed…[OK] (1.4.1)
    Check if scikit-image is installed…[OK] (0.17.2)
    Check if scikit-learn is installed…[OK] (0.23.1)
    Check if tensorflow (1.5.0) is installed…[OK] (1.5.0)
    Check if torch (1.5.0+cpu) is installed…[OK] (1.5.0+cpu)
    Check if torchvision (0.6.0+cpu) is installed…[OK] (0.6.0+cpu)
    Check if xlwt is installed…[OK] (1.3.0)
    Check if tqdm is installed…[OK] (4.46.1)
    Check if transforms3d is installed…[OK] (0.3.1)
    Check if urllib3 is installed…[OK] (1.25.9)
    Check if spinalcordtoolbox is installed…[OK]
    Check ANTs compatibility with OS …[OK]
    Check PropSeg compatibility with OS …[OK]
    Check if DISPLAY variable is set…[OK]
    Check if figure can be opened with PyQt…[OK]

sahar@ubuntu:~$

sahar@ubuntu:~$ sct_run_batch -jobs -1 -path-data ‘/home/sahar/tehran_spineGeneric/’ -path-output ~/spineGeneric_results/ ‘/home/sahar/spine-generic/process_data.sh’
Running sub-teh01. See log file /home/sahar/spineGeneric_results/log/process_data_sub-teh01.log
multiprocessing.pool.RemoteTraceback:
“”"
Traceback (most recent call last):
File “/home/sahar/sct_4.3/python/envs/venv_sct/lib/python3.6/multiprocessing/pool.py”, line 119, in worker
result = (True, func(*args, **kwds))
File “/home/sahar/sct_4.3/python/envs/venv_sct/lib/python3.6/multiprocessing/pool.py”, line 44, in mapstar
return list(map(*args))
File “/home/sahar/sct_4.3/scripts/sct_run_batch.py”, line 140, in run_single
assert res.returncode == 0, ‘Processing of subject {} failed’.format(subject)
AssertionError: Processing of subject sub-teh01 failed
“”"

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

Traceback (most recent call last):
File “/home/sahar/sct_4.3/scripts/sct_run_batch.py”, line 152, in
p.map(run_single, subject_dirs)
File “/home/sahar/sct_4.3/python/envs/venv_sct/lib/python3.6/multiprocessing/pool.py”, line 266, in map
return self._map_async(func, iterable, mapstar, chunksize).get()
File “/home/sahar/sct_4.3/python/envs/venv_sct/lib/python3.6/multiprocessing/pool.py”, line 644, in get
raise self._value
AssertionError: Processing of subject sub-teh01 failed
sahar@ubuntu:~$


ERROR-Log
set -e -o pipefail

  • trap ‘echo Caught Keyboard Interrupt within script. Exiting now.; exit’ INT
  • SUBJECT=sub-teh01
    ++ date +%s
  • start=1602084737
  • sct_check_dependencies -short


Spinal Cord Toolbox (4.3)

usage: sct_check_dependencies [-h] [-c]
sct_check_dependencies: error: unrecognized arguments: -short
SCT info:

  • version: 4.3
  • path: /home/sahar/sct_4.3

Hi,

the flag -short in sct_check_dependencies was introduced after v4.3. So either you use SCT version from master (latest), or you remove the flag -short from your processing script.

I installed SCT4.3 from the package (https://spinalcordtoolbox.com/en/latest/user_section/installation.html)
and I do not remove the -short flag. It is exactly my process_data.sh part:

vailable
sct_check_dependencies -short

# Go to folder where data will be copied and processed
cd $PATH_DATA_PROCESSED
# Copy list of participants in processed data folder
if [[ ! -f "participants.tsv" ]]; then
  rsync -avzh $PATH_DATA/participants.tsv .
fi
# Copy list of participants in restuls folder (used by spine-generic scripts)
if [[ ! -f $PATH_RESULTS/"participants.tsv" ]]; then
  rsync -avzh $PATH_DATA/participants.tsv $PATH_RESULTS/"participants.tsv"
fi
# Copy source images
rsync -avzh $PATH_DATA/$SUBJECT .
# Go to anat folder where all structural data are located
cd ${SUBJECT}/anat/

@Sahar what i meant is that the flag -short is not available in v4.3. So you need to remove it.

also: when you copy/paste code please use “~~~” to format code for easy reading

thx

Sorry for both mistakes.
Ok, I will remove it.
Thanks.

I’m so so sorry for annoying you. But the solution could not help me.

After removing the flag -short: nothing happened. I think something wrong with the part of sct_check_dependencies in process_data.sh.

“~~~”
sahar@ubuntu:~$ sct_run_batch -jobs -1 -path-data ‘/home/sahar/tehran_spineGeneric/’ -path-output ~/spineGeneric_results/ ‘/home/sahar/spine-generic/process_data.sh’
Running sub-teh01. See log file /home/sahar/spineGeneric_results/log/process_data_sub-teh01.log
multiprocessing.pool.RemoteTraceback:
“”"
Traceback (most recent call last):
File “/home/sahar/sct_4.3/python/envs/venv_sct/lib/python3.6/multiprocessing/pool.py”, line 119, in worker
result = (True, func(*args, **kwds))
File “/home/sahar/sct_4.3/python/envs/venv_sct/lib/python3.6/multiprocessing/pool.py”, line 44, in mapstar
return list(map(*args))
File “/home/sahar/sct_4.3/scripts/sct_run_batch.py”, line 140, in run_single
assert res.returncode == 0, ‘Processing of subject {} failed’.format(subject)
AssertionError: Processing of subject sub-teh01 failed
“”"

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

Traceback (most recent call last):
File “/home/sahar/sct_4.3/scripts/sct_run_batch.py”, line 152, in
p.map(run_single, subject_dirs)
File “/home/sahar/sct_4.3/python/envs/venv_sct/lib/python3.6/multiprocessing/pool.py”, line 266, in map
return self._map_async(func, iterable, mapstar, chunksize).get()
File “/home/sahar/sct_4.3/python/envs/venv_sct/lib/python3.6/multiprocessing/pool.py”, line 644, in get
raise self._value
AssertionError: Processing of subject sub-teh01 failed

“~~~”
trap ‘echo Caught Keyboard Interrupt within script. Exiting now.; exit’ INT

  • SUBJECT=sub-teh01
    ++ date +%s
  • start=1602096132
  • sct_check_dependencies


Spinal Cord Toolbox (4.3)

SCT info:

  • version: 4.3
  • path: /home/sahar/sct_4.3
    OS: linux (Linux-5.4.0-48-generic-x86_64-with-debian-bullseye-sid)
    CPU cores: Available: 8, Used by SCT: 1
    RAM: MemTotal: 4612544 kB
    total used free shared buff/cache available
    Mem: 4504 976 2281 2 1246 3240
    Swap: 2047 0 2047
    Check Python executable…[e[92mOKe[0m]
    Using bundled python 3.6.12 |Anaconda, Inc.| (default, Sep 8 2020, 23:10:56)
    [GCC 7.3.0] at /home/sahar/sct_4.3/python/envs/venv_sct/bin/python
    Check if data are installed…[e[92mOKe[0m]
    Check if numpy is installed…[e[92mOKe[0m] (1.18.5)
    Check if colored is installed…[e[92mOKe[0m] (1.4.2)
    Check if dipy is installed…[e[92mOKe[0m] (1.1.1)
    Check if futures is installed…[e[92mOKe[0m]
    Check if h5py is installed…[e[92mOKe[0m] (2.10.0)
    Check if ivadomed (1.2.1) is installed…[e[92mOKe[0m] (1.2.1)
    Check if Keras (2.1.5) is installed…[e[92mOKe[0m] (2.1.5)
    Check if matplotlib is installed…[e[92mOKe[0m] (3.2.1)
    Check if nibabel is installed…[e[92mOKe[0m] (3.1.0)
    Check if pandas is installed…[e[92mOKe[0m] (1.0.4)
    Check if pyqt5 (5.11.3) is installed…[e[92mOKe[0m] (5.11.3)
    Check if pytest is installed…[e[92mOKe[0m] (5.4.3)
    Check if pytest-cov is installed…[e[92mOKe[0m] (2.9.0)
    Check if raven is installed…[e[92mOKe[0m]
    Check if requests is installed…[e[92mOKe[0m] (2.23.0)
    Check if requirements-parser is installed…[e[92mOKe[0m] (0.2.0)
    Check if scipy is installed…[e[92mOKe[0m] (1.4.1)
    Check if scikit-image is installed…[e[92mOKe[0m] (0.17.2)
    Check if scikit-learn is installed…[e[92mOKe[0m] (0.23.1)
    Check if tensorflow (1.5.0) is installed…[e[92mOKe[0m] (1.5.0)
    Check if torch (1.5.0+cpu) is installed…[e[92mOKe[0m] (1.5.0+cpu)
    Check if torchvision (0.6.0+cpu) is installed…[e[92mOKe[0m] (0.6.0+cpu)
    Check if xlwt is installed…[e[92mOKe[0m] (1.3.0)
    Check if tqdm is installed…[e[92mOKe[0m] (4.46.1)
    Check if transforms3d is installed…[e[92mOKe[0m] (0.3.1)
    Check if urllib3 is installed…[e[92mOKe[0m] (1.25.9)
    Check if spinalcordtoolbox is installed…[e[92mOKe[0m]
    Check ANTs compatibility with OS …[e[92mOKe[0m]
    Check PropSeg compatibility with OS …[e[92mOKe[0m]
    Check if DISPLAY variable is set…[e[92mOKe[0m]
    Check if figure can be opened with PyQt…[e[92mOKe[0m]
  • cd
  • [[ ! -f participants.tsv ]]
  • rsync -avzh /home/sahar/tehran_spineGeneric/participants.tsv .
    sending incremental file list
    rsync: link_stat “/home/sahar/tehran_spineGeneric/participants.tsv” failed: No such file or directory (2)

sent 18 bytes received 12 bytes 60.00 bytes/sec
total size is 0 speedup is 0.00
rsync error: some files/attrs were not transferred (see previous errors) (code 23) at main.c(1207) [sender=3.1.3]

your error is indicated here:

ps: if you wish to display code, it is ~~~ (not “~~~”)

I have no “participants.tsv” in my Bids file. How can I get it?
Is there something wrong with my dcm2bids output(tehran_spineGeneric) thorough the processing !?

If you have no participants.tsv, you can create one.

Alternatively, if you consider you don’t need it, you can simply remove the line of code in your process_data.sh with the rsync to copy the participants.tsv.

Ok great,
let me try it.
Thank you.