Skip to content
Advertisement

Using conda activate or specifying python path in bash script?

I’m running some python scripts on some Linux clusters using SGE or SLURM. I already have my conda environment set up properly using the login node. I have been writing something like

JavaScript

to activate the environment properly. (I have done a lot of work to figure this out) However, I just found some example codes like

JavaScript

seems to do the same thing without the need for tedious deactivation and activation. Are they actually doing the same thing? If so, which would be the better practice?

Advertisement

Answer

Programmatic execution with an environment is usually better done through the conda run subcommand. E.g.,

my_slurm_script.sh

JavaScript

Read the conda run --help for details.

User contributions licensed under: CC BY-SA
1 People found this is helpful
Advertisement