Anaconda始终希望在更新时将我的GPU Pytorch版本替换为CPU Pytorch版本

时间:2020-06-29 02:03:56

标签: anaconda pytorch conda

我有一个新安装的Anaconda3(2020.02版)环境,并且已经通过命令conda install pytorch torchvision cudatoolkit=10.2 -c pytorch安装了Pytorch GPU版本。我已经证实我的Pytorch确实可以在GPU上正常运行。

但是,每当我通过conda update --all更新Anaconda时,始终会显示以下消息:

The following packages will be SUPERSEDED by a higher-priority channel:

  pytorch            pytorch::pytorch-1.5.0-py3.7_cuda102_~ --> pkgs/main::pytorch-1.5.0-cpu_py37h9f948e0_0

换句话说,它总是想将我的GPU版本Pytorch替换为CPU版本。我尝试过,如果继续更新,它将安装CPU版本Pytorch,而我以前在GPU上的Pytorch代码无法再运行。我也尝试过命令conda update --all --no-channel-priority,但该消息仍然显示。

据我所知,我从未修改过Anaconda频道或添加自定义频道。我如何摆脱此消息?

1 个答案:

答案 0 :(得分:0)

之所以发生这种情况,是因为默认情况下,conda更喜欢优先级较高的通道中的软件包,而不是优先级较低的通道中的任何版本。 -conda docs

您可以通过更改pytorch-more here的顺序来将.condarc通道的优先级设置为高于默认通道来解决此问题

channels:
  - pytorch
  - defaults
  - conda-forge

channel_priority: true

或者您可以通过指定为选项来升级它:

conda update --all -c pytorch