CondaHTTPError: HTTP 000 CONNECTION FAILED for url

  • Post author:
  • Post category:其他


莫名奇妙的遇到一个坑,

CondaHTTPError: HTTP 000 CONNECTION FAILED for url


错误:

ubuntu@ubuntu-System-Product-Name:~$ conda update --all
Solving environment: failed

CondaHTTPError: HTTP 000 CONNECTION FAILED for url <https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/msys2/noarch/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.
ProxyError(MaxRetryError("HTTPSConnectionPool(host='mirrors.tuna.tsinghua.edu.cn', port=443): Max retries exceeded with url: /anaconda/cloud/msys2/noarch/repodata.json (Caused by ProxyError('Cannot connect to proxy.', NewConnectionError('<urllib3.connection.VerifiedHTTPSConnection object at 0x7f3b217a7fd0>: Failed to establish a new connection: [Errno 111] Connection refused',)))",),)


网上很多解决办法就是,更改为清华源,修改后的源为:

channels:
  - https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/bioconda/
  - https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/free/
  - https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/msys2/
  - https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/conda-forge/
show_channel_urls: true

但是,这并不能解决我的问题,还是提示错误。终于让我找到一个厉害的博客,写的很好,


https://www.imooc.com/article/37905


使用

netstat

查看本地端口的使用情况

ubuntu@ubuntu-System-Product-Name:~$ sudo netstat -ntpl
[sudo] password for ubuntu: 
Active Internet connections (only servers)
Proto Recv-Q Send-Q Local Address           Foreign Address         State       PID/Program name
tcp        0      0 127.0.1.1:53            0.0.0.0:*               LISTEN      1336/dnsmasq    
tcp        0      0 127.0.0.1:631           0.0.0.0:*               LISTEN      979/cupsd       
tcp6       0      0 ::1:631                 :::*                    LISTEN      979/cupsd       

查看本地网络是否走了代理服务

ubuntu@ubuntu-System-Product-Name:~$ export | grep -i prox
declare -x HTTPS_PROXY="http://127.0.0.1:33421/"
declare -x HTTP_PROXY="http://127.0.0.1:33421/"
declare -x NO_PROXY="localhost,127.0.0.0/8,::1"
declare -x http_proxy="http://127.0.0.1:33421/"
declare -x https_proxy="http://127.0.0.1:33421/"
declare -x no_proxy="localhost,127.0.0.0/8,::1"

关闭服务

ubuntu@ubuntu-System-Product-Name:~$ unset HTTPS_PROXY(请注意大小写,应与declare -x HTTPS_PROXY="http://127.0.0.1:33421/"一致)
ubuntu@ubuntu-System-Product-Name:~$ export | grep -i prox
declare -x HTTP_PROXY="http://127.0.0.1:33421/"
declare -x NO_PROXY="localhost,127.0.0.0/8,::1"
declare -x http_proxy="http://127.0.0.1:33421/"
declare -x no_proxy="localhost,127.0.0.0/8,::1"

验证

ubuntu@ubuntu-System-Product-Name:~$ conda update --all
Solving environment: - 
Warning: 2 possible package resolutions (only showing differing packages):
  - https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/free::blas-1.0-mkl
  - defaults::blas-1.0-mdone

## Package Plan ##

  environment location: /home/ubuntu/anaconda2


The following packages will be downloaded:

    package                    |            build
    ---------------------------|-----------------
    blas-1.0                   |              mkl           6 KB  https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/free

The following packages will be UPDATED:

    blas: 1.0-mkl defaults --> 1.0-mkl https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/free

Proceed ([y]/n)? Y


Downloading and Extracting Packages
blas-1.0             | 6 KB      | ##################################### | 100% 
Preparing transaction: done
Verifying transaction: done
Executing transaction: done

深深的叹一口气(唉~)



版权声明:本文为l_ml_m_lm_m原创文章,遵循 CC 4.0 BY-SA 版权协议,转载请附上原文出处链接和本声明。