Appendix A. Install PyTorch and enable GPU training locally and in Colab

 

This appendix covers

  • Installing Anaconda on your computer based on your operating system
  • Creating a Python virtual environment for projects in this book
  • Installing Jupyter Notebook in the virtual environment
  • Installing PyTorch with a CUDA-enabled GPU
  • Accelerating training with GPUs in Google Colab

My preferred way of installing Python and managing libraries and packages on your computer is through Anaconda, an open-source Python distribution, package manager, and environment management tool. Anaconda is user-friendly and can help you effortlessly install numerous libraries and packages, which could be a pain to install otherwise. Anaconda allows users to install packages through both 'conda install' and 'pip install,' broadening the spectrum of available resources.

I will also walk you through the steps in creating a dedicated Python virtual environment for all the projects in this book. This segregation ensures that the libraries and packages used in this book remain isolated from any libraries utilized in other, unrelated projects, thus eliminating any potential interference.

A.1 Install Python and set up a virtual environment

A.1.1 Install Anaconda

A.1.2 Set up a Python virtual environment

A.1.3 Install Jupyter Notebook

A.2 Install PyTorch

A.3 Use Google Colab for GPU training and inference