Conda installation of pytorch is slow or fails

Very convinced, very convinced

Conda installed pytorch intermittently for a long time, and every time I downloaded less than 10%, I reported the following error:

CondaHTTPError: HTTP 000 CONNECTION FAILED for url <https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/pytorch/linux-64/pytorch-1.5.1-py3.5_cuda10.2.89_cudnn7.6.5_0.tar.bz2>
Elapsed: -

An HTTP error occurred when trying to retrieve this URL.
HTTP errors are often intermittent, and a simple retry will get you on your way.

Most of the solutions found on the Internet are to modify the download source of conda:

conda config --add channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/pytorch/

conda install pytorch torchvision cpuonly -c pytorch

# 但是一定要去掉后面的 -c pytorch。因为命令最后是-c pytorch,所以默认还是从conda源下载,新安装的清华等源没有用上,接下来就是丝滑般安装了

This method still did not solve the problem, and the download and installation failed.

Later I referred to this article:  conda install pytorch solution for slow installation

The specific steps are:

1. First download the compressed package of pytorch on the Internet (the direct conda install pytorch above will give a link to the download address even if the download fails), but I have a lot of twists and turns when I perform this step, and I often disconnect when I download it. Click to continue downloading;

2. Decompress the downloaded compressed package and place it in the cache address of conda (conda config --show can view the cache address, usually .conda/pkgs under home and pkgs in the anaconda installation path). I will put these two places Put all the decompressed folders;

3. Add the download path of this pytorch package in the urls.txt file under /pkgs of the anaconda3 download path:

4. Execute conda install pytorch again, and that's it.

Guess you like

Origin blog.csdn.net/whuzhang16/article/details/115356437