Running qsub with anaconda environment Running qsub with anaconda environment linux linux

Running qsub with anaconda environment


You'll need to load the Python module before activating your environment and before running your script.

module load python3cd $PBS_O_WORKDIRsource activate my_environmentmpiexec python hello_world.py

Check the documentation for your institution regarding their Python modules. At my institution, Anaconda was the environment module for Python3, so you could load it as I have shown.


Unless it is in the environment by default, one also needs to "load" conda as well, inside the SGE(qsub) script (similar thing would hold for a slurm script too I assume). For example I had installed conda to the directory seen below in the SGE script, so I export the path (if conda is installed as a module on an HPCC, then simply load that instead):

#!/bin/bash#$ -q compute#$ -l compute#$ -cwd#$ -N name#$ -j yesexport PATH=$HOME/miniconda3/bin:$PATHsource activate my_environmentenvironment function code...


If your really need your conda environment you can activate it in the script

source ~/.bashrc #configures your shell to use conda activateconda activate your_env_name