There are multiple ways to install PyTorch on your Genesis Cloud Instance. The easiest way to get started is to use the preconfigured image with PyTorch already installed. This guide is for when you want to use pip nevertheless, for example when installing a specific version of PyTorch. For more info check out the PyTorch installation guide here.

To use PyTorch with GPU support make sure to install the GPU driver when creating your instance. Make sure that the GPU drivers as well as the NVIDIA CUDA Toolkit is installed. Helpful resources:

A guide on how to install the anything on startup.

A guide on how to install the NVIDIA Drivers and toolkit.

Prerequisite: Installing pip

sudo apt install python3-pip

Installing PyTorch

Check here to get the command for a specific torch version. You can use nvcc --version to check what nvidia toolkit version you are using. For pytorch 1.5 and nvidia toolkit 10.1 you need the following command.

pip3 install torch==1.5.0+cu101 torchvision==0.6.0+cu101 -f

Using PyTorch

After the installation finished you can check that PyTorch is working by starting the Python3 interpreter:


And then execute the following python commands to load PyTorch, check that CUDA (GPU support) is available and list the number of CUDA devices (=GPUs)

import torch

(Note: You can leave the Python interpreter mode using "ctrl + D")

You are all set! In your Python script make sure to specify that you want to use your GPU, when you start training your models. When they are running on one GPU you can just specify


in your python code. Here is a tutorial, that shows how to use multiple GPUs.

A guide on how to install the anything on startup.

A guide on how to install the anything on startup.