News from this site

 Rental advertising space, please contact the webmaster if you need cooperation


+focus
focused

classification  

no classification

tag  

no tag

date  

2024-11(6)

解决方法集合CondaHTTPError:HTTP 000 CONNECTION FAILED for url<https://mirrors.tuna.tsinghua.edu.cn/anaco

posted on 2023-05-21 18:35     read(1079)     comment(0)     like(3)     collect(1)


Table of contents

background

solution

The main reason: the configuration is not paired

Method A: Enter in cmd

Method B: Modify .condarc (runtime configuration file)​​​​​​

other reasons

Reason A: Proxy or VPN is enabled

Reason B: The security housekeeper such as the firewall is not turned off

Reason C: The mirror address cannot be accessed

Reason D: mirror source plus system

Reason E: The server connected to the internal network cannot access the external network

Conda config related command format

View conda config

add channel

delete channel

delete default

tips: pip mirror source download package

Temporarily set the mirror source

Permanently set mirror source download


background

Because the download speed of the default source is slow, replace the mirror source.

Take Tsinghua Source as an example Index of /anaconda/pkgs/main/ | Tsinghua Open Source Software Mirror Station | Tsinghua Open Source Mirror

solution

The main reason: the configuration is not paired

Method A: Enter in cmd

  1. (删除 ”- default“(可选))
  2. conda config --remove channels defaults
  3. (添加镜像源,注意是http,而非https,因为https有时候会出现连接错误的问题,改成http后不会再出现此类问题。)
  4. conda config --add channels http://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/free/
  5. conda config --add channels http://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main/
  6. conda config --add channels http://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/pytorch/
  7. conda config --add channels http://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/conda-forge/
  8. (在设置中显示以上镜像源)
  9. conda config --set show_channel_urls yes
  10. (关掉验证,对于http来说,走的是明文传输,不加密的,就不需要验证,其中信息的加密方式为SSL)
  11. conda config --set ssl_verify false

If unsuccessful, try method B

Method B: Modify .condarc (runtime configuration file)​​​​​​

You can also change ssl_verify directly in the .condarc file;

If the .condarc file cannot be found, it is because the conda config command was not entered in the cmd command. Only after entering the command for the first time, the system will automatically create the .condarc file.

  1. show_channel_urls: true
  2. default_channels:
  3. - http://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main/linux-64
  4. - http://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/r
  5. - http://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/msys2
  6. custom_channels:
  7. conda-forge: http://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud
  8. msys2: http://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud
  9. bioconda: http://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud
  10. menpo: http://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud
  11. pytorch: http://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud
  12. simpleitk: http://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud
  13. ssl_verify: false

other reasons

Reason A: Proxy or VPN is enabled

Reason B: The security housekeeper such as the firewall is not turned off

Reason C: The mirror address cannot be accessed

  • test:

a. The website directly opens the mirror address and finds that it cannot enter, which means that the reason is C

b. Execute the " conda config --remove-key channels " command to restore the source to the default.

Perform the download again. If it is found that the other descriptions are the same except for the mirror address, it means that it is not the reason C

  • solve:

Domestic mirror sources
Alibaba Cloud http://mirrors.aliyun.com/pypi/simple/
Douban http://pypi.douban.com/simple/
Tsinghua University https://pypi.tuna.tsinghua.edu.cn/simple/
University of Science and Technology of China http://pypi.mirrors.ustc.edu.cn/simple/
Huazhong University of Science and Technology http://pypi.hustunique.com/

For example: replace Tsinghua source with Zhongke Dayuan

https://mirrors.ustc.edu.cn/anaconda/pkgs/free/

https://mirrors.ustc.edu.cn/anaconda/pkgs/main/
https://mirrors.ustc.edu.cn/anaconda/cloud/conda-forge/
Download via conda install cython command

Reason D: mirror source plus system

Reason E: The server connected to the internal network cannot access the external network

(External network here: according to the definition of the server)

You can download the installation package, upload it to the server, and use it as a local source

Conda config related command format

View conda config

conda config --show


add channel

conda config --append channels http://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/free/

conda config --add channels http://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/free/


delete channel

conda config --remove channels http://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/free/


delete default

conda config --remove channels defaults
 

tips: pip mirror source download package

Temporarily set the mirror source

pip install Package to be installed https://pypi.tuna.tsinghua.edu.cn/simple opencv-contrib-python

pip install opencv-python https://pypi.tuna.tsinghua.edu.cn/simple opencv-contrib-python

Permanently set mirror source download

pip config set global.index-url https://pypi.tuna.tsinghua.edu.cn/simple


Reference link: Solve CondaHTTPError: HTTP 000 CONNECTION FAILED for url<https://mirrors.tuna.tsinghua.edu.cn/anaconda***_Zhou's Learning Notes Blog-CSDN Blog



Category of website: technical article > Blog

Author:Poison

link:http://www.pythonblackhole.com/blog/article/25354/ec94b0d4d5cfccbdf40a/

source:python black hole net

Please indicate the source for any form of reprinting. If any infringement is discovered, it will be held legally responsible.

3 0
collect article
collected

Comment content: (supports up to 255 characters)