0

I was learning docker before, now I convert a docker container into a singularity container. Now I have some conda environments and a Singularity image: vitis-ai-gpu.sif.

I have tried singularity exec vitis-ai-gpu.sif conda activate vitis-ai-caffe, conda activate vitis-ai-caffe is a command within the container. However, it does not work, and gives me the following error: /.singularity.d/actions/exec: 9: exec: conda: not found.

And, If i execute singularity run vitis-ai-gpu.sif first then conda activate vitis-ai-caffe, it works!

What is wrong, and how can I run conda activate with singularity exec?

QULV
  • 1
  • The reason it doesn't work is that `conda activate` is a shell function, not an executable (see [here for details](https://stackoverflow.com/a/69024715/570918)). However, activation is only a step, not a goal. It would help to know what you intend to do after activation. Do you want an interactive shell session where an environment is activated, or are you hoping to run specific code in an environment? – merv Oct 14 '21 at 16:04
  • Yes, i want to activate an environment and run specific code in the environment. Glad to receive your reply. – QULV Oct 15 '21 at 01:29
  • If the code is in a script, I usually recommend the `conda run` command. Something like `conda run -n vitis-ai-caffe python script.py`. See `conda run --help`. – merv Oct 15 '21 at 01:30
  • Is it singularity exec vitis-ai-gpu.sif conda run -n vitis-ai-caffe python script.py or singularity run vitis-ai-gpu.sif first and then conda run -n vitis-ai-caffe python script.py? Sorry i'm a novice. – QULV Oct 15 '21 at 01:52
  • I run this command ' singularity run vitis-ai-gpu.sif ' first, and then ' conda run -n vitis-ai-caffe bash darknet_convert.sh ' , But it reported an error: ‘ NotWritableError: The current user does not have write permissions to a required path. path: /opt/vitis_ai/conda/envs/vitis-ai-caffe/.conda_envs_dir_test ’ . Because I don’t have sudo permission, I can’t modify the path. What should i do? – QULV Oct 16 '21 at 05:24

0 Answers0