使用conda安装包时报CondaHTTPError: HTTP 000 CONNECTION FAILED错误如何解决
CondaHTTPError 000 CONNECTION FAILED 解决方案
对应报错信息:
CondaHTTPError: HTTP 000 CONNECTION FAILED for url <https://repo.anaconda.com/pkgs/main/win-64/current_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. If your current network has https://www.anaconda.com blocked, please file a support request with your network engineering team. 'https://repo.anaconda.com/pkgs/main/win-64'
该报错核心原因为conda无法正常连接官方源服务器,按照以下步骤依次排查即可解决:
- 更换国内镜像源
国内访问Anaconda官方源速度极慢,甚至会被运营商网络限制,替换为国内开源镜像源可解决90%以上同类问题。
Windows系统下找到用户目录下的.condarc文件(路径为C:\Users\你的用户名\.condarc,不存在则手动新建),将文件内容替换为如下配置:
修改完成后执行channels: - defaults show_channel_urls: true default_channels: - https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main - https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/r - https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/msys2 custom_channels: conda-forge: https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud msys2: https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud bioconda: https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud menpo: https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud pytorch: https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud simpleitk: https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloudconda clean -i清除本地索引缓存,再重新尝试安装包即可。 - 排查本地代理配置
若本地开启了系统代理或VPN,会导致conda网络请求被拦截,可选择两种方案处理:- 临时关闭代理/VPN后再执行conda安装命令
- 在
.condarc文件中添加代理配置,内容如下(替换为你自己的代理端口即可):
proxy_servers: http: http://127.0.0.1:你的代理端口 https: http://127.0.0.1:你的代理端口 - 临时关闭SSL验证(仅测试用,不建议长期开启)
上述操作都无效的情况下,可临时关闭SSL验证排查是否是证书校验导致的问题,执行命令:conda config --set ssl_verify false
测试安装完成后建议改回true避免安全风险。 - 检查网络限制
若使用公司内网,大概率是网络管理员屏蔽了Anaconda相关域名,联系公司IT团队开通对应访问权限即可。
内容的提问来源于stack exchange,提问作者Mariem Bennour
相关产品推荐
相关产品推荐

