Reputation: 411
I have multiple conda
environments working fine. when I try to subit a job using qsub
to SGE, the .bashrc
file is not read. The batch script looks like:
#!/bin/bash
#$ -S /bin/bash
#$ -cwd
#$ -l h_cpu=48:00:00
#$ -l h_vmem=2048M
#$ -q pascal@pascal-[0123]-0[01234567]
## allocate the number of cores:
#$ -pe mpi 1
export OMP_NUM_THREADS=4
conda activate my_env
python ./test.py
I am getting the error: conda: Command not found.
Also, it can't find bash commands like export
.
source ~/.bashrc
or source ~/.bash_profile
does not help.
If I use qsub -V ....
, the code somehow runs but it says
CommandNotFoundError: Your shell has not been properly configured to use 'conda activate'.
To initialize your shell, run
$ conda init <SHELL_NAME>
Currently supported shells are:
- bash
- fish
- tcsh
- xonsh
- zsh
- powershell
See 'conda init --help' for more information and options.
IMPORTANT: You may need to close and restart your shell after running 'conda init'.
However, I do not want to use qsub -V
because of some external reasons.
I am new to this cluster, so I am clueless. I just want to be able to choose freely between different conda enviroments
in the batch script. Please help.
Edit 1: after seeing the comment
#!/bin/bash -l
#$ -cwd
#$ -l h_cpu=48:00:00
#$ -l h_vmem=2048M
#$ -q pascal@pascal-[0123]-0[01234567]
## allocate the number of cores:
#$ -pe mpi 1
setenv OMP_NUM_THREADS 1
conda activate my_env
python ./test.py
gives me conda: Command not found.
Upvotes: 1
Views: 320