Repository: pytorch
Issue: Mamba does not respect `cpuonly` when creating a conda environment from YAML file
Labels: oncall: releng,triaged,Stale

## 🐛 Bug

I cannot install the `cpuonly` conda version of PyTorch using `mamba` without also getting `cudatoolkits` which I don't need.

## To Reproduce

The `environment.yaml`:

```
name: test_env
channels:
  - defaults
  - pytorch
  - conda-forge
  - anaconda
dependencies:
  - pytorch::pytorch=1.10.0
  - pytorch::torchvision
  - pytorch::torchtext
  - pytorch::torchaudio
  - pytorch::cpuonly
```

And the result of the package index using mamba:
```
+ _libgcc_mutex                  0.1  main               pkgs/main/linux-64     Cached
  + _openmp_mutex                  4.5  1_gnu              pkgs/main/linux-64     Cached
  + blas                           1.0  mkl                pkgs/main/linux-64     Cached
  + brotlipy                     0.7.0  py39h27cfd23_1003  pkgs/main/linux-64     Cached
  + bzip2                        1.0.8  h7b6447c_0         pkgs/main/linux-64     Cached
  + ca-certificates         2021.10.26  h06a4308_2         pkgs/main/linux-64     Cached
  + certifi                  2021.10.8  py39h06a4308_0     pkgs/main/linux-64     Cached
  + cffi                        1.14.6  py39h400218f_0     pkgs/main/linux-64     Cached
  + charset-normalizer           2.0.4  pyhd3eb1b0_0       pkgs/main/noarch       Cached
  + cpuonly                        2.0  0                  pytorch/noarch         Cached
  + cryptography                35.0.0  py39hd23ed53_0     pkgs/main/linux-64     Cached
  + cudatoolkit                10.2.89  hfd86e86_1         anaconda/linux-64      Cached
  + ffmpeg                       4.2.2  h20bf706_0         pkgs/main/linux-64     Cached
  + freetype                    2.11.0  h70c0345_0         pkgs/main/linux-64     Cached
  + giflib                       5.2.1  h7b6447c_0         pkgs/main/linux-64     Cached
  + gmp                          6.2.1  h2531618_2         pkgs/main/linux-64     Cached
  + gnutls                      3.6.15  he1e5248_0         pkgs/main/linux-64     Cached
  + idna                           3.3  pyhd3eb1b0_0       pkgs/main/noarch        49 KB
  + intel-openmp              2021.4.0  h06a4308_3561      pkgs/main/linux-64     Cached
  + jpeg                            9d  h7f8727e_0         pkgs/main/linux-64     Cached
  + lame                         3.100  h7b6447c_0         pkgs/main/linux-64     Cached
  + lcms2                         2.12  h3be6417_0         pkgs/main/linux-64     Cached
  + ld_impl_linux-64            2.35.1  h7274673_9         pkgs/main/linux-64     Cached
  + libffi                         3.3  he6710b0_2         pkgs/main/linux-64     Cached
  + libgcc-ng                    9.3.0  h5101ec6_17        pkgs/main/linux-64     Cached
  + libgomp                      9.3.0  h5101ec6_17        pkgs/main/linux-64     Cached
  + libidn2                      2.3.2  h7f8727e_0         pkgs/main/linux-64     Cached
  + libopus                      1.3.1  h7b6447c_0         pkgs/main/linux-64     Cached
  + libpng                      1.6.37  hbc83047_0         pkgs/main/linux-64     Cached
  + libstdcxx-ng                 9.3.0  hd4cf53a_17        pkgs/main/linux-64     Cached
  + libtasn1                    4.16.0  h27cfd23_0         pkgs/main/linux-64     Cached
  + libtiff                      4.2.0  h85742a9_0         pkgs/main/linux-64     Cached
  + libunistring                0.9.10  h27cfd23_0         pkgs/main/linux-64     Cached
  + libuv                       1.40.0  h7b6447c_0         pkgs/main/linux-64     Cached
  + libvpx                       1.7.0  h439df22_0         pkgs/main/linux-64     Cached
  + libwebp                      1.2.0  h89dd481_0         pkgs/main/linux-64     Cached
  + libwebp-base                 1.2.0  h27cfd23_0         pkgs/main/linux-64     Cached
  + lz4-c                        1.9.3  h295c915_1         pkgs/main/linux-64     Cached
  + mkl                       2021.4.0  h06a4308_640       pkgs/main/linux-64     Cached
  + mkl-service                  2.4.0  py39h7f8727e_0     pkgs/main/linux-64     Cached
  + mkl_fft                      1.3.1  py39hd3c417c_0     pkgs/main/linux-64     Cached
  + mkl_random                   1.2.2  py39h51133e4_0     pkgs/main/linux-64     Cached
  + ncurses                        6.3  h7f8727e_2         pkgs/main/linux-64     Cached
  + nettle                       3.7.3  hbbd107a_1         pkgs/main/linux-64     Cached
  + numpy                       1.21.2  py39h20f2e39_0     pkgs/main/linux-64     Cached
  + numpy-base                  1.21.2  py39h79a1101_0     pkgs/main/linux-64     Cached
  + olefile                       0.46  pyhd3eb1b0_0       pkgs/main/noarch       Cached
  + openh264                     2.1.0  hd408876_0         pkgs/main/linux-64     Cached
  + openssl                     1.1.1l  h7f8727e_0         pkgs/main/linux-64     Cached
  + pillow                       8.4.0  py39h5aabda8_0     pkgs/main/linux-64     Cached
  + pip                         21.2.4  py39h06a4308_0     pkgs/main/linux-64     Cached
  + pycparser                     2.21  pyhd3eb1b0_0       pkgs/main/noarch       Cached
  + pyopenssl                   21.0.0  pyhd3eb1b0_1       pkgs/main/noarch       Cached
  + pysocks                      1.7.1  py39h06a4308_0     pkgs/main/linux-64     Cached
  + python                       3.9.7  h12debd9_1         pkgs/main/linux-64     Cached
  + pytorch                     1.10.0  py3.9_cpu_0        pytorch/linux-64       Cached
  + pytorch-mutex                  1.0  cpu                pytorch/noarch         Cached
  + readline                       8.1  h27cfd23_0         pkgs/main/linux-64     Cached
  + requests                    2.26.0  pyhd3eb1b0_0       pkgs/main/noarch       Cached
  + setuptools                  58.0.4  py39h06a4308_0     pkgs/main/linux-64     Cached
  + six                         1.16.0  pyhd3eb1b0_0       pkgs/main/noarch       Cached
  + sqlite                      3.36.0  hc218d9a_0         pkgs/main/linux-64     Cached
  + tk                          8.6.11  h1ccaba5_0         pkgs/main/linux-64     Cached
  + torchaudio                  0.10.0  py39_cu102         pytorch/linux-64       Cached
  + torchtext                   0.11.0  py39               pytorch/linux-64       Cached
  + torchvision                 0.11.1  py39_cu102         pytorch/linux-64       Cached
  + tqdm                        4.62.3  pyhd3eb1b0_1       pkgs/main/noarch       Cached
  + typing_extensions         3.10.0.2  pyh06a4308_0       pkgs/main/noarch       Cached
  + tzdata                       2021e  hda174b7_0         pkgs/main/noarch       Cached
  + urllib3                     1.26.7  pyhd3eb1b0_0       pkgs/main/noarch       Cached
  + wheel                       0.37.0  pyhd3eb1b0_1       pkgs/main/noarch       Cached
  + x264                1!157.20191217  h7b6447c_0         pkgs/main/linux-64     Cached
  + xz                           5.2.5  h7b6447c_0         pkgs/main/linux-64     Cached
  + zlib                        1.2.11  h7b6447c_3         pkgs/main/linux-64     Cached
  + zstd                         1.4.9  haebb681_0         pkgs/main/linux-64     Cached
```

As you can see, `cudatoolkits` is on the list.

Steps to reproduce the behavior:
1. Create a yaml file with the snippet I've pasted. 
2. Execute `mamba create env --file environment.yaml`