-
Notifications
You must be signed in to change notification settings - Fork 1
Open
Assignees
@skchronicles
Description
About
We need to conditionally provide the --use-conda flag to snakemake here.
Why
If conda is not in the user's environment, snakemake will error out when running the pipeline with the following error:
Select jobs to execute...
[Fri Sep 5 15:37:31 2025]
rule setup:
input: /data/NIAMS_IDSS/projects/NIAMS-36_MT/modr_pipeline/970.fastq.gz
output: /data/NIAMS_IDSS/projects/NIAMS-36_MT/modr_pipeline/970/fastqs/970.fastq.gz
jobid: 6
reason: Missing output files: /data/NIAMS_IDSS/projects/NIAMS-36_MT/modr_pipeline/970/fastqs/970.fastq.gz
wildcards: name=970
threads: 2
resources: mem_mb=2290, mem_mib=2184, disk_mb=2290, disk_mib=2184, tmpdir=<TBD>
ln -sf /data/NIAMS_IDSS/projects/NIAMS-36_MT/modr_pipeline/970.fastq.gz /data/NIAMS_IDSS/projects/NIAMS-36_MT/modr_pipeline/970/fastqs/970.fastq.gz
/usr/bin/bash: conda: command not found
Traceback (most recent call last):
File "/usr/local/apps/snakemake/conda/envs/7.32.4/lib/python3.11/site-packages/snakemake/__init__.py", line 792, in snakemake
success = workflow.execute(
^^^^^^^^^^^^^^^^^
File "/usr/local/apps/snakemake/conda/envs/7.32.4/lib/python3.11/site-packages/snakemake/workflow.py", line 1246, in execute
raise e
File "/usr/local/apps/snakemake/conda/envs/7.32.4/lib/python3.11/site-packages/snakemake/workflow.py", line 1242, in execute
success = self.scheduler.schedule()
^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/apps/snakemake/conda/envs/7.32.4/lib/python3.11/site-packages/snakemake/scheduler.py", line 636, in schedule
self.run(runjobs)
File "/usr/local/apps/snakemake/conda/envs/7.32.4/lib/python3.11/site-packages/snakemake/scheduler.py", line 685, in run
executor.run_jobs(
File "/usr/local/apps/snakemake/conda/envs/7.32.4/lib/python3.11/site-packages/snakemake/executors/__init__.py", line 158, in run_jobs
self.run(
File "/usr/local/apps/snakemake/conda/envs/7.32.4/lib/python3.11/site-packages/snakemake/executors/__init__.py", line 1208, in run
self.write_jobscript(job, jobscript)
File "/usr/local/apps/snakemake/conda/envs/7.32.4/lib/python3.11/site-packages/snakemake/executors/__init__.py", line 932, in write_jobscript
exec_job = self.format_job_exec(job)
^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/apps/snakemake/conda/envs/7.32.4/lib/python3.11/site-packages/snakemake/executors/__init__.py", line 463, in format_job_exec
self.general_args,
^^^^^^^^^^^^^^^^^
File "/usr/local/apps/snakemake/conda/envs/7.32.4/lib/python3.11/site-packages/snakemake/common/__init__.py", line 217, in __get__
value = self.method(instance)
^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/apps/snakemake/conda/envs/7.32.4/lib/python3.11/site-packages/snakemake/executors/__init__.py", line 357, in general_args
w2a("conda_base_path", skip=not self.assume_shared_fs),
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/apps/snakemake/conda/envs/7.32.4/lib/python3.11/site-packages/snakemake/executors/__init__.py", line 317, in workflow_property_to_arg
value = getattr(self.workflow, property)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/apps/snakemake/conda/envs/7.32.4/lib/python3.11/site-packages/snakemake/workflow.py", line 456, in conda_base_path
return Conda().prefix_path
^^^^^^^
File "/usr/local/apps/snakemake/conda/envs/7.32.4/lib/python3.11/site-packages/snakemake/deployment/conda.py", line 653, in __init__
shell.check_output(self._get_cmd("conda info --json"), text=True)
File "/usr/local/apps/snakemake/conda/envs/7.32.4/lib/python3.11/site-packages/snakemake/shell.py", line 61, in check_output
return sp.check_output(cmd, shell=True, executable=executable, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/apps/snakemake/conda/envs/7.32.4/lib/python3.11/subprocess.py", line 466, in check_output
return run(*popenargs, stdout=PIPE, timeout=timeout, check=True,
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/apps/snakemake/conda/envs/7.32.4/lib/python3.11/subprocess.py", line 571, in run
raise CalledProcessError(retcode, process.args,
subprocess.CalledProcessError: Command 'conda info --json' returned non-zero exit status 127.
This is because if this option is provided, snakemake runs the following subprocess cmd even if the conda directive is not set within any of the rules:
conda info --json
Temporary fix
If you are running into this issue and you are using on singularity (and don't need to use conda), you can patch this by removing line 226 in the src/run.sh scrip.
Metadata
Metadata
Assignees
Labels
No labels