有时候配置了国内加速站,但conda create
命令还是失败。可能是conda配置中开启了tls验证,而服务器不支持证书验证。
创建环境报错
conda create -n xxx python==3.10
Collecting package metadata (current_repodata.json): failed
CondaHTTPError: HTTP 504 GATEWAY TIME-OUT for url <http://10.155.97.225:8088/repository/conda-proxy/main/linux-64/current_repodata.json>
Elapsed: 00:06.135958
A remote server error occurred when trying to retrieve this URL.
A 500-type error (. 500, 501, 502, 503, etc.) indicates the server failed to
fulfill a valid request. The problem may be spurious, and will resolve itself if you
try your request again. If the problem persists, consider notifying the maintainer
of the remote server.
执行命令,发现配置如下:
conda config --show-sources
==> /root/.condarc <==
channel_alias: http://10.155.97.225:8088/repository/conda-proxy
channels:
- /anaconda/cloud/conda-forge/
- /anaconda/cloud/pytorch/
- /anaconda/pkgs/main/
- /anaconda/pkgs/free/
- defaults
default_channels:
- main
- r
show_channel_urls: True
编辑文件/etc/conda
,做如下操作:
- 删除里面的channel_alias
- 原本是
ssl_verify: true
,要设置ssl_verify: false
channels:
- /anaconda/pkgs/free/
- /anaconda/pkgs/main/
- /anaconda/cloud/conda-forge/
- /anaconda/cloud/pytorch/
ssl_verify: false