1. View graphics card related information: nvidia-smi. The graphics card version is 531.18, and the maximum cuda12.1 version can be installed. The installation steps are explained in the previous blog.
2. Check the cuda version: nvcc -V
3. Check whether anaconda is installed: conda -V
4. Query the pytorch version corresponding to cuda11.6: https://pytorch.org/get-started/previous-versions/
Display the corresponding pytorch1.12.0, 1.12.1, and then query the appropriate python version 3.7, 3.8, 3.9, 3.10
5. Create an environment and install pytorch1.12.0 and python3.9
conda create -n learn python==3.9 conda activate learn # CUDA 11.6 pip install torch==1.12.0+cu116 torchvision==0.13.0+cu116 torchaudio==0.12.0 --extra-index-url https://download.pytorch.org/whl/cu116
Raise ReadTimeoutError(self._pool, None, "Read timed out.") occurs at the installation of numpy
First install numpy separately: pip3 install numpy==1.22.4 scipy matplotlib -i https://pypi.tuna.tsinghua.edu.cn/simple
Run again: pip install torch==1.12.0+cu116 torchvision==0.13.0+cu116 torchaudio==0.12.0 --extra-index-url https://download.pytorch.org/whl/cu116
Successful installation! ! !
6. Test whether pytorch is installed successfully, and the installation is successful