本文主要是介绍【已解决】配置pytorch环境中出现的报错:Collecting package metadata (current_repodata.json): failed,希望对大家解决编程问题提供一定的参考价值,需要的开发者们随着小编来一起学习吧!
今天在配置pytorch环境,参考这位大佬的方法https://blog.csdn.net/weixin_45527999/article/details/124571570
只不过在pytorch官网选择安装的code之后出现了如下报错
(pytorch) C:\Users\wjnde>conda install pytorch torchvision torchaudio pytorch-cuda=11.7 -c pytorch -c nvidia
Collecting package metadata (current_repodata.json): failedCondaSSLError: OpenSSL appears to be unavailable on this machine. OpenSSL is required to
download and install packages.Exception: HTTPSConnectionPool(host='conda.anaconda.org', port=443): Max retries exceeded with url: /pytorch/win-64/current_repodata.json (Caused by SSLError("Can't connect to HTTPS URL because the SSL module is not available."))
尝试了文中所说的更改.condarc方法,好像和我的不匹配,还是出现报错如下:
(pytorch) C:\Users\wjnde>conda install pytorch torchvision torchaudio pytorch-cuda=11.7 -c pytorch -c nvidia
Collecting package metadata (current_repodata.json): failedUnavailableInvalidChannel: HTTP 404 NOT FOUND for channel nvidia <http://mirrors.tuna.tsinghua.edu.cn/anaconda/nvidia>The channel is not accessible or is invalid.You will need to adjust your conda configuration to proceed.
Use `conda config --show channels` to view your configuration's current state,
and use `conda config --show-sources` to view config file locations.
于是尝试了直接删除.condarc,没用,十分不建议
然后找到了一段更换清华源的代码,打开.condarc文件把原本内容删掉改为如下就可以:
channels:- defaults
custom_channels:conda-forge: https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloudmsys2: https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloudbioconda: https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloudmenpo: https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloudpytorch: https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloudsimpleitk: https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud
default_channels:- https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main- https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/r- https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/msys2
show_channel_urls: True
需要注意一定要再次运行conda config --show-sources,确认配置文件内容已经修改
然后就完美解决,安装成功
如果还是有问题的话建议参考一下下面这位博主的方法
https://blog.csdn.net/weixin_46034990/article/details/128685668
这篇关于【已解决】配置pytorch环境中出现的报错:Collecting package metadata (current_repodata.json): failed的文章就介绍到这儿,希望我们推荐的文章对编程师们有所帮助!