【问题标题】:Activate conda environment inside Singularity container在 Singularity 容器中激活 conda 环境
【发布时间】:2021-07-15 21:22:58
【问题描述】:

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

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

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

现在,我想从交互式部分切换到脚本。因此,我没有使用singularity run 并进入交互式shell,而是尝试了singularity execsingularity 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 activatesingularity exec

【问题讨论】:

    标签: bash conda singularity-container


    【解决方案1】:

    我认为您不会运行此 stackoverflow 中所示的 echo 命令。 我认为您应该检查以下内容。

    Activate conda environment on execution of Singularity container in Nextflow

    【讨论】:

    • 老实说,我真的不明白如何在我的情况下使用该答案,但从github.com/conda/conda/issues/7980 添加一行解决了我的问题。 (source ~/anaconda3/etc/profile.d/conda.sh)
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2019-08-03
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2016-06-08
    • 1970-01-01
    相关资源
    最近更新 更多