I am Charmie

メモとログ

Anaconda's channel priority

Summary

  • about Anaconda's channel priority
  • to avoid unexpected version change of some packages
  • manage channel priority by conda config --add/--prepend/--append channels new_channel -. You can check the official information here

The problem

I encountered the following confirmation message after conda update --all. I refused the update because this update was going to downgrade my important packages.

conda update --all
... (several lines are omitted)
The following packages will be SUPERSEDED by a higher-priority channel:

  pytorch            pytorch::pytorch-1.1.0-py3.6_cuda10.0~ --> pkgs/main::pytorch-1.0.1-cuda100py36he554f03_0
  torchvision        pytorch::torchvision-0.3.0-py36_cu10.~ --> pkgs/main::torchvision-0.2.1-py36_0


Proceed ([y]/n)? n

Collision on a package contained in multiple channels

When different channels have a same package, conda handles collision between them. In such situation, conda takes the following steps to resolve the collision.

1. Sorts packages from highest to lowest channel priority.
2. Sorts tied packages---same channel priority---from highest to lowest version number.
3. Sorts still-tied packages---same channel priority and same version---from highest to lowest build number.
4. Installs the first package on the sorted list that satisfies the installation specifications.

Solution

In my case, written above, I only had defaults channel in my priority list. Therefore, conda was going to install the downgraded version of the packages contained in the default channel.

The solution is simple. Following the official information, I first prioritize pytorch channel and then update all the packages.

$ conda config --add channels pytorch
$ conda config --get channels
  --add channels 'defaults'   # lowest priority
  --add channels 'pytorch'   # highest priority
$ conda update --all