Skip to content

Notes on installing PyTorch

Louis Maddox edited this page Feb 8, 2021 · 2 revisions

Here's an example on how to install PyTorch and torchvision with CUDA 11.0:

conda create -n liif_env
conda activate liif_env
# gives cudatoolkit=11.0.3:
conda install "cudatoolkit>=11.0,<11.0.221" -c conda-forge
# gives pytorch=1.7.1, torchvision=0.8.2, also adds python=3.8.5:
conda install pytorch torchvision -c pytorch 
# Install the rest via PyPi:
pip install $(cat requirements.txt | grep -Ev "^(torch(vision)?)$")

To use with PyTorch 1.8.0 from the pytorch-nightly channel (ahead of its release) I could only get it to install with Python 3.7

conda create -n liif_1_8
conda activate liif_1_8
conda install python=3.7 # gives 3.7.9
conda install pytorch=1.8.0 torchvision -c pytorch-nightly
Clone this wiki locally