Download torch+cu from scratch (painless version)

Download torch+cu from scratch (painless version)

I. Introduction

Since I got some new computers, I often need to configure a deep learning environment, and I feel cumbersome to search all the time, so I just record the search for myself, which is fast hh.

Second, the specific steps to configure the GPU version of torch

Generally speaking, the normal conda, direct download with pip will be sent directly, or it will be sent later, so you need to download whl directly and install it. It is not ruled out that there are children of destiny who have successfully passed pip+default-timeout.

1, Check the Cuda version installed on the computer

nvcc -V

insert image description here
You can see that I am CUDA11.6

If you don't have Cuda installed, you can refer to this blog:
Super detailed tutorial on deep learning environment configuration [Anaconda+PyTorch (GPU version)+CUDA+cuDNN]
If it is not an N card, it can only. . . I have used the money ability, and there is nothing I can do to help.

2. Search the whl package name and version to be downloaded on the pytoch official website

pytorch past historical version address: https://pytorch.org/get-started/previous-versions/
For example: I found that my cuda version is 11.6, so let's find out which torch versions are supported by cu11.6
insert image description here

Then I found it on the picture: I found that there is a line #CUDA 11.6 and a line of pip below it.
The content in pip is the package we want to download manually.
Mine is:

torch1.13.0+cu116 torch vision0.14.0+cu116 torchaudio==0.13.0

You can install torch, torchvision, torchaudio version suitable for your own cuda according to your own situation

What if the desired torch version does not match its own cuda? Then uninstall cuda and reinstall it ( cautiously ), this is a tutorial for reinstalling cuda: Uninstall and install CUDA under windows

3. Download the specified torch, torchvision, torchaudio three libraries

Address: https://download.pytorch.org/whl/cu113
Note: Remember to turn off Magic Internet.
insert image description here
Here I download torch’s whl package as a chestnut
. After clicking, ctrl+f input: mine is 11.6, so output cu116 and other versions Similarly,
in the second section, you can know that the torch version to be downloaded is: torch==1.13.0+cu116
and then I am python10, windows system, so I download this: torch-1.13.0+cu116-cp310-cp310-win_amd64 .whl
Note: cp310 is not 310 objects, it refers to the python version.
insert image description here
The same applies to the other three.
insert image description here

download as above
insert image description here

You can see that the one I downloaded is the same as the one on the pytorch official website. It cannot be said that it is irrelevant, but it is exactly the same.

4. Install into the target deep learning environment

Open Anconda Prompt and enter:

conda create -n pytorch13 python=3.10
conda activate pytorch13
pip install C:\Users\Admin\Downloads\torch-2.0.0+cu117-cp39-cp39-win_amd64.whl
pip install C:\Users\Admin\Downloads\torchvision-0.14.0+cu116-cp310-cp310-win_amd64.whl
pip install C:\Users\Admin\Downloads\torchaudio-0.13.0+cu117-cp39-cp39-win_amd64.whl

Note: The address after pip install becomes the absolute address of the whl you downloaded, and the order of installation is torch torchvision torchaudio
insert image description here

5. Test whether the installation is successful

python
import torch
 print(torch.cuda.is_available())

insert image description here
Congratulations when printing True, you have successfully configured the torch+GPU deep learning environment!

Guess you like

Origin blog.csdn.net/qq_51116518/article/details/130299722