翼度科技»论坛 云主机 服务器技术 查看内容

服务器安装conda环境遇到代理PROXY问题及解决方案

2

主题

2

帖子

6

积分

新手上路

Rank: 1

积分
6
背景
  1. ProxyError: Conda cannot proceed due to an error in your proxy configuration.
复制代码
使用的是组里的服务器,主要是在创建虚拟环境以及在已创建的虚拟环境中使用运行时都出现了同样的ProxyError,主要是因为conda没法处理代理,因此得要用户手动修改**.condarc**文件。一共分为两步
  1. 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.
复制代码
1: 创建环境时出现ProxyError
  1. ~$ conda create -n nn
  2. Collecting package metadata (current_repodata.json): failed
复制代码
  1. 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 proxyconfiguration settings.
复制代码
解决方案

首先进入**.condarc**文件,通常为空
  1. ~$ vim .condarc
复制代码
这里对**.condarc**的修改如下:
  1. channels:
  2.   - defaults
  3. show_channel_urls: true
  4. default_channels:
  5.   - https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main
  6.   - https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/r
  7.   - https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/msys2
  8. custom_channels:
  9.   conda-forge: https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud
  10.   msys2: https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud
  11.   bioconda: https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud
  12.   menpo: https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud
  13.   pytorch: https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud
  14.   pytorch-lts: https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud
  15.   simpleitk: https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud
复制代码
之后conda可以创建虚拟环境,本以为一切ok准备安装一些依赖包的时候,ProxyError再次出现。

2:安装依赖时出现ProxyError

安装pytorch时错误再次出现
  1. ~$ conda install pytorch torchvision torchaudio cudatoolkit=10.2 -c pytorch
  2. Collecting package metadata (current_repodata.json): failed
复制代码
  1. 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 proxyconfiguration settings.
复制代码
解决方案:

同样是对**.condarc**文件进行修改,首先查看自己的代理ip
  1. ~$ echo $http_proxy
  2. http://...
复制代码
复制打印出的代理ip地址并添加到**.condarc**配置文件中。(地址都是http,不是https)
  1. proxy_servers:
  2.   http: http://...
  3.   https: http://...
  4. ssl_verify: False
复制代码
以上就是服务器安装conda环境遇到代理PROXY问题及解决方案的详细内容,更多关于服务器安装conda PROXY的资料请关注脚本之家其它相关文章!

来源:https://www.jb51.net/server/29130903b.htm
免责声明:由于采集信息均来自互联网,如果侵犯了您的权益,请联系我们【E-Mail:cb@itdo.tech】 我们会及时删除侵权内容,谢谢合作!

举报 回复 使用道具