SoFunction
Updated on 2024-11-10

Detailed anaconda offline installation pytorchGPU version

How to install pytorch offline in case of bad internet speed. here by default you have already installed anaconda.

Install Nvidia drivers, cuda, cudnn and other dependencies

First install vs community edition, if you have already installed it you can skip this step.download address
Just install the following two components, you don't have to install them all.


After that, install the nvidia driver, paying attention to the correspondence between your graphics card and the driver.download address
My video card is a 940M, which corresponds to the following options:

Installing cuda

Here you have to pay attention to check the correspondence between the driver and cuda, first check the file name of the driver you downloaded.


You can see that there is a number at the beginning, this is the driver version, and the cuda will have a similar relationship to the following chart, because the cuda and the driver will be constantly updated, the back of the installation of the students, you can go to google, "cuda and nvidia driver corresponds to the relationship," to get the latest information.


Here I downloaded the 10.2 version of cuda

Installation of cudnn
To install cudnn you have to register an nvidia account to be able to download, this should also be noted the version correspondence.

Determine the packages needed for pytorch installation

First we create a new conda environment where we install the pytorch-gpu version.

conda create -n pytorch pip python=3.8

pytorch is the name of the environment we set up, and 3.8 is the python version of that environment, both of which you can change yourself.
Next try installing the pytorch-gpu package.
First visit pytorch'sofficial website
Selecting the corresponding option generates the corresponding command


We type in the anaconda command line

conda install pytorch torchvision cudatoolkit=10.2 -c pytorch

A similar list will be found


When the option appears, we select no and download the larger of the files locally.

package name Tsinghua Mirror Address
mkl2020 /anaconda/pkgs/main/linux-64/mkl-2020.
pytorch-gpu /anaconda/cloud/pytorch/win-64/pytorch-1.6.0-py3.8_cuda102_cudnn7_0.tar.bz2
cuda-toolkit /anaconda/pkgs/main/linux-64/cudatoolkit-10.2.89-hfd86e86_1.conda

Here's the link to the corresponding file in my installation. If the version is upgraded, just jump to the previous directory of the file and search for the filename.
Next, install these offline packages

conda install --offline package name

One thing to note here is that running conda commands directly from the installer path requires that you add conda's Scripts directory to the environment variable in advance.
Once this is done, you can run the previous command again to install pytorch-gpu.

conda install pytorch torchvision cudatoolkit=10.2 -c pytorch

To this point this article on the detailed anaconda offline installation pytorchGPU version of the article is introduced to this, more related anaconda offline installation pytorchGPU content please search for my previous articles or continue to browse the following related articles I hope that you will support me more in the future!