Unable to use packages in conda environment in compute nodes

Hello there,
I’ve been having this problem just recently that used to work fine. I used conda to create my preferred environment that contain the required packages for my code. However, this time the system reported that all the packages required could not be found. I use the “conda list” command and found the packages I installed, but python seemed not able to find them. Does anyone know what’s going on?


@jiangxu It looks like the wrong version of Python is being used, the one in the base environment instead of your environment. Try reactivating your environment, or try activating the base environment first and then your environment. And you might check your PATH variable to see if anything is off.

Hello dstrong,
I can use my conda environment correctly at the home node but can’t do it at the computation node. So what is the difference?
Thank you,
Jiang

Hello dstrong,
I think I found the cause and the solution. I tried to deactivate and reactivate the environment, the program works. The following posts described the problem and the principle. Thank you.
https://github.com/conda/conda/issues/9392
Jiang

The ~/.bashrc, which sets up conda in your shell, is not sourced for Slurm jobs. So you could either run source ~/.bashrc or just run eval "$(conda shell.bash hook)".

Thanks dstrong, thank you for the suggestion. I will try that.
Best,
Jiang