Python Environment¶
In order to run python applications using slurm, a virtual environment should be used to install the pip dependencies.
Set up the virtual environment¶
Warning
A virtual environment is specific to a machine and must be set up on each of the target nodes
First, connect to the node in which you want to install the virtual environment:
Then, create a virtual environment at the current location:
Activate the virtual environment:
Now you are in the virtual environment, you can install the dependencies of your application, ussually the procedure is the following but refer to the README of the application.
After that, you can leave the virtual environment:
And finally leave the interactive session by pressing CTRL+D
.
Info
Once you are confident that your install is working using the previous steps, you can repeat the process by creating a sbatch script with the commands above.
Use the virtual environment in your slurm job¶
Example slurm job to call app.py
: