2022 install cuda+cudnn+anaconda+pycharm+gpu version of pytorch

I am running deep learning pytorch.
The environment has been configured on four empty computers, and the whole set takes no more than two hours.
The computer hardware of pytorch readers of cuda+cudnn+anaconda+pycharm+gpu version
is different, and there may be differences in version selection.
The versions of the 4 computers I configured are also different, but the steps are the same, only the version selection is slightly different.

The following shows the steps I configured on 2022.7.19.
Computer configuration: RTX3060 graphics card
cuda11.6.XX

1. Install cuda

Check the cuda version that is compatible with the computer
NVIDIA Control Panel-"System Information-"Components
insert image description here
Check whether the graphics card driver is downloaded
Method 1:
NVIDIA Control Panel-"System Information-"Display
insert image description here
Method 2:
cmd-"nvidia-smi and method 1 see It is the same
insert image description here
https://developer.nvidia.com/cuda-toolkit-archive Download the corresponding version of cuda.
The above is 11.6, just download 11.6, I can’t get used to the latest version, choose the next new version

insert image description here
insert image description here

After downloading, run it as an administrator
run as administrator
. The path is the decompression path of the installation package. After the software is installed, it will be automatically deleted. The
insert image description here
insert image description here
insert image description here
installation location should be remembered
. The temporary decompression directory should not be the same as the cuda installation path, otherwise the installation directory will not be found after the installation is complete
insert image description here
. After completion, System Environment Variables - "System Variables -" will have the following new variables.
I also want to add two variables myself
insert image description here
to check whether cuda is installed successfully
. It is the same as in the picture, enter the corresponding path, and then enter nvcc -V
insert image description here

2. Install cudnn

https://developer.nvidia.com/rdp/cudnn-archive
insert image description here
download needs to log in to NVIDIA, and readers who do not have it need to register by themselves. Here I log in directly~

insert image description here
Download the compressed file, unzip it,
insert image description here
copy these three folders to the path of cuda, "replace the file"
insert image description here
to check whether cudnn is installed successfully, enter
the bandwidthTest.exe and deviceQuery.exe under the installation directory extras\demo_suite just now to check whether it is installed Success
insert image description here
insert image description here
insert image description here
indicates that cuda toolkit and cudnn are installed correctly.

3. Install anaconda

Download the anaconda installation package. It is not recommended to go to the official website to download. The official website download is too slow. It is recommended to download the Tsinghua Park address https://mirrors.tuna.tsinghua.edu.cn/anaconda/archive/
It is not recommended to install the latest version, which is prone to errors【 I tried to install the latest version, but the system environment variables cannot be added automatically later]
insert image description here
insert image description here
The first item will automatically add system environment variables to the installation path. It is strongly recommended to check it, which can save a lot of trouble in the future. (No need to manually add environment variables)
The second item uses the version of python by default
insert image description here
. Check whether there is a Python environment
insert image description here
. Press ctrl+z to exit from python
. Check whether there is a conda environment.
insert image description here

Four. Install pycharm

https://www.jetbrains.com
insert image description here
insert image description here
insert image description here
insert image description here
insert image description here

5. Install the Cuda version of pytorch

https://pytorch.org/get-started/locally/Choose
your own version, followed by Tsinghua source -i https://pypi.tuna.tsinghua.edu.cn/simple
insert image description here
pip3 install torch torchvision torchaudio --extra-index -url https://download.pytorch.org/whl/cu116 -i https://pypi.tuna.tsinghua.edu.cn/simple

6. Check whether the installation is successful

insert image description here
Some authors on the Internet said that <function…> appears because the version has not been downloaded, but I did not find any abnormalities when using it.
insert image description here
That's it. The code runs smoothly~

Many authors on the Internet have explained the installation steps. The steps are generally similar, and many authors have written more details than me.
But mine is relatively complete and relatively new~

I wish the readers here can work smoothly and do their research well~

Guess you like

Origin blog.csdn.net/qq_45384162/article/details/125975699