Apptainer and nextflow

Hello ,

i am trying to run the apptainer inside the nextflow, which strange error pops up. appreciate any help in this regard.

config file :slight_smile:

dag.enabled = true
dag.overwrite = true
apptainer.runOptions = "--bind /mainfs"
apptainer.autoMounts = true
apptainer.enabled = true

Nexflow file:

// fastqc_qcCheck
process fastq_qc {
    publishDir "${params.output}", mode: "copy", overwrite: true
    // debug true

    input:
    tuple val(sample), path(fastq_1), path(fastq_2)


    script:
    """
    singularity run fastqc ${params.singularity_image} -o ${params.output} ${fastq_1} ${fastq_2}
    """
}

// Define workflow
workflow {
    println """\
        R N A - S E Q - N F   P I P E L I N E
          ===================================
          I M A N --------------- N A Z A R I 
          ===================================
         Samples         : ${params.csv__}
         Singularity Image: ${params.singularity_image}
         """.stripIndent()

    // Display content of the CSV file
    println "CSV File Content:"
    Channel.fromPath(params.csv__, checkIfExists: true)
        .splitCsv(header: true, sep: ",")
        .map { row -> tuple(row.sample, row.fastq_1, row.fastq_2) } // Remove the file function
        .view()

    // Prepare inputs for the pipeline
    samples_ch = Channel.fromPath(params.csv__)
        .splitCsv(header: true, sep: ",")
        .map { row -> tuple(row.sample, file(row.fastq_1), file(row.fastq_2)) } // Use file function here
        .view()

    // Run the pipeline
    fastq_qc(samples_ch)
}

Error:

ERROR ~ Error executing process > 'fastq_qc (4)'

Caused by:
  Process `fastq_qc (4)` terminated with an error exit status (255)

Command executed:

  singularity run fastqc RNAseq_v1.sif -o singularity_RNAseq/nextflow/results NG81_ZKRN230007679-1A_HFHVNDSX7_L4_1.fq.gz NG81_ZKRN230007679-1A_HFHVNDSX7_L4_2.fq.gz

Command exit status:
  255

Command output:
  (empty)

Command error:
  FATAL:   Relocation not allowed with starter-suid

Work dir:
  singularity_RNAseq/nextflow/work/ec/85a7ef76233dd3941d8ff6acc9e155

Tip: when you have fixed the problem you can continue the execution adding the option `-resume` to the run command line

 -- Check '.nextflow.log' file for details

i can not understand the relocation error.

Regrads
Iman

You don’t need the singularity run in the script block. Nextflow will take care of that for you, because you said apptainer.enabled = true in the configuration file. You must also set the container image with the container process directive. Read more about Apptainer/Singularity support with examples here and here.

1 Like

Thanks for making it clear, but still problem exist :
Command error:
env: ‘apptainer’: No such file or directory

Do you have apptainer installed? If the binary you have is named singularity, you should have singularity.enabled = true in your configuration file (e.g. nextflow.config). One suggestion for debugging is checking your .nextflow.log or if a task started running (you have a task hash such as 57/670a9d, checking the .command.run inside and run the singularity command (search for singularity inside the file) outside Nextflow. Sometimes, it’s not a Nextflow issue and that’s a way to test this hypothesis.

1 Like

Thanks , solved

1 Like