Anaconda always want to replace my GPU Pytorch version to CPU Pytorch version when updating
I have a newly installed Anaconda3 (version 2020.02) environment, and I have installed Pytorch GPU version by the command conda install pytorch torchvision cudatoolkit=10.2 -c pytorch. I have verified that my Pytorch indeed runs fine on GPU.
However, whenever I update Anaconda by conda update --all, the following messages always shows:
The following packages will be SUPERSEDED by a higher-priority channel:

  pytorch            pytorch::pytorch-1.5.0-py3.7_cuda102_~ --&gt; pkgs/main::pytorch-1.5.0-cpu_py37h9f948e0_0

In other words, it always want to replace my GPU version Pytorch to CPU version. I have tried that if continue the update, it will install the CPU version Pytorch and my previous Pytorch code on GPU could not run anymore. I have also tried the command conda update --all --no-channel-priority but the message still shows.
To my knowledge I have never modified Anaconda channels or add custom channels. How can I get rid of this message?

It's happening because, by default, conda prefers packages from a higher priority channel over any version from a lower priority channel.  -- conda docs
You can solve this problem by setting the priority of pytorch channel higher than the default channel by changing the order in .condarc -- more here
channels:
  - pytorch
  - defaults
  - conda-forge

channel_priority: true

or you can upgrade it by specifying as option:
conda update --all -c pytorch

