Win10 + CUDA11.7 + pytorch manual installation - version 2.0

 1. Installation environment

OS:              Win10 Professional x64
Python:      Python 3.7.7 (installed through Anaconda software )
Anaconda: Anaconda3-2022.05-Windows-x86_64.exe[The python that comes with this version is 3.9]< /span> [The cuda11.3 development package will be installed in the following pytorch instructions]Download address  , depending on the operating system, you can choose different versions to download online, the interface The website address iscuda_11.7.0_516.01_windows.exe
CUDA:        

Pytorch:The official Pytorch online command installation,It is recommended to refer to my offline manual installation later, which is faster.

Pycharm:pycharm-community-2022.1.2.exe, development tool, community free version, after downloading, install it by default.

 2. Anaconda installation process

1. Select the installation path: D:\ProgramData\Anaconda3

2. Check two: select the Just me user, then add the environment variable Path, and set the Python3.9 that comes with Anaconda3 as the system default environment.

Note: As shown below, in the 2022 version of anaconda, if the above user selects All users, the subsequent environment variable options become gray and Path cannot be selected. You need to manually modify the environment variables later.​ 

 Manually add the Anaconda path:

D:\ProgramData\Anaconda3
D:\ProgramData\Anaconda3\Scripts
D:\ProgramData\Anaconda3\Library\mingw-w64\bin
D:\ProgramData\Anaconda3\Library\usr\bin
D:\ProgramData\Anaconda3\Library\bin

Be sure to add these five paths (for the fourth one, some people have folders and some don’t have folders. Some add this path, and if not, you can add it or not)

3. Open the command window cmd.exe that comes with Windows to test whether the installation is successful.

Enter the command in cmd window:conda list, the output result is as follows:

 Enter the command in the cmd window: conda --version. The result will output the version number, which means the installation is successful.

3. CUDA installation process

1.CUDA download

Search CUDA download on Baidu, enter the official download page, select the appropriate operating system and install type: (local exe), the specific URL isDownload address.

 2. Double-click to install

If the check passes, select the required Visual Studio environment and enter the installation process. (In case the installation fails, please uninstall it, restart the system, and reinstall it.)

 3. Check whether cuda is installed successfully

First check whether there is an nvcc.exe file in the directory C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v11.7\bin.

 Then enter the command in cmd: nvcc -V, you can see that our version number is Cuda 10.1

 Essentially, the path configuration of Cuda and the path of Anaconda are added to our system environment variables.

C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v11.7\bin;C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v11.7\libnvvp;

D:\ProgramData\Anaconda3;D:\ProgramData\Anaconda3\Scripts;D:\ProgramData\Anaconda3\Library\name-w64\bin;D:\ProgramData\Anaconda3\Library\bin;

4,Anso Pytorch

1. First enter the Pytorch download page:Start Locally | PyTorch

Select the appropriate CUDA version 11.3 and copy the command:

conda install pytorch torchvision torchaudio cudatoolkit=11.3 -c pytorch

2. Manually add the Tsinghua mirror source in Aconda to improve download speed.

https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/free/
https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/conda-forge/
https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/msys2/

Add the addresses one by one and click Update channels.

2. Execute the command in the CMD window:

conda install pytorch torchvision torchaudio cudatoolkit=11.3 -c pytorch 

3. The download speed is too slow. You can download the installation package manually.

download link:

Index of /anaconda/pkgs/main/win-64/ | Tsinghua University Open Source Software Mirror Station | Tsinghua Open Source Mirror (stable, only need to download the conda file) a>

Index of /anaconda/cloud/pytorch/win-64/ | Tsinghua Open Source Software Mirror Station | Tsinghua Open Source Mirror (latest, only tar.bz2 file can be downloaded)

main/win-64(official)

 Specific download and installation package list:


 

Among them, pytorch is too slow to download online, and others are automatically downloaded to the installation directory D:\ProgramData\Anaconda3\pkgs:

 So we download the installation package manually, install all the installation packages manually, and finally check whether the installation is successful.

pytorch/win-64::pytorch-1.11.0-py3.9_cuda11.3_cudnn8_0 Manual download address: pytorch-1.11.0-py3.9_cuda11.3_cudnn8_0 

4. Copy the manually downloaded installation package to the specified path: D:\ProgramData\Anaconda3\pkgs

5. Then manually go offline and install the download packages in order.

Open cmd as an administrator, enter cmd D:\ProgramData\Anaconda3\pkgs, and enter the installation package directory. Then install the download packages in order

      conda install --use-local pytorch-1.11.0-py3.9_cuda11.3_cudnn8_0.tar.bz2

      conda install --use-local torchvision-0.12.0-py39_cu113.tar.bz2          

      conda install --use-local torchaudio-0.11.0-py39_cu113.tar.bz2

      conda install --use-local cudatoolkit-11.3.1-h59b6b97_2.conda

      conda install --use-local libuv-1.43.0-h8ffe710_0.tar.bz2

      conda install --use-local python_abi-3.9-2_cp39.tar.bz2

      conda install --use-local pytorch-mutex-1.0-cuda.tar.bz2

Successful installation results:

6. Execute the pytorch installation general instructions and check whether it is completely installed.

Execute the pytorch installation general instructions and check whether it is completely installed.

conda install pytorch torchvision torchaudio cudatoolkit=11.3 -c pytorch (Remove the red -c pytorch to avoid re-downloading from the mirror)

conda install pytorch torchvision torchaudio cudatoolkit=11.3

 Because it is installed manually, there are inconsistencies in the environment, so you need to update the conda-forge package.

Finally, execute the check command again and everything goes well.

6. Verify whether pytorch is installed successfully

In the start menu, open the Python console (in the new version, open the control window of anaconda and enter python).

(1) Enter import torch. If no error is reported, it means that PyTorch has been successfully installed (the win10 home version system of my laptop lacks VC_redist.64.exe, which was solved after installation)

(2) Next, enter torch.cuda.is_available(). If it is True, it means you can use the GPU. If it is False, it means you can only use the CPU.

Guess you like

Origin blog.csdn.net/qimo601/article/details/125146818