nvcc -V # don't use nvidia-smi, it just shows the highest version it supports
# check the version you need: https://anaconda.org/nvidia/cuda-toolkit
# to be safe, cuda-toolkit version is usually same with the torch version
conda install nvidia/label/cuda-<pkg-version>::cuda-toolkit
# now check if nvcc version is <SAME> with the <WANTED> PyTorch version
# <optional>
conda install nvidia/label/cuda-<pkg-version>::cuda-nvcc
# <next you go install pytorch>
# use pip install instead of conda install for PyTorch installation
# <tips>
# if you run into libcudnn.so.9: cannot open shared object file: No such file or directory
conda install nvidia::cudnn
# if you need to install opencv, install the full version BEFORE installing PyTorch
pip install opencv-contrib-python