Can't run snakemake (or cutadapt) inside a singularity container - Permission denied

168 views
Skip to first unread message

Elsa Claude

unread,
Feb 4, 2021, 10:20:22 AM2/4/21
to singularity

I'm trying to wrap my snakemake pipeline into a singularity container. But I'm not even able to summon snakemake when I want to run my container. During building there is no problem snakemake is here, I can see the snakemake --version print. But when I run my singularity container... I have this issue :

/.singularity.d/runscript: 3: snakemake: Permission denied

Here is the (minimum) def file to reproduce the error :

BootStrap: debootstrap
OSVersion: focal

%runscript
    snakemake --version
%post
    apt-get -y install software-properties-common
    add-apt-repository universe
    apt update
    apt-get -y install python3-pip
    update-alternatives --install /usr/bin/python python /usr/bin/python3.8 2

    python --version
    python -m pip install --user --upgrade cutadapt
    python -m pip install --user --upgrade snakemake

%environment
    PATH="/root/.local/bin/:$PATH"

  I tried various things such as (sometimes awkward, but I'm desperate ahah) :

  • chmod 777 /root/.local/bin/snakemake
  • call snakemake like : /root/.local/bin/snakemake

I'm using singularity version 3.7.0

Could someone help me ? Have a nice day !!

Kandes, Martin

unread,
Feb 4, 2021, 10:31:47 AM2/4/21
to singularity
Hi Elsa,

You should remove the --user flags on your pip installs. When building the container, it is built as root. So applying --user will install the packages in the root user's .local python package library. But when you run the container on some system, you will not be running the container as the root user. Removing the --user flags will install the packages within the container such that any user can run the container and use them.

Marty

From: Elsa Claude <elsacl...@gmail.com>
Sent: Thursday, February 4, 2021 7:20 AM
To: singularity <singu...@lbl.gov>
Subject: [Singularity] Can't run snakemake (or cutadapt) inside a singularity container - Permission denied
 
--
You received this message because you are subscribed to the Google Groups "singularity" group.
To unsubscribe from this group and stop receiving emails from it, send an email to singularity...@lbl.gov.
To view this discussion on the web visit https://groups.google.com/a/lbl.gov/d/msgid/singularity/b3da1460-f339-4e50-aec0-87e581672a44n%40lbl.gov.

Elsa Claude

unread,
Feb 4, 2021, 10:54:33 AM2/4/21
to singularity, Kandes, Martin
Great !!
It works perfectly now !

Thanks Marty, have a nice day :) 

Reply all
Reply to author
Forward
0 new messages