Skip to content

Mamba frontend does not raise proper error when environment is not created #581

@sergiigladchuk

Description

@sergiigladchuk

Snakemake version
5.22.1

Describe the bug
When snakemake is run with mamba frontend, and one of the packages in .yaml file is misspaled (or just missing in the channels) specified, snakemake output log shows that environment is created but then cannot use that environment. Current output is:

Not a conda environment: /home/sergii/Documents/bugs_test/snakemake_mamba/.snakemake/conda/1134ca3a
Which is confusing, since in the top of the log it says:

Creating conda environment main_r.yaml...
Downloading and installing remote packages.
Environment for main_r.yaml created (location: .snakemake/conda/1134ca3a)

The real bug is that I used r-sva name of the package in main_r.yaml, which does not exists (bioconductor-sva is the correct name). Basically the environment was not created, but Snakemake log says that it was.
And if running with standard conda frontend the error is clear:

ResolvePackageNotFound: 
  - r-sva

and no environment was created. I know that mamba is still in beta, but I would expect same behavior.

Logs
run command:
snakemake --use-conda --conda-frontend mamba -j 2

Snakemake log:

Building DAG of jobs...
Creating conda environment main_r.yaml...
Downloading and installing remote packages.
Environment for main_r.yaml created (location: .snakemake/conda/1134ca3a)
Using shell: /usr/bin/bash
Provided cores: 2
Rules claiming more threads will be scaled down.
Job counts:
	count	jobs
	1	test
	1

[Fri Aug 21 10:28:15 2020]
rule test:
    output: test.csv
    jobid: 0

Activating conda environment: /home/sergii/Documents/bugs_test/snakemake_mamba/.snakemake/conda/1134ca3a
Not a conda environment: /home/sergii/Documents/bugs_test/snakemake_mamba/.snakemake/conda/1134ca3a
Error in library(sva) : there is no package called ‘sva’
Execution halted
[Fri Aug 21 10:28:18 2020]
Error in rule test:
    jobid: 0
    output: test.csv
    conda-env: /home/sergii/Documents/bugs_test/snakemake_mamba/.snakemake/conda/1134ca3a

RuleException:
CalledProcessError in line 8 of /home/sergii/Documents/bugs_test/snakemake_mamba/Snakefile:
Command 'source /home/sergii/anaconda3/bin/activate '/home/sergii/Documents/bugs_test/snakemake_mamba/.snakemake/conda/1134ca3a'; set -euo pipefail;  Rscript --vanilla /home/sergii/Documents/bugs_test/snakemake_mamba/.snakemake/scripts/tmp92fusjko.test_sva.R' returned non-zero exit status 1.
  File "/home/sergii/anaconda3/lib/python3.8/site-packages/snakemake/executors/__init__.py", line 2168, in run_wrapper
  File "/home/sergii/Documents/bugs_test/snakemake_mamba/Snakefile", line 8, in __rule_test
  File "/home/sergii/anaconda3/lib/python3.8/site-packages/snakemake/executors/__init__.py", line 529, in _callback
  File "/home/sergii/anaconda3/lib/python3.8/concurrent/futures/thread.py", line 57, in run
  File "/home/sergii/anaconda3/lib/python3.8/site-packages/snakemake/executors/__init__.py", line 515, in cached_or_run
  File "/home/sergii/anaconda3/lib/python3.8/site-packages/snakemake/executors/__init__.py", line 2199, in run_wrapper
Shutting down, this might take some time.
Exiting because a job execution failed. Look above for error message
Complete log: /home/sergii/Documents/bugs_test/snakemake_mamba/.snakemake/log/2020-08-21T102806.087796.snakemake.log

Minimal example

Snakefile

rule test:
    output:
        "test.csv"
    conda:
        "main_r.yaml"
    script:
        "test_sva.R"

main_r.yaml

channels:
  - conda-forge
  - bioconda
  - defaults
  - local
dependencies:
  - r-tidyverse
  - r-sva

test_sva.R

library(sva)
library(tidyverse)

1:10 %>% as_tibble() %>% write_csv(snakemake@output[[1]])

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions