CondaHTTPError: HTTP 000 CONNECTION FAILED for url <https://mirrors.tuna.tsinghua.edu.cn/anaconda/pk

Problem Description:

When using conda to install the package, I encountered an error:

Collecting package metadata (repodata.json): failed

CondaHTTPError: HTTP 000 CONNECTION FAILED for url <https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main/linux-64/repodata.json>
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.
'https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main/linux-64'

Cause Analysis:

Obviously there is a problem with the web page access. I tried to change other sources, but the same error was displayed. Finally, we found the reasons on the Internet, and there are two situations.

solution:

vim ~/.condarc

First check your configuration:

channels:
  - https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/free/
  - https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main/
  - defaults
show_channel_urls: true
default_channels:
  - http://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main
  - http://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/free
  - http://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/r
custom_channels:
  conda-forge: http://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud
  msys2: http://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud
  bioconda: http://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud
  menpo: http://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud
  pytorch: http://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud
  simpleitk: http://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud

I am here to change the previous https to http

channels:
  - http://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/free/
  - http://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main/
  - defaults

The solution on some windows is to change http to https, which should be the reason for network security. The https protocol is a secure ssl encrypted transmission protocol, which encrypts the communication between the browser and the server to ensure the security of data transmission.

conda offline installation

If the above operation does not work, the network is still too bad.
Insert picture description here
Go directly to the website to download the installation package, after downloading, go to the download folder to execute:

conda install --use-local pytorch-1.2.0-py3.7_cuda9.2.148_cudnn7.6.2_0.tar.bz2

After the installation is successful, the corresponding compressed package and the decompressed folder will appear in the ~/anaconda3/pkgs subfolder of the conda folder.

In fact, this step is only to install the package to site-packages, but actually does not complete the installation of the dependent libraries. Therefore, you can continue to execute:

conda install -c local pytorch

Or use the installation command to install it again, which will check the missing dependent libraries and download and install it:

conda install XXX

Guess you like

Origin blog.csdn.net/qq_41917697/article/details/114577787