'SLURM loading modules vs using library from virtual environment

I'm relatively new to using clusters, in our uni we have one that is operated using slurm. I'm trying to train a model that I can run locally on my CPU with my virtual enviroment

However when I try using the following script:

`#!/bin/csh

#SBATCH --cpus-per-task=1
#SBATCH --gres=gpu:1
#SBATCH --time=4:0:0
#SBATCH --<mymail>


source <VENV_PATH>/bin/activate.csh
python3 --version
which python3
set RUNPATH="my_path"
cd $RUNPATH

python3 my_prog.py

I get the following error: "ModuleNotFoundError: No module named 'torchvision" and I find this to be funny because when I run my program locally with the same virtual environment it can obviously find the module. Granted the cluster does have its own modules and I can load them using module avail I can see what modules are available, however I'm not sure they have the versions of cuda / pytorch that I need which is why, if possible, I would rather load them from the virtual environment.

Is such as thing possible?

Thanks



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source