Conda pulls pytorch from conda-forge channel instead of pytorch channel

Hi everyone,

At our research lab, we use Z2JH v2.0.0, with jupyter/scipy-notebook:hub-3.0.0 containers. The container has Python 3.10.8 and conda 22.9.0;

No matter if I set strict channel order or not, conda will always pull Pytorch from conda-forge channel instead of pytorch channel. The plan suggested by conda:

  + nsight-compute           2022.4.0.15  0                         nvidia/linux-64          801MB
  + pytorch                       1.12.1  cuda112py310he33e0d6_201  conda-forge/linux-64     512MB
  + pytorch-cuda                    11.6  h867d48c_1                pytorch/noarch             3kB

The environment.yml execute with conda env update -f environment.yml is the following:

name: base

channels:
    - pytorch
    - nvidia
    - conda-forge
    - defaults
    
dependencies:
    - pytorch=1.13.1
    - pytorch-cuda=11.6

Installing manually with mamba install pytorch==1.13.1 pytorch-cuda==11.6 -c pytorch -c nvidia -c defaults -c conda-forge gives the same result.

The output of conda info:

jovyan@jupyter-gcerar:~$ conda info

     active environment : None
       user config file : /home/jovyan/.condarc
 populated config files : /opt/conda/.condarc
          conda version : 22.9.0
    conda-build version : not installed
         python version : 3.10.8.final.0
       virtual packages : __cuda=12.0=0
                          __linux=5.15.0=0
                          __glibc=2.35=0
                          __unix=0=0
                          __archspec=1=x86_64
       base environment : /opt/conda  (writable)
      conda av data dir : /opt/conda/etc/conda
  conda av metadata url : None
           channel URLs : https://conda.anaconda.org/conda-forge/linux-64
                          https://conda.anaconda.org/conda-forge/noarch
          package cache : /opt/conda/pkgs
                          /home/jovyan/.conda/pkgs
       envs directories : /opt/conda/envs
                          /home/jovyan/.conda/envs
               platform : linux-64
             user-agent : conda/22.9.0 requests/2.28.1 CPython/3.10.8 Linux/5.15.0-58-generic ubuntu/22.04.1 glibc/2.35
                UID:GID : 1000:100
             netrc file : None
           offline mode : False

I’m a bit desperate at this point. Even the transition from Z2JH from 1.5 to 2.0 didn’t go without two days of downtime and backup rescue mission.

Found the problem. At one point, maintainers of jupyter/*-notebook containers decided to switch from the anaconda to the conda-forge channel as default. The conda could not resolve dependencies with MKL and suggested conda-forge’s PyTorch compiled for CUDA toolkit v11.2.

The solution was to add the anaconda channel explicitly, which resolved the issue. Example:
mamba install pytorch=1.13.1 pytorch-cuda=11.7 -c pytorch -c nvidia -c anaconda -c conda-forge