微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

激活 Singularity 容器内的 conda 环境

如何解决激活 Singularity 容器内的 conda 环境

所以,我想这是以一种非常简单的方式完成的,但我没有这方面的经验,所以我不明白这是什么问题。假设我有一个 conda 环境 example_env一个 Singularity 图像 example.simg

我可以运行图像: singularity run --nv /mnt/appl/singularity_images/pytorch-19.03-py3.simg

一旦我进入 Singularity 容器,我就可以编写 conda activate example_env,它对我来说没有任何问题。

现在,我想从交互部分切换到脚本。因此,我没有使用 singularity run 并进入交互式 shell,而是尝试了 singularity exec: singularity exec example.simg bash scripts/train.sh,其中 train.sh 只包含一个(当然只是现在)命令: conda activate example_env

但是,现在它不起作用,并给我以下错误CommandNotFoundError: Your shell has not been properly configured to use 'conda activate'. To initialize your shell,run $ conda init <SHELL_NAME> 如果我尝试按照错误消息并添加 conda init 命令,它没有帮助。

出了什么问题,我如何使用 conda activate 运行 singularity exec

解决方法

我认为您没有像此 stackoverflow 中显示的那样运行 echo 命令。 我认为您应该查看以下内容。

Activate conda environment on execution of Singularity container in Nextflow

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。