【亲测有效】linux conda proxy报错问题解决方法

发布于:2024-10-12 ⋅ 阅读:(145) ⋅ 点赞:(0)

conda proxy报错问题怎么解决?

报错信息如下:

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.

我的环境

$ uname -v
132~20.04.1-Ubuntu SMP Fri Aug 30 15:50:07 UTC 2024
$ conda --version
conda 24.7.1

系统配置了代理。

问题描述

当执行 $ conda update conda$ conda install numpy时,出现如下错误:

Retrying (Retry(total=0, connect=None, read=None, redirect=None, status=None)) after connection broken by 'NameResolutionError("<urllib3.connection.HTTPSConnection object at 0x7f9958c53680>: Failed to resolve 'http' ([Errno -3] Temporary failure in name resolution)")': /pkgs/r/linux-64/repodata.json.zst

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.

解决方法

步骤1: 清除系统代理,unset掉带_proxy或_PROXY的系统变量

# 找到系统带_proxy或_PROXY的系统变量
env | grep -i "_PROXY"

我的结果如下图:
请添加图片描述

# unset 带_proxy或_PROXY的变量
unset no_proxy
unset https_proxy
unset NO_PROXY
unset HTTPS_PROXY
unset HTTP_PROXY
unset http_proxy

步骤2: 设置conda自带的代理,命令如下:

# 设置conda的代理环境变量
conda config --set proxy_servers.http 192.168.2.9:7890
conda config --set proxy_servers.https 192.168.2.9:7890

注意,很多教程的指令是错误的,多了一个http和https,如下为错误示范

# 错误指令
conda config --set proxy_servers.http http://11.22.33.44:808
conda config --set proxy_servers.https https://11.22.33.44:808

网站公告

今日签到

点亮在社区的每一天
去签到