Installation

It’s recommended that you install PyTorch in your own Python virtual environment or conda environment. Be mindful that the PyTorch installation with GPU capabilities is approximately 1GB in size.

The below installations will run on both GPU compute nodes and CPU-only nodes. The CUDA drivers on the SCC are kept up to date and the newest available CUDA version should be selected. No additional libraries are needed for CUDA support, everything required is built into the below PyTorch installation.

Python Virtual Environment

  1. Create and activate your virtualenv as explained on the Python Installs page.
  2. Visit the PyTorch Start Locally page to get the latest PyTorch installation command. Select the following options:
    • PyTorch Build: Stable
    • Your OS: Linux
    • Package: Pip
    • Language: Python
    • Compute Platform: CUDA (LATEST)
  3. Run the generated installation command in your virtualenv. An example configuration with CUDA 12.6 is shown in the picture below.PyTorch 2.6.0 install example

Conda Environment

  1. Create and activate your conda env as explained on the Miniconda Installs page.
  2. As of PyTorch release 2.6.0 the conda install method is no longer available. If you are installing a version of PyTorch <2.6.0, consult the PyTorch documentation on installing older versions.
  3. If you are using PyTorch >= 2.6.0, follow the above instructions to install PyTorch via the pip tool into your conda environment. It is recommended that you install PyTorch via pip before you install other libraries (using pip or conda) to make sure the correct versions of required libraries like numpy are installed with PyTorch.

Using SCC Modules

To see the available versions of PyTorch in the SCC module system run the following command. There are a number of older versions of PyTorch available, and RCS does not plan to make newer versions available as modules as the software is straightforward to install (as seen above) and releases occur frequently:

[rcs@scc1 ~] module avail pytorch

Depending on which version you select, you will have to also load a python3 module or activate a conda environment. The version of Python needs to match the support provided by the module. Loading a pytorch module without a python3 module or activated conda environment will result in a message like this:

[rcs@scc1 ~] module load pytorch/1.13.1

-------------------------------------------------------------------------------
WARNING: pytorch/1.13.1 needs to be used with Python 3.7, 3.8, 3.9 or 3.10. This can be provided by a python3 module or via a conda
environment.

For example:

module load python3/3.8.10
module load pytorch/1.13.1

OR:

# we recommend the default version of miniconda
module load miniconda
conda activate INSERT_YOUR_CONDA_ENV_HERE
module load pytorch/1.13.1

-------------------------------------------------------------------------------

Once an appropriate version of Python is available you can use the PyTorch software normally from Python.

Back to top