# Singularity Image

**URL:** <https://nextstrain.discourse.group/t/singularity-image/412>\
**Category:** Help and Getting Started\
**Created:** [March 10, 2021, 4:26pm UTC](https://nextstrain.discourse.group/t/singularity-image/412 "2021-03-10T16:26:04Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![whottel](https://avatars.discourse-cdn.com/v4/letter/w/e8c25b/32.png) [@whottel](https://nextstrain.discourse.group/u/whottel)\
**Post date:** [March 10, 2021, 4:26pm UTC](https://nextstrain.discourse.group/t/singularity-image/412/1 "2021-03-10T16:26:04Z")

</div>

Hello,

I am trying to set up a local Nextstrain build for SARS-CoV-2 sequenicng surveillance. My compute cluster does not get along with docker, but singularity works fine. I installed the latest version simply enough with “singularity pull docker://nextstrain/base:latest” however when I run " singularity pull docker://nextstrain/base" it returns that docker is not supported. Is there a way to force set the environment to singularity or docker via singularity in some way?

Thanks,  
Wes

---

<div class="post-metadata">

**Author:** ![jlhudd](https://yyz1.discourse-cdn.com/flex031/user_avatar/nextstrain.discourse.group/jlhudd/32/583_2.png) [@jlhudd](https://nextstrain.discourse.group/u/jlhudd)\
**Post date:** [March 19, 2021, 5:36pm UTC](https://nextstrain.discourse.group/t/singularity-image/412/2 "2021-03-19T17:36:47Z")

</div>

Hi @whottel! We don’t have much experience with Singularity on our team, other than some tentative, incomplete efforts to use the Nextstrain Docker image with Singularity on our own SLURM cluster. Running with `nextstrain/base:latest` is a safe bet, generally, though, if you have a way to specify that version information when you run your analyses.

On a related note, would you be willing to share here how you’re running your analyses with Singularity on your cluster? I bet other folks would be interested in your efforts here and, if your solution seems generally applicable, we could add your notes to the official workflow documentation.

---

<div class="post-metadata">

**Author:** ![whottel](https://avatars.discourse-cdn.com/v4/letter/w/e8c25b/32.png) [@whottel](https://nextstrain.discourse.group/u/whottel)\
**Post date:** [March 19, 2021, 6:39pm UTC](https://nextstrain.discourse.group/t/singularity-image/412/3 "2021-03-19T18:39:08Z")

</div>

Unfortunatley, I will not be very helpful as I ended up going with the conda/snakemake route.  
For what It might be worth, as stated above in my post I opened an interactive singualrity shell with the nextstrain image to see if docker was recognized as a supported environment.

> nextstrain check-setup --set-default

did not return docker as a supported envirnoment.

Also tried an non-interactive shell approach:

> singularity exec -e -B .:/data --pwd /data -H \<Path/to/working/directory\> \</Path/to/singularity/image.sif\> nextstrain check-setup --set-defualt

Again, docker not supproted.

-Wes

---

<div class="post-metadata">

**Author:** ![jlhudd](https://yyz1.discourse-cdn.com/flex031/user_avatar/nextstrain.discourse.group/jlhudd/32/583_2.png) [@jlhudd](https://nextstrain.discourse.group/u/jlhudd)\
**Post date:** [March 19, 2021, 7:29pm UTC](https://nextstrain.discourse.group/t/singularity-image/412/4 "2021-03-19T19:29:08Z")

</div>

Ah, I see; I misunderstood the Singularity environment + Nextstrain CLI context. The `nextstrain` command doesn’t support Singularity yet but there is [an open issue to add this support eventually](https://github.com/nextstrain/cli/issues/2). Whether that issue gets resolved will depend on demand for that feature.

I’m glad the Conda + Snakemake approach is working though!

---

<div class="post-metadata">

**Author:** ![klauer](https://avatars.discourse-cdn.com/v4/letter/k/2acd7d/32.png) [@klauer](https://nextstrain.discourse.group/u/klauer)\
**Post date:** [September 22, 2021, 1:18am UTC](https://nextstrain.discourse.group/t/singularity-image/412/5 "2021-09-22T01:18:39Z")

</div>

First I wanted to say what an awesome tool/pipeline! Every time I use it, I discover yet another cool feature.

I thought I would share how we are running the github snakemake pipeline using singularity on a cluster that does not support docker.

1. Install singularity (singularity pull nextstrain.sif docker://nextstrain/base:latest).
2. Pull latest snakemake pipeline repo (git clone [GitHub - nextstrain/ncov: Nextstrain build for novel coronavirus SARS-CoV-2](https://github.com/nextstrain/ncov.git))
3. Update data files, configs, etc
4. run (singularity exec --cleanenv nextstrain.sif snakemake --profile my\_profiles/\<my\_user\_profile\>)

It doesn’t use docker, but the Singularity environment + Nextstrain CLI.  
The only limitations I have found so far is I can’t update the image and need to re-install when new software versions come out (when I run nextstrain update inside the container it fails) and pangolin isn’t installed inside the container so I have not been able to take advantage of the run\_pangolin feature that looks like it was added in April.

Thanks again for all the hard work, it is really impressive.

Best,  
Kim

---

<div class="post-metadata">

**Author:** ![trs](https://yyz1.discourse-cdn.com/flex031/user_avatar/nextstrain.discourse.group/trs/32/5_2.png) [@trs](https://nextstrain.discourse.group/u/trs)\
**Post date:** [January 18, 2023, 10:22pm UTC](https://nextstrain.discourse.group/t/singularity-image/412/6 "2023-01-18T22:22:44Z")

</div>

@whottel @klauer FWIW, the [just-released Nextstrain CLI 6.1.0](https://github.com/nextstrain/cli/releases/tag/6.1.0) now [supports Singularity directly](https://docs.nextstrain.org/projects/cli/en/stable/installation/#singularity). If you want to give it a go, please do report back any issues, suggestions, etc.

---

<div class="post-metadata">

**Author:** ![whottel](https://avatars.discourse-cdn.com/v4/letter/w/e8c25b/32.png) [@whottel](https://nextstrain.discourse.group/u/whottel)\
**Post date:** [February 14, 2023, 10:28pm UTC](https://nextstrain.discourse.group/t/singularity-image/412/7 "2023-02-14T22:28:09Z")

</div>

Thanks! I was able to install nextstrain with the singularity runtime, and I was able to run the Zika tutorial without any issues.
