2
$\begingroup$

I am using Snakemake from inside a Singularity container. Because of that, the directory that Snakemake wants to log to cannot be created, and I get an OSError [Errno 30] Read-only file system: '.snakemake, more specifically the traceback

Traceback (most recent call last):
  File "/usr/local/bin/snakemake", line 8, in <module>
    sys.exit(main())
  File "/usr/local/lib/python3.8/dist-packages/snakemake/__init__.py", line 2562, in main
    success = snakemake(
  File "/usr/local/lib/python3.8/dist-packages/snakemake/__init__.py", line 525, in snakemake
    logger.setup_logfile()
  File "/usr/local/lib/python3.8/dist-packages/snakemake/logging.py", line 137, in setup_logfile
    os.makedirs(os.path.join(".snakemake", "log"), exist_ok=True)
  File "/usr/lib/python3.8/os.py", line 213, in makedirs
    makedirs(head, exist_ok=exist_ok)
  File "/usr/lib/python3.8/os.py", line 223, in makedirs
    mkdir(name, mode)
OSError: [Errno 30] Read-only file system: '.snakemake'

The Snakefile I am using is inside a Singularity-container (there's no way around that, I am on a hpc and don't have root, also using a --sandboxed container doesn't work), and I call it like this (I've also played around with binding other directories without success):

singularity run --bind $(realpath .) --bind ~/container.sif ~/container.sif test_simple --cores 4 

The test_simple rule is a really simple one that only unzips a gzip, for testing - the problem however lies generally in Snakemake wanting to create the log at <snakemake_base>/.snakemake/log (see https://github.com/snakemake/snakemake/blob/bd5a9239b2684b57ab0143bb709e77afa1493cdc/snakemake/logging.py#L308), which in my case is inside the container.

It doesn't help to use an overlay --overlay overlay.img for some reason, and I've also tried using my own (empty) log-handle (--log-handler-script ~/loghandler.py) without any success.

Any ideas on how to circumvent this or disable the logging or write it to somewhere else?

$\endgroup$
4
  • 1
    $\begingroup$ I don't know what happens in your case, but I use Singularity containers with snakemake inside, and when it runs, the .snakemake folder is created inside the current working directory, not in a read-only folder. It might help seeing the container definition file. $\endgroup$
    – bli
    Feb 26, 2021 at 11:49
  • 2
    $\begingroup$ Basic sanity check: do you run the container from a folder in which you have write access? $\endgroup$
    – bli
    Feb 26, 2021 at 11:50
  • $\begingroup$ Can you write to the logs into /tmp/ ? $\endgroup$
    – Soerendip
    Mar 31, 2021 at 15:43
  • $\begingroup$ Or maybe don't run Snakemake in the container (e.g., conda install -c conda-forge -c bioconda snakemake doesn't need root). $\endgroup$
    – merv
    Mar 31, 2021 at 16:10

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Browse other questions tagged or ask your own question.