1. 目的
最近在使用singularity的时候,想从singularity HUB拉一个镜像,结果在拉取镜像的时候报错,老是出现如下报错:
singularity pull shub://aertslab/pySCENIC

而且查询了半天,也没有找到合适的解决方案,开始以为的权限的问题,后面使用root权限,还是解决不了,然后以为是网络问题,翻墙,结果还是有报错。而且我根据官网的使用方法,还是报错:
singularity pull shub://aertslab/pySCENIC
singularity pull --name avocado_container.sif shub://aertslab/pySCENIC
2. 解决办法
我首先在官网参考使用手册,我在使用测试命令的时候,是没有问题的,其命令如下:
singularity pull shub://vsoch/hello-world

既然测试命令没有问题,那可能就是我的命令有问题,然后我查了一下我的这个进行,看到了这个镜像有很多不同的版本,如果我加上版本号呢?说不定就可以了。

singularity pull shub://aertslab/pySCENIC:0.9.18

加上版本号以后,结果特别的顺畅,一下就ok了,现在看来,这个问题其实很简单,只是加上一个版本号就可以了,可能是singularityhub有很多版本,不知道选择哪一个版本,才会出现报错。
其实在镜像下载的时候,可以设定一些参数,比如设置指定路径、名称等等。如果是在singularityhub下载镜像的话,需要shub://开头,其他不同地址,如果是docker的话,需要指定docker://。可以根据不同的镜像来源,设置。
#Custom Name
singularity pull --commit shub://vsoch/hello-world
#Name by commit
singularity pull --commit shub://vsoch/hello-world
#Name by hash
singularity pull --hash shub://vsoch/hello-world
#Pull to different folder
SINGULARITY_PULLFOLDER=/tmp
singularity pull shub://vsoch/hello-world
3. 镜像使用
镜像下载以后,就可以直接使用镜像进行分析,由于pySCENIC镜像有特定的测试数据集,因此这里先进行测试,测试是否安装成功或者镜像是否正确,测试命令如下:
# Choose your preference to pull the container from Singularity Hub (once)
singularity pull shub://aertslab/pySCENIC
# Then interact with it
singularity run pySCENIC.sif
singularity exec pySCENIC.sif ls /
singularity shell pySCENIC.sif
结果测试的时候的时候,又出现了报错,这里的报错是root filesystem问题,从报错来看,是因为没有root权限的问题,然后我切换到root账号,再进行运行,结果没有问题了,而且这个测试的过程,感觉与docker很像,基本上一致的,这里进行的交互运行。


4. 总结
从上面测试的结果来看,发现这个也需要root权限,本来我想使用singularity就是因为docker需要root权限,我才想改的,结果这个也要root权限,这将大大的现在目前的使用。我对singularity来说,完全是一个入门者,因此有些理解可能不太正确,我记得在之前的测试,有的不需要root权限,我在测试nf的时候,就不需要root权限,这个可能是由于不同的镜像缘故吧。
网友评论