Skip to content

Instantly share code, notes, and snippets.

@sean-smith
Last active February 8, 2024 02:00
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save sean-smith/a9b13471a33f3e6bf1592f3253be1eee to your computer and use it in GitHub Desktop.
Save sean-smith/a9b13471a33f3e6bf1592f3253be1eee to your computer and use it in GitHub Desktop.

Activate virtualenvs with python

  1. Install Virtualenvwrapper - this is my favorite way of creating virtualenvs
sudo apt-get install virtualenvwrapper
  1. Install on the compute as well, where 4 is the number of compute nodes:
srun -N 4 sudo apt-get install virtualenvwrapper
  1. Install your python packages in a shared directory, in this case /fsx/ubuntu:
cd /fsx/ubuntu
mkvirtualenv packages 
pip3 install torch
  1. Create a job script
#!/bin/bash
#SBATCH -N 1

workon packages

...
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment