Conda 创建 PyTorch 环境失败:'UnavailableInvalidChannel: HTTP 404 NOT FOUND' 错误解决方法

在使用 conda 创建 PyTorch 环境时,你可能会遇到以下错误:

(base) C:\Users\lenovo>conda create -n pytorch python=3.10
Collecting package metadata (current_repodata.json): failed

UnavailableInvalidChannel: HTTP 404 NOT FOUND for channel pypi/simple <https://mirrors.aliyun.com/pypi/simple>

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.

这个错误提示表明 conda 无法访问 pypi/simple 频道,可能是由于网络问题或配置问题导致的。为了解决这个问题,可以按照以下步骤进行操作:

  1. 检查网络连接是否正常,确保可以访问互联网。
  2. 验证 conda 配置:
    • 运行以下命令检查 conda 配置:
      conda config --show channels
      conda config --show-sources
      
    • 确保 pypi/simple 频道已经添加到配置文件中。如果没有添加,可以通过以下命令手动添加:
      conda config --add channels pypi/simple
      
  3. 切换 conda 镜像源:
    • 如果上述步骤无法解决问题,可以尝试切换 conda 的镜像源,选择一个可用的镜像源。以清华镜像为例,可以通过以下命令进行切换:
      conda config --add channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main/
      conda config --add channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/free/
      conda config --add channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/pytorch/
      
    • 然后再次运行创建环境的命令:
      conda create -n pytorch python=3.10
      

以上三个步骤中的任何一个都可能解决此问题。如果这些步骤都无法解决问题,建议尝试其他的 conda 镜像源,或者等待一段时间再尝试。

Conda 创建 PyTorch 环境失败:'UnavailableInvalidChannel: HTTP 404 NOT FOUND' 错误解决方法

原文地址: https://www.cveoy.top/t/topic/nvYx 著作权归作者所有。请勿转载和采集!

免费AI点我,无需注册和登录