Install Pytorch from source under Ubuntu
Environmental preparation
- Install CUDA, download address NVIDIA official website , install tutorial recommended blog
- Install Anaconda python environment
export CMAKE_PREFIX_PATH="$(dirname $(which conda))/../" # [anaconda root directory]
# Install basic dependencies
conda install numpy pyyaml mkl mkl-include setuptools cmake cffi typing
# Add LAPACK support for the GPU
conda install -c pytorch magma-cuda80 # or magma-cuda90 if CUDA 9
- Download the source code and install it
git clone --recursive https://github.com/pytorch/pytorch
cd pytorch