1A PyTorch Installation
1A PyTorch Installation
1 PyTorch Installation
A walkthrough to install PyTorch for Python 3.6. If you already have PyTorch on your machine
and feel confident in your installation, you can go ahead and skip this notebook.
For the purposes of this tutorial, I’m recommending using Anaconda as your Python distribution
and for managing your environments. If you’d rather use some other distribution or version of
Python and feel confident in your abilities, you may also choose to just follow the instructions here:
https://pytorch.org/get-started/locally/.
Download and install Anaconda. A more detailed version of the below steps specifically for Windows
(macOS and Linux instructions are similar) can be found here if you need additional assistance.
1. Go to the Anaconda install page and click on the Python 3.7 installer matching your operating
system (e.g. Windows, macOS, Linux) and system architecture (likely 64-bit X86).
2. Open the installer from your downloads folder and run it by double clicking on it.
3. Follow the installer’s instructions.
Note: there is an option at one point to add Anaconda to PATH. While the installer recommends
against this option (it’s possible it may interfere with your other software), we typically recommend
doing so, as it makes accessing Anaconda commands easier. The rest of this tutorial assumes that
this option has been selected.
1
4. Install some supporting dependencies Shell conda install h5py imageio jupyter
matplotlib numpy tqdm
5. Install either the CPU version or GPU version of PyTorch:
CPU: (Recommended as sufficient for this class) “‘Shell # Windows/Linux conda install
pytorch torchvision cpuonly -c pytorch
# macOS conda install pytorch torchvision -c pytorch “‘
GPU: (You’ll also need to install some Nvidia software) “‘Shell # Windows/Linx, assuming
CUDA 10.1 conda install pytorch torchvision cudatoolkit=10.1 -c pytorch
# macOS # Trickier. May require installing from source. See PyTorch docs. “‘
Note: If you have GPUs available, you should use the GPU version for any serious research
or application, as it can be significantly faster. For the purposes of this demo though, the
CPU version is sufficent.