Running an older version of C-PAC (V1.3.0)

Summary of what happened:

Hello All, I am trying to replicate some analysis done on the HBN data with C-PAC, I have the pipeline configuration file for that analysis, which states that it was running on C-PAC V1.3.0. I am currently using the latest container with C-PAC V1.8.6 using singularity. Unfortunately, the pipeline exits and throws an error. I have also tried running my container with the default pipeline of C-PAC V1.3.0, which also exited with a different error. I can provide you with the specific configuration files and errors if necessary.
but more importantly, Is there a way to perhaps pull an old container that has C-PAC version 1.3.0 so that I can use it for replication?
Thanks in Advance!

Command used:

singularity run -B /home/ammar/cpac_inputs:/bids_dataset -B /home/ammar/cpac_outputs:/outputs -B /tmp:/tmp c-pac-latest.simg /bids_dataset /outputs participant --pipeline-file /home/ammar/cpac_inputs/pipeline_config.yml

and similarly with the other config file:

singularity run -B /home/ammar/cpac_inputs:/bids_dataset -B /home/ammar/cpac_outputs:/outputs -B /tmp:/tmp c-pac-latest.simg /bids_dataset /outputs participant --pipeline-file /home/ammar/cpac_inputs/pipeline_config_cpac_default_1.3.0.yml

Version:

C-PAC Version 1.8.6
Singularity Version 2.6.1-dist

Environment : Singularity


C-PAC Version 1.3.0 is actually the oldest version for which we have a published container. You can pull a Singularity version like

singularity pull docker://fcpindi/c-pac:release-v1.3.0

C-PAC’s pipeline configuration file schema changes (usually in small ways) with each release, including a complete overhaul in version 1.8.0, so if you’re looking to replicate a prior analysis, using the same version is probably the way to go.


If you do want to upgrade a configuration to a recent version of C-PAC, there is a page in the documentation that articulates the mappings from a C-PAC 1.7.2 pipeline configuration to a C-PAC 1.8.0 configuration.

In the newer versions, you don’t need to configure options you aren’t using. You can start a pipeline configuration with

FROM: blank

to set every option to default to be inactive, then fill out just what you want to be configured.

Unless you’re adding options that didn’t exist in 1.3.0 to your configuration, most of the keys should be the same (or nearly the same) in 1.7.2 as in 1.3.0, so the update-mappings should mostly be applicable (the changes from version to version are typically additive).

Thanks a lot for your help!

I successfully pulled the old image (C-PAC 1.3.0), but then using it to run the replication analysis, or using it with the default pipeline, produce the same error.

commands used:

run using the default config file

singularity run -B /home/ammar/cpac_inputs:/bids_dataset -B /home/ammar/cpac_outputs:/outputs -B /tmp:/tmp c-pac-release-v1.3.0.simg /bids_dataset /outputs participant

run using config file for replication

singularity run -B /home/ammar/cpac_inputs:/bids_dataset -B /home/ammar/cpac_outputs:/outputs -B /tmp:/tmp c-pac-release-v1.3.0.simg /bids_dataset /outputs participant --pipeline_file /home/ammar/cpac_inputs/replication_pipeline.yml

full error:

Running BIDS validator
/usr/lib/node_modules/bids-validator/node_modules/yargs/lib/command.js:22
    globalMiddleware.push(...middlewares)
                          ^^^

SyntaxError: Unexpected token ...
    at exports.runInThisContext (vm.js:53:16)
    at Module._compile (module.js:373:25)
    at Object.Module._extensions..js (module.js:416:10)
    at Module.load (module.js:343:32)
    at Function.Module._load (module.js:300:12)
    at Module.require (module.js:353:17)
    at require (internal/module.js:12:17)
    at Object.<anonymous> (/usr/lib/node_modules/bids-validator/node_modules/yargs/lib/argsert.js:2:17)
    at Module._compile (module.js:409:26)
    at Object.Module._extensions..js (module.js:416:10)

