Package pytorch conflicts during installation with Conda

I’m trying to install PyTorch through conda but I’m getting “conflict” errors:

I first activated the conda virtualenvironment:

(base) raphy@pc:~$ source activate pytorch_env

Then, tried to install the packages:

(pytorch_env) raphy@pc:~$ conda install -n pytorch_env pytorch torchvision torchaudio cpuonly -c pytorch
Collecting package metadata (current_repodata.json): done
Solving environment: failed with initial frozen solve. Retrying with flexible solve.
Solving environment: failed with repodata from current_repodata.json, will retry with next repodata source.
Collecting package metadata (repodata.json): done
Solving environment: failed with initial frozen solve. Retrying with flexible solve.
Solving environment: / 
Found conflicts! Looking for incompatible packages.
This can take several minutes.  Press CTRL-C to abort.
failed                                                                                                                                                                                       

UnsatisfiableError: The following specifications were found to be incompatible with each other:

Output in format: Requested package -> Available versions

Package pytorch conflicts for:
torchvision -> pytorch[version='1.1.*|1.2.0+cu92|1.2.0|1.3.0|1.3.1|1.4.0|1.5.0|1.5.1|1.6.0|1.7.0|1.7.1|1.8.0|1.8.1|>=1.1.0|>=1.0.0|>=0.4|>=0.3|1.7.1.*|1.3.1.*|1.2.0.*']
torchaudio -> pytorch[version='1.2.0|1.3.0|1.3.1|1.4.0|1.5.0|1.5.1|1.6.0|1.7.0|1.7.1|1.8.0|1.8.1|>=1.1.0']
pytorch

Package six conflicts for:
pytorch -> mkl-service[version='>=2,<3.0a0'] -> six
torchvision -> six

Package _libgcc_mutex conflicts for:
torchvision -> libgcc-ng[version='>=7.3.0'] -> _libgcc_mutex=[build=main]
pytorch -> libgcc-ng[version='>=7.3.0'] -> _libgcc_mutex=[build=main]
python=3.9 -> libgcc-ng[version='>=7.3.0'] -> _libgcc_mutex=[build=main]

(pytorch_env) raphy@pc:~$ 

If I install it with pip3 it seems working fine:

(pytorch_env) raphy@pc:~$ pip3 install torch==1.8.1+cpu torchvision==0.9.1+cpu torchaudio==0.8.1 -f https://download.pytorch.org/whl/torch_stable.html
Looking in links: https://download.pytorch.org/whl/torch_stable.html
Collecting torch==1.8.1+cpu
  Downloading https://download.pytorch.org/whl/cpu/torch-1.8.1%2Bcpu-cp39-cp39-linux_x86_64.whl (169.1 MB)
     |████████████████████████████████| 169.1 MB 126 kB/s 
Collecting torchvision==0.9.1+cpu
  Downloading https://download.pytorch.org/whl/cpu/torchvision-0.9.1%2Bcpu-cp39-cp39-linux_x86_64.whl (13.3 MB)
     |████████████████████████████████| 13.3 MB 37.6 MB/s 
Collecting torchaudio==0.8.1
  Downloading torchaudio-0.8.1-cp39-cp39-manylinux1_x86_64.whl (1.9 MB)
     |████████████████████████████████| 1.9 MB 14.3 MB/s 
Requirement already satisfied: numpy in ./anaconda3/envs/pytorch_env/lib/python3.9/site-packages (from torch==1.8.1+cpu) (1.20.1)
Requirement already satisfied: typing-extensions in ./anaconda3/envs/pytorch_env/lib/python3.9/site-packages (from torch==1.8.1+cpu) (3.7.4.3)
Requirement already satisfied: pillow>=4.1.1 in ./anaconda3/envs/pytorch_env/lib/python3.9/site-packages (from torchvision==0.9.1+cpu) (8.2.0)
Installing collected packages: torch, torchvision, torchaudio
  Attempting uninstall: torch
    Found existing installation: torch 1.8.1
    Uninstalling torch-1.8.1:
      Successfully uninstalled torch-1.8.1
Successfully installed torch-1.8.1+cpu torchaudio-0.8.1 torchvision-0.9.1+cpu
(pytorch_env) raphy@pc:~$ cd pythonMatters/
(pytorch_env) raphy@pc:~/pythonMatters$ ls -lah
total 12K
drwxrwxr-x  2 raphy raphy 4,0K mag 31 16:54 .
drwxr-xr-x 39 raphy raphy 4,0K mag 31 17:22 ..
-rw-rw-r--  1 raphy raphy   44 mag 31 16:54 pytorch_verification.py
(pytorch_env) raphy@pc:~/pythonMatters$ nano pytorch_verification.py 
(pytorch_env) raphy@pc:~/pythonMatters$ python3 pytorch_verification.py 
tensor([[0.3230, 0.9078, 0.4617],
        [0.8623, 0.9219, 0.2986],
        [0.1736, 0.4657, 0.5214],
        [0.8163, 0.1591, 0.7434],
        [0.1205, 0.6854, 0.3539]])
(pytorch_env) raphy@pc:~/pythonMatters$ 

OS: Ubuntu 20.04 Desktop
python: Python 3.9.4
PyTorch Build: 1.8.1
conda 4.10.1