Technology Sharing

[conda] Solve the problem of An HTTP error occurred when trying to retrieve this URL.

2024-07-12

한어Русский языкEnglishFrançaisIndonesianSanskrit日本語DeutschPortuguêsΕλληνικάespañolItalianoSuomalainenLatina

1. Modify SSL verification

If other methods do not work, you can also try to disable SSL verification to solve the problem. The specific steps are as follows:

  1. Enter the following command in the terminal to turn off SSL verification:

    conda config --set ssl_verify false
    
    • 1
  2. Alternatively, add a line to conda's configuration file (.condarc) to turn off SSL verification:

    ssl_verify: false
    
    • 1

Then try to install the package again. Please note that disabling SSL verification has certain security risks, so it is recommended to use this method only when necessary.

The above is the solutioncondaThere are several possible solutions to the problem of "An HTTP error occurred when trying to retrieve this URL" when installing a package. You can try the appropriate method according to the specific situation. At the same time, in order to better solve this problem, it is recommended to check whether the network connection is normal, try to use a different network environment, or wait for a while before installing.

2. Reset source configuration
  1. Remove the existing source configuration:

    conda config --remove-key channels
    
    • 1
  2. Re-add Tsinghua source:

    conda config --add channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/free/
    conda config --add channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main/
    conda config --add channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/pytorch/
    conda config --set show_channel_urls yes
    
    • 1
    • 2
    • 3
    • 4
  3. See the effect:

    cat ~/.condarc
    
    • 1

Through the above steps, you can reset and configure Tsinghua University Open Source Software Mirror Station tocondaThis can speed up package downloads and resolve installation failures caused by network issues.