Singularity WILL NOT work inside the Windows 10 Subsystem for Linux. This is due to the WSL not supporting features that singularity requires such as loop devices and other filesystem access types. All windows users MUST use Virtualbox and Vagrant to create singularity images.
Install Prerequisites
Download and Install Virtualbox
https://www.virtualbox.org/
Download and Install Vagrant
https://www.vagrantup.com/
Start up your vagrant image
Start a powershell session from the start menu
you may check for newer versions of the vagrant singularity image at https://app.vagrantup.com/boxes/search?utf8=%E2%9C%93&sort=downloads&provider=&q=singularity
The underlying OS such as Ubuntu or CentOS, as well as OS version do not matter. That is the beauty of containers!
Replace “sylabs/singularity-3.2-ubuntu-bionic64” with the version of your choice
In the powershell window run
vagrant init sylabs/singularity-3.2-ubuntu-bionic64
Once that completes run
vagrant up
The first time “vagrant up” runs it may take some time as it will need to download and configure the image.
Because it needs to download information you will need a connection to the internet. Amount of data downloaded is generally less than 1GB depending on the image being used
Last step before you can create singularity containers
vagrant ssh sudo su <singularity commands here>
Creating your Singularity image
From here, build your singularity image
Copy file from Vagrant to your windows system
Since you built the image as root, you will probably need to change ownership.
root@vagrant:/home/vagrant# ls -la total 25320 drwxr-xr-x 5 vagrant vagrant 4096 Nov 27 18:01 . drwxr-xr-x 3 root root 4096 Sep 26 01:57 .. -rw-r--r-- 1 vagrant vagrant 220 Sep 26 01:57 .bash_logout -rw-r--r-- 1 vagrant vagrant 3771 Sep 26 01:57 .bashrc drwx------ 3 vagrant vagrant 4096 Sep 26 02:02 .cache drwx------ 3 vagrant vagrant 4096 Sep 26 01:58 .gnupg -rw-r--r-- 1 vagrant vagrant 807 Sep 26 01:57 .profile drwx------ 2 vagrant vagrant 4096 Nov 27 17:47 .ssh -rw-r--r-- 1 vagrant vagrant 0 Sep 26 01:58 .sudo_as_admin_successful -rwxr-xr-x 1 root root 25886720 Nov 27 18:00 ubuntu_18.04.sif -rw-r--r-- 1 vagrant vagrant 5 Sep 26 01:58 .vbox_version -rw-r--r-- 1 root root 215 Sep 26 02:02 .wget-hsts root@vagrant:/home/vagrant# chown vagrant:vagrant ubuntu_18.04.sif root@vagrant:/home/vagrant# pwd /home/vagrant root@vagrant:/home/vagrant#
Take note of the filename and path
root@vagrant:/home/vagrant# pwd /home/vagrant
Type “exit” until you’re back at the windows prompt
root@vagrant:/home/vagrant# exit vagrant@vagrant:~$ logout Connection to 127.0.0.1 closed. PS C:\Users\myspa>
Get the port from Vagrant
PS C:\WINDOWS\system32> vagrant port The forwarded ports for the machine are listed below. Please note that these values may differ from values configured in the Vagrantfile if the provider supports automatic port collision detection and resolution. 22 (guest) => 2200 (host)
In the command below, make sure the number after “-P” match the one to the left of “(host)”
Make sure the path and filename in the scp command match what you noted earlier
If it asks for a password as in this example, the password is “vagrant”
PS C:\Users\myspa> scp -P 2200 vagrant@127.0.0.1:/home/vagrant/ubuntu_18.04.sif . The authenticity of host '[127.0.0.1]:2200 ([127.0.0.1]:2200)' can't be established. ECDSA key fingerprint is SHA256:zY+yQzWl7W/KzaXzi+m6cfjtBJd9yiQXSFLBKGvL9BI. Are you sure you want to continue connecting (yes/no)? Warning: Permanently added '[127.0.0.1]:2200' (ECDSA) to the list of known hosts. vagrant@127.0.0.1's password: ubuntu_18.04.sif 100% 25MB 53.6MB/s 00:00 protocol error: lost connection
Your Singularity image is now stored on your PC and can be transferred to the cluster