#### Running C-PAC
Number of participants to run in parallel: 1
Input directory: /bids_dataset
Output directory: /outputs/output
Working directory: /scratch/working
Crash directory: /outputs/crash
Log directory: /outputs/log
Remove working directory: True
Available memory: 6.0 (GB)
Available threads: 1
Number of threads for ANTs: 1
/usr/local/miniconda/lib/python2.7/site-packages/matplotlib/__init__.py:1405: UserWarning: 
This call to matplotlib.use() has no effect because the backend has already
been chosen; matplotlib.use() must be called *before* pylab, matplotlib.pyplot,
or matplotlib.backends is imported for the first time.

  warnings.warn(_use_error_msg)
Traceback (most recent call last):
  File "/code/run.py", line 374, in <module>
    from nipype.pipeline.plugins.callback_log import log_nodes_cb
ImportError: No module named callback_log

Thanks again, your help is much appreciated.

That error has to do with out-of-sync versions of Node.js and bids-validator in the C-PAC v1.3.0 container.

Thanks for bringing this issue to our attention. In looking into the issue, I discovered that we inadvertently removed the bids-validator CLI, so trying to run with the BIDS validator in versions 1.8.6 and 1.8.7 will fail as well.

I think the best way forward for this use case is to add the optional argument --skip_bids_validator to your run command, optionally using the BIDS validator outside of C-PAC first.

1 Like

Thanks again for your help. I added that argument, it seems that another part of the error still persists.

Namespace(analysis_level='participant', aws_input_creds=None, aws_output_creds=None, bids_dir='/bids_dataset', bids_validator_config=None, data_config_file=None, disable_file_logging=False, mem_gb=None, mem_mb=None, n_cpus='1', output_dir='/outputs', participant_label=None, participant_ndx=None, pipeline_file='/cpac_resources/default_pipeline.yaml', save_working_dir=False, skip_bids_validator=True)
skipping bids-validator...
#### Running C-PAC
Number of participants to run in parallel: 1
Input directory: /bids_dataset
Output directory: /outputs/output
Working directory: /scratch/working
Crash directory: /outputs/crash
Log directory: /outputs/log
Remove working directory: True
Available memory: 6.0 (GB)
Available threads: 1
Number of threads for ANTs: 1
/usr/local/miniconda/lib/python2.7/site-packages/matplotlib/__init__.py:1405: UserWarning: 
This call to matplotlib.use() has no effect because the backend has already
been chosen; matplotlib.use() must be called *before* pylab, matplotlib.pyplot,
or matplotlib.backends is imported for the first time.

  warnings.warn(_use_error_msg)
Traceback (most recent call last):
  File "/code/run.py", line 374, in <module>
    from nipype.pipeline.plugins.callback_log import log_nodes_cb
ImportError: No module named callback_log

It looks like there was a bug in the 1.3.0 release that was fixed in the then-latest release but a persistent tag wasn’t added until 1.4.0.

I rebuilt 1.3.0 with the fix for FCP-INDI/C-PAC#844 and resynced the Node.js/bids-validator versions while was at it.

Can you give fcpindi/c-pac:release-v1.3.0.post2 a try and see if it works for you?

Hello, Thanks again for your tremendous help.
Sorry it took me so long to reply, I ran into a couple of things that I wanted to understand/fix. your help with the following is much appreciated.

I started encountering an error with version 1.3.0, wether using its default pipeline, or the replication pipeline that I ultimately want to run. I fixed this error by making a directory on my machine and binding it to the scratch/working directory in the command, I am just including this for completion, also, this error and fix are not needed for the latest container (CPAC v1.8.3).

Command: running default pipeline without binding scratch/working:

singularity run -B /home/ammar/cpac_inputs:/bids_dataset -B /home/ammar/cpac_outputs:/outputs -B /tmp:/tmp -B /home/ammar/cpac_outputs/log:/log c-pac-release-v1.3.0.post2.simg /bids_dataset /outputs participant --pipeline_file /home/ammar/cpac_inputs/default_pipeline_1.3.0.yml --skip_bids_validator

Error:

