Entering edit mode
12 months ago
Begonia_pavonina
▴
200
I have issues when running a wrapper of BWA mem with Snakemake. The error message "No module named 'snakemake_wrapper_utils'" appear (see below).
However, when checking if the package is installed in Python, I found the following:
import snakemake_wrapper_utils
print(snakemake_wrapper_utils.__version__)
0.1.0
Did anyone have this problem? Would you know why there is a module error, while the module is installed?
snakemake --cores all
Building DAG of jobs...
Using shell: /usr/bin/bash
Provided cores: 1 (use --cores to define parallelism)
Rules claiming more threads will be scaled down.
Conda environments: ignored
Job stats:
job count
------- -------
all 1
bwa_mem 3
total 4
Select jobs to execute...
[Thu Nov 2 17:43:16 2023]
rule bwa_mem:
input: reads/110627_0240_AC0254ABXX_2_SA-PE-001.1.fastq.gz, reads/110627_0240_AC0254ABXX_2_SA-PE-001.2.fastq.gz, genome.amb, genome.ann, genome.bwt, genome.pac, genome.sa
output: mapped/110627_0240_AC0254ABXX_2_SA-PE-001.bam
log: logs/bwa_mem/110627_0240_AC0254ABXX_2_SA-PE-001.log
jobid: 1
reason: Missing output files: mapped/110627_0240_AC0254ABXX_2_SA-PE-001.bam
wildcards: sample=110627_0240_AC0254ABXX_2_SA-PE-001
resources: tmpdir=/tmp/tmichel_8894483
Traceback (most recent call last):
File "/mnt/shared/scratch/usr/comp_baits_pseudo-chr/baits/.snakemake/scripts/tmpya0pk1fa.wrapper.py", line 14, in <module>
from snakemake_wrapper_utils.java import get_java_opts
ModuleNotFoundError: No module named 'snakemake_wrapper_utils'
[Thu Nov 2 17:43:21 2023]
Error in rule bwa_mem:
jobid: 1
input: reads/110627_0240_AC0254ABXX_2_SA-PE-001.1.fastq.gz, reads/110627_0240_AC0254ABXX_2_SA-PE-001.2.fastq.gz, genome.amb, genome.ann, genome.bwt, genome.pac, genome.sa
output: mapped/110627_0240_AC0254ABXX_2_SA-PE-001.bam
log: logs/bwa_mem/110627_0240_AC0254ABXX_2_SA-PE-001.log (check log file(s) for error details)
conda-env: /mnt/shared/scratch/usr/comp_baits_pseudo-chr/baits/.snakemake/conda/8ec8a2e6cccaa67a3428f1bf7dcc48b8_
RuleException:
CalledProcessError in file /mnt/shared/scratch/usr/comp_baits_pseudo-chr/baits/workflow/Snakefile, line 76:
Command 'set -euo pipefail; /mnt/shared/home/usr/mambaforge/envs/snakemake/bin/python3.12 /mnt/shared/scratch/usr/comp_baits_pseudo-chr/baits/.snakemake/scripts/tmpya0pk1fa.wrapper.py' returned non-zero exit status 1.
File "/mnt/shared/scratch/usr/comp_baits_pseudo-chr/baits/workflow/Snakefile", line 76, in __rule_bwa_mem
File "/mnt/shared/home/usr/mambaforge/envs/snakemake/lib/python3.12/concurrent/futures/thread.py", line 58, in run
Shutting down, this might take some time.
Exiting because a job execution failed. Look above for error message
Complete log: .snakemake/log/2023-11-02T174251.293416.snakemake.log
I noticed
conda-env
in the error message. Wrapper defines its own environment to run the wrapper, I'd remove theconda:
attribute from your rule and try again withsnakemake --use-conda
. Hopefully that fixes the issue.Thank you Eric Lim, I had a conda activate environement in the batch script I was using to run Snakemake. Unfortunately, removing it does not change the previous error.
I have noticed that adding "import snakemake_wrapper_utils" in the Snakefile trigger the error:
So there is definitely a problem with this module, which I can find in Python, but not running Snakemake.
Can you print
sys.path
both in python and within the snakemake script and see if the results are the same?Thank you Ram, I am not sure if I should have the same result.
In Snakemake:
In python:
You should really have done this on your own, but
import sys
thenprint(sys.path)
to address the error in the second case. The results should at least overlap.Ah, I did not know sys was a Python library. It is worth mentioning it.
I'm going to make a wild guess here. The
snakemake
env you have under thetmichel
home dir is different from thesnakemake
env you have with the/mnt/shared/
prefix. The latter is missing the required library.I think the two different environment are at the source of the problem indeed.
I am not sure it is due to a missing
snakemake_wrapper_utils
module, as I have installed it in both environment. But it might be related to the Python version loaded.There is a python2.5 in the
snakemake
environment, and I think it might cause thesnakemake_wrapper_utils
module not to be found. I am trying to find a way not to load python2.5.