Search code examples
pythoncondasnakemakevirtual-environment

Snakemake with integrated conda env not properly installed


I have a rule in my snakemake pipeline to run multiqc :

    rule summaryReport:
        input:
            fastqc_forward = expand(final_path + "/fastqc/{sample}_R1_fastqc.html", sample = samples),
            fastqc_rev = expand(final_path + "/fastqc/{sample}_R2_fastqc.html", sample = samples)
        output:
            report = final_path + "/fastqc/report_quality_control.html"
        params:
            path = final_path + "/fastqc"
        conda:
            "multiqc.yaml"
        shell:
            "multiqc {params.path} --filename {output.report}"

with the conda env file multiqc.yaml :

name: multiqc 
channels:
  - conda-forge
  - bioconda
dependencies:
  - multiqc=1.12

When I run the pipeline I've got the following error :

Activating conda environment: /XXXX/.snakemake/conda/e8f3e6def45259d12dddd42fcd679657
Traceback (most recent call last):
  File "/XXXX/.snakemake/conda/e8f3e6def45259d12dddd42fcd679657/bin/multiqc", line 6, in <module>
    from multiqc.__main__ import multiqc
ModuleNotFoundError: No module named 'multiqc'

I've tested to activate the conda environment manually and indeed there is the same error when running multiqc.

I've tested to create a conda env thanks to "multiqc.yaml" outside snakemake, and in this case multiqc is running correctly.

If someone has an idea about this it would help me a lot!

Thank you in advance


Solution

  • You most likely want to install python as well, since according to docs it's not recommended to use the system-wide python:

    name: multiqc 
    channels:
      - conda-forge
      - bioconda
    dependencies:
      - python=3.7
      - multiqc=1.12