Namespace(analysis_level='participant', aws_input_creds=None, aws_output_creds=None, bids_dir='/bids_dataset', bids_validator_config=None, data_config_file=None, disable_file_logging=False, mem_gb=None, mem_mb=None, n_cpus='1', output_dir='/outputs', participant_label=None, participant_ndx=None, pipeline_file='/home/ammar/cpac_inputs/default_pipeline_1.3.0.yml', save_working_dir=False, skip_bids_validator=True)
skipping bids-validator...
#### Running C-PAC
Number of participants to run in parallel: 1
Input directory: /bids_dataset
Output directory: /outputs/output
Working directory: /scratch/working
Crash directory: /outputs/crash
Log directory: /outputs/log
Remove working directory: True
Available memory: 6.0 (GB)
Available threads: 1
Number of threads for ANTs: 1
Starting participant level processing
Traceback (most recent call last):
  File "/code/run.py", line 388, in <module>
    plugin='MultiProc', plugin_args=plugin_args)
  File "/code/CPAC/pipeline/cpac_runner.py", line 481, in run
    raise Exception(err)
Exception: 

[!] CPAC says: Could not create the working directory: /scratch/working

Make sure you have permissions to write to this directory.

Unfortunately, after fixing the former error with the binding step, it still fails eventually, with different errors for the default pipeline of 1.3.0 and the replication pipeline.

Command: replication run with CPAC v1.3.0:

singularity run -B /home/ammar/cpac_inputs:/bids_dataset -B /home/ammar/cpac_outputs:/outputs -B /tmp:/tmp -B /home/ammar/cpac_outputs/scratch/working:/scratch/working c-pac-release-v1.3.0.post2.simg /bids_dataset /outputs participant --pipeline_file /home/ammar/cpac_inputs/replication_pipeline.yml --skip_bids_validator

Error:

Namespace(analysis_level='participant', aws_input_creds=None, aws_output_creds=None, bids_dir='/bids_dataset', bids_validator_config=None, data_config_file=None, disable_file_logging=False, mem_gb=None, mem_mb=None, n_cpus='1', output_dir='/outputs', participant_label=None, participant_ndx=None, pipeline_file='/home/ammar/cpac_inputs/replication_pipeline.yml', save_working_dir=False, skip_bids_validator=True)
skipping bids-validator...
#### Running C-PAC
Number of participants to run in parallel: 1
Input directory: /bids_dataset
Output directory: /outputs/output
Working directory: /scratch/working
Crash directory: /outputs/crash
Log directory: /outputs/log
Remove working directory: True
Available memory: 6.0 (GB)
Available threads: 1
Number of threads for ANTs: 1
Starting participant level processing
Traceback (most recent call last):
  File "/code/run.py", line 388, in <module>
    plugin='MultiProc', plugin_args=plugin_args)
  File "/code/CPAC/pipeline/cpac_runner.py", line 419, in run
    strategies = sorted(build_strategies(c))
  File "/code/CPAC/pipeline/cpac_runner.py", line 112, in build_strategies
    '_threshold': configuration.spikeThreshold,
AttributeError: 'Configuration' object has no attribute 'spikeThreshold'

after debugging the latter error, I found that the formatting of the nuisance regressors part is different between the replication pipeline I want to use, and the default pipeline of CPAC v1.3.0. Kindly note the replication pipeline I am trying right now is that of The HBN dataset. I got that from connecting to their S3 bucket via cyberduck, it can be found under cpac_deriv folder. While I can try to make those changes myself, I just wanted to check maybe you would have some more info or an easier way? Thanks!

on the other hand, running default pipeline of CPAC v1.3.0 or v1.8.3 with their respective containers causes an error, which I think is related to nypipe. the commands are included in the following. the error for both of them is similar, the error for the v1.3.0 is included in the attachment, along with log file contents (pipeline.log).

Command: default pipeline run v1.3.0

singularity run -B /home/ammar/cpac_inputs:/bids_dataset -B /home/ammar/cpac_outputs:/outputs -B /tmp:/tmp -B /home/ammar/cpac_outputs/scratch/working:/scratch/working c-pac-release-v1.3.0.post2.simg /bids_dataset /outputs participant --skip_bids_validator

Command: default pipeline run v1.8.3

singularity run -B /home/ammar/cpac_inputs:/bids_dataset -B /home/ammar/cpac_outputs:/outputs -B /tmp:/tmp c-pac-latest.simg /bids_dataset /outputs participant --skip_bids_validator

Finally, thanks again for your help, sorry if my post is a bit too long, kindly note that my main goal is to run the replication pipeline as mentioned earlier, and everything else is included for reference.

EDIT: I can not attach files, and the error + log file content are too big to be posted here. please let me know how can I send them if you need them.

It would be helpful if you’re able to share the error and log files. Maybe GitHub Gist or PasteBin would work?

Sure thing!

v1.3.0:

you can find the command and error of V1.3.0 Here.
The generated pypeline.log file for this run can be found Here

for v1.8.3, I ran it again just to be sure as I think I confused something and needed to be sure. I will provide you with errors/log files if any once I have them.

Thanks again, Best!

Thanks for the additional information.

v1.3.0

Usually the earliest error in a run causes subsequent errors.

The earliest error I see in those logs

240529-20:52:18,162 nipype.workflow WARNING:
	 [Node] Error on "resting_preproc_sub-NDARXE684LUY_ses-1.scan_params_0" (/scratch/working/resting_preproc_sub-NDARXE684LUY_ses-1/_scan_task-rest/scan_params_0)
240529-20:52:19,820 nipype.workflow ERROR:
	 Node scan_params_0.c0 failed to run on host grid02.
240529-20:52:19,826 nipype.workflow ERROR:
	 Saving crash info to /outputs/crash/crash-20240529-205219-ammar-scan_params_0.c0-987934ed-1fbb-43ab-be49-73e643ec0c11.pklz
Traceback (most recent call last):
  File "/usr/local/miniconda/lib/python2.7/site-packages/nipype/pipeline/plugins/multiproc.py", line 69, in run_node
    result['result'] = node.run(updatehash=updatehash)
  File "/usr/local/miniconda/lib/python2.7/site-packages/nipype/pipeline/engine/nodes.py", line 471, in run
    result = self._run_interface(execute=True)
  File "/usr/local/miniconda/lib/python2.7/site-packages/nipype/pipeline/engine/nodes.py", line 555, in _run_interface
    return self._run_command(execute)
  File "/usr/local/miniconda/lib/python2.7/site-packages/nipype/pipeline/engine/nodes.py", line 635, in _run_command
    result = self._interface.run(cwd=outdir)
  File "/usr/local/miniconda/lib/python2.7/site-packages/nipype/interfaces/base/core.py", line 521, in run
    runtime = self._run_interface(runtime)
  File "/code/CPAC/utils/function.py", line 158, in _run_interface
    out = function_handle(**args)
  File "/code/CPAC/utils/utils.py", line 1521, in get_scan_params
    TR = float(check(params_dct, subject_id, scan, 'TR', False))
  File "/code/CPAC/utils/utils.py", line 1402, in check
    if isinstance(params_dct[val], dict):
KeyError: 'TR'
looks like there's a problem with C-PAC parsing the scan parameters. Is there a generated data configuration file in the log directory? If so, could you share that?

v1.8.3

I see you’re running c-pac-latest.simg for 1.8.3. If you’re not using 1.8.3 for a particular reason and want to run actual-latest, you can update your image to get 1.8.7, released earlier this month.

Thanks for the speedy response, the generated data config file can be found here.
PS: the is the contents of the file cpac_outputs/cpac_data_config_20240530175929.yml
and I am running the pipeline on two subjects, as can be seen in the file.

Thanks for the data config. It looks like there’s some disconnect with the naming convention for RepetitionTime and where it’s crashing C-PAC v1.3.0.post2 is expecting the metadata be keyed TR. Can you give fcpindi/c-pac:release-v1.3.0.post3.dev1 a try? I just added a conditional block to give RepetitionTime if we have that and not TR when we’re looking for TR.