报错信息
当使用 conda install
安装软件时往往会出现如下报错:
$ conda install -n [envs] -c [channels] [packages]
Collecting package metadata (repodata.json): failed
ProxyError: Conda cannot proceed due to an error in your proxy configuration.
Check for typos and other configuration errors in any '.netrc' file in your home directory,
any environment variables ending in '_PROXY', and any other system-wide proxy
configuration settings.
问题分析
使用企业集群大型机安装软件时,出于安全考虑,一般会走代理。而 conda
无法自动识别代理IP和端口,因此需要为 conda
配置文件指定代理IP和端口
解决方案
- 查看软件安装节点(联网节点)的代理IP和端口
$ echo $http_proxy
http://10.53.15.246:3128
$ echo $https_proxy
https://10.53.15.246:3128
- 设置conda的配置文件,一般在home目录下
~/.condarc
,打开配置文件后,如下设置proxy_servers
并保存即可
$ vi ~/.condarc
channels:
- https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main/
- https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/free/
- defaults
show_channel_urls: true
proxy_servers:
http: http://10.53.15.246:3128
https: https://10.53.15.246:3128
ssl_verify: false