Menu toggle

Setting up PyTorch in a bare-metal Debian-like Linux distribution, or on a Chromebook

Notes:

  • For bare-metal installations, Simmons usually runs ArchLinux but Ubuntu is probably better if you don't have a lot of experience with Linux.
  • On a Chromebook, use Crostini if it is supported; if not, consider using crouton. Note: all Chromebooks released in 2019 or beyond should support Crostini.
  • You can compile PyTorch for ARM machines. Ask Simmons about how to do that, if you wish.

First install the following prerequisites:

sudo apt install libblas-dev liblapack-dev
sudo apt install python3
sudo apt install python3-numpy
sudo apt install python3-pip

Now, to install PyTorch in your Ubuntu installation, (see the QUICK START LOCALLY section of pytorch.org for an up-to-date version of the commands below be sure to first select Stable, Linux, Pip, Python, and None):

pip3 install torch==1.6.0+cpu torchvision==0.7.0+cpu -f https://download.pytorch.org/whl/torch_stable.html --user

Note: to be ultra-careful, replace pip3 with /usr/bin/pip3:

/usr/bin/pip3 install torch==1.6.0+cpu torchvision==0.7.0+cpu -f https://download.pytorch.org/whl/torch_stable.html --user

One runs, say, my-pytorch-program.py by typing python3 my-pytorch-program.py at the Bash prompt.