conda下载出现连接超时怎么办 改变源,设置timeout时间

您所在的位置:网站首页 runtimeerror怎么办 conda下载出现连接超时怎么办 改变源,设置timeout时间

conda下载出现连接超时怎么办 改变源,设置timeout时间

2023-08-04 21:15| 来源: 网络整理| 查看: 265

conda下载出现连接超时怎么办文章目录: 一、连接超时原因二、解决conda下载超时的两种办法1、添加下载镜像地址2、conda通过参数设置修改超时时间 三、超时依旧没有解决的其他原因

一、连接超时原因

连接超时一般是由于网络的原因,还有默认的下载源是在国外的服务器,所以一般下载速度回比较慢,在下载比较大安装包就会出现下载中断的现象。

二、解决conda下载超时的两种办法 1、添加下载镜像地址 pip解决超时 添加超时参数 ‘–timeout’添加镜像源地址参数-i 一般我们用pip下载超时,可以添加下载超时参数,也可以加 -i 然后在后面加上国内的镜像地址,下载速度就会提升很快,常用的国内镜像地址:清华镜像:https://pypi.tuna.tsinghua.edu.cn/simple豆瓣镜像:https://pypi.doubanio.com/simple阿里镜像:https://mirrors.aliyun.com/pypi/simple/中国科技大学:http://pypi.mirrors.ustc.edu.cn/simple/华中理工大学:http://pypi.hustunique.com/山东理工大学:http://pypi.sdutlinux.org/

永久更改pip的镜像源(参考1,参考2)

conda 修改配置文件 所以我们也可以通过修改conda的配置文件,修改默认的下载源地址,解决下载超时的问题 参考

通过conda config --show 可以查看conda 的配置文件地址,我的.condarc配置文件所在路径如下(/home/mosheng/.condarc)): 在这里插入图片描述 所有的配置文件信息如下:

命令:mosheng@server:~/miniconda3/bin$ conda config --show

add_anaconda_token: True add_pip_as_python_dependency: True aggressive_update_packages: - ca-certificates - certifi - openssl allow_non_channel_urls: False allow_softlinks: False always_copy: False always_softlink: False always_yes: None anaconda_upload: None auto_update_conda: True changeps1: True channel_alias: https://conda.anaconda.org channel_priority: True channels: - https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main/ - 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/ - https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/pytorch/ - loopbio - defaults # 把这一行删除 client_ssl_cert: None client_ssl_cert_key: None clobber: False create_default_packages: [] custom_channels: pkgs/main: https://repo.anaconda.com pkgs/r: https://repo.anaconda.com pkgs/pro: https://repo.anaconda.com pkgs/free: https://repo.anaconda.com custom_multichannels: local: [] defaults: ["https://repo.anaconda.com/pkgs/main", "https://repo.anaconda.com/pkgs/free", "https://repo.anaconda.com/pkgs/r", "https://repo.anaconda.com/pkgs/pro"] default_channels: - https://repo.anaconda.com/pkgs/main - https://repo.anaconda.com/pkgs/free - https://repo.anaconda.com/pkgs/r - https://repo.anaconda.com/pkgs/pro disallowed_packages: [] download_only: False envs_dirs: - /home/mosheng/miniconda3/envs - /home/mosheng/.conda/envs force: False json: False local_repodata_ttl: 1 max_shlvl: 2 migrated_channel_aliases: [] no_dependencies: False non_admin_enabled: True notify_outdated_conda: True offline: False override_channels_enabled: True path_conflict: clobber pinned_packages: [] pkgs_dirs: - /home/mosheng/miniconda3/pkgs - /home/mosheng/.conda/pkgs proxy_servers: {} quiet: False remote_connect_timeout_secs: 40.0 remote_max_retries: 3 remote_read_timeout_secs: 100.0 report_errors: None rollback_enabled: True safety_checks: warn shortcuts: True show_channel_urls: True ssl_verify: True track_features: [] use_index_cache: False use_pip: True verbosity: 0 whitelist_channels: [] 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677

把配置文件中的-defaults这一行删除即可 在这里插入图片描述 开始修改配置文件:

vi /home/mosheng/.condarc 在这里插入图片描述

再查看conda config --show 配置信息中的默认通道已经被成功删除 在这里插入图片描述

2、conda通过参数设置修改超时时间 查看conda的配置信息:

conda config --show 在这里插入图片描述

conda 修改配置信息

从配置信息中可以看到,默认的连接超时时间和默认的读取超时时间分别是9.15s和60s 在这里插入图片描述 下面通过参数设置来修改默认的值:

conda config --set

把连接超时的时间设置成40s,读取超时的时间修改成100s

conda config --set remote_connect_timeout_secs 40 conda config --set remote_read_timeout_secs 100

修改之后的结果: 在这里插入图片描述

其他 的参数修改同理,只要在–set后制定参数的名和修改之后参数的值即可

三、超时依旧没有解决的其他原因

如果你尝试了以上方法,依旧出现超时的现象,你要查看一下是不是你的breakwall软件导致的,你可以退出breakwall软件或更改节点再次尝试 Reference: 1、https://blog.csdn.net/AIYA_aya/article/details/78993173 2、https://stackoverflow.com/questions/42797957/changing-timeout-limit-when-using-conda-install

在这里插入图片描述

在这里插入图片描述

在这里插入图片描述 ♠ ⊕ ♠ ⊕ ♠ ⊕ ♠ ⊕ ♠ ⊕ ♠ ⊕ ♠ ⊕ ♠ ⊕ ♠ ⊕ ♠ ⊕ ♠ ⊕ ♠ ⊕ ♠ ⊕ ♠ ⊕ ♠ ⊕ ♠ ⊕ ♠ ⊕ ♠ ⊕ ♠ ⊕ ♠ ⊕ ♠ ⊕ ♠ ⊕ ♠ ⊕ ♠ ⊕ ♠ ⊕ ♠ ⊕ ♠ ⊕ ♠ ⊕ ♠ ⊕ ♠ ⊕ ♠



【本文地址】


今日新闻


推荐新闻


CopyRight 2018-2019 办公设备维修网 版权所有 豫ICP备15022753号-3