Not being install PyTorch

I am not being able to install PyTorch, I am getting an error about conflicting packages, although it is a new conda environment.

Created env using -
conda create --prefix ./ ipykernel -y

List of installed packages -

# packages in environment at /home/ayan/data/conda_envs/jovian_fcc:
#
# Name                    Version                   Build  Channel
_libgcc_mutex             0.1                        main  
backcall                  0.2.0              pyhd3eb1b0_0  
ca-certificates           2021.4.13            h06a4308_1  
certifi                   2020.12.5        py39h06a4308_0  
decorator                 5.0.9              pyhd3eb1b0_0  
ipykernel                 5.3.4            py39hb070fc8_0  
ipython                   7.22.0           py39hb070fc8_0  
ipython_genutils          0.2.0              pyhd3eb1b0_1  
jedi                      0.17.2           py39h06a4308_1  
jupyter_client            6.1.12             pyhd3eb1b0_0  
jupyter_core              4.7.1            py39h06a4308_0  
ld_impl_linux-64          2.33.1               h53a641e_7  
libffi                    3.3                  he6710b0_2  
libgcc-ng                 9.1.0                hdf63c60_0  
libsodium                 1.0.18               h7b6447c_0  
libstdcxx-ng              9.1.0                hdf63c60_0  
ncurses                   6.2                  he6710b0_1  
openssl                   1.1.1k               h27cfd23_0  
parso                     0.7.0                      py_0  
pexpect                   4.8.0              pyhd3eb1b0_3  
pickleshare               0.7.5           pyhd3eb1b0_1003  
pip                       21.1.1           py39h06a4308_0  
prompt-toolkit            3.0.17             pyh06a4308_0  
ptyprocess                0.7.0              pyhd3eb1b0_2  
pygments                  2.9.0              pyhd3eb1b0_0  
python                    3.9.5                hdb3f193_3  
python-dateutil           2.8.1              pyhd3eb1b0_0  
pyzmq                     20.0.0           py39h2531618_1  
readline                  8.1                  h27cfd23_0  
setuptools                52.0.0           py39h06a4308_0  
six                       1.15.0           py39h06a4308_0  
sqlite                    3.35.4               hdfb4753_0  
tk                        8.6.10               hbc83047_0  
tornado                   6.1              py39h27cfd23_0  
traitlets                 5.0.5              pyhd3eb1b0_0  
tzdata                    2020f                h52ac0ba_0  
wcwidth                   0.2.5                      py_0  
wheel                     0.36.2             pyhd3eb1b0_0  
xz                        5.2.5                h7b6447c_0  
zeromq                    4.3.4                h2531618_0  
zlib                      1.2.11               h7b6447c_3

All of the three following installation commands give same error -

conda install pytorch torchvision torchaudio cudatoolkit -c pytorch -c nvidia
conda install pytorch torchvision torchaudio cudatoolkit=11.1 -c pytorch -c nvidia
conda install pytorch torchvision torchaudio cudatoolkit=11.2 -c pytorch -c nvidia

I am getting the following error if I am not specifying cudatoolkit version -


 ➜ conda install pytorch torchvision torchaudio cudatoolkit -c pytorch -c nvidia                                                                                        [127]
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 libstdcxx-ng conflicts for:
cudatoolkit -> libstdcxx-ng[version='>=7.3.0|>=9.3.0']
pytorch -> cudatoolkit[version='>=11.1,<11.2'] -> libstdcxx-ng[version='>=7.2.0|>=9.3.0']
python=3.9 -> libstdcxx-ng[version='>=7.3.0']
torchvision -> libstdcxx-ng[version='>=5.4.0|>=7.3.0']
torchvision -> cudatoolkit[version='>=11.1,<11.2'] -> libstdcxx-ng[version='>=7.2.0|>=9.3.0']
pytorch -> libstdcxx-ng[version='>=5.4.0|>=7.3.0']
torchaudio -> python[version='>=3.9,<3.10.0a0'] -> libstdcxx-ng[version='>=5.4.0|>=7.2.0|>=7.3.0']

Package cudatoolkit conflicts for:
pytorch -> cudatoolkit[version='10.0.*|8.*|>=10.0,<10.1|>=10.1,<10.2|>=11.1,<11.2|>=10.2,<10.3|>=11.0,<11.1|>=9.2,<9.3|>=9.0,<9.1|>=8.0,<8.1|9.*|>=10.1.243,<10.2.0a0|>=9.2,<9.3.0a0|>=10.0.130,<10.1.0a0|9.2.*|>=9.0,<9.1.0a0|>=8.0,<8.1.0a0|9.0.*|8.0.*|7.5.*']
torchvision -> cudatoolkit[version='>=10.0,<10.1|>=10.1,<10.2|>=11.1,<11.2|>=10.2,<10.3|>=11.0,<11.1|>=9.2,<9.3|>=9.0,<9.1|>=10.0.130,<10.1.0a0|>=9.2,<9.3.0a0|>=9.0,<9.1.0a0']
torchvision -> pytorch==1.4.0 -> cudatoolkit[version='10.0.*|>=10.1.243,<10.2.0a0|9.2.*|>=8.0,<8.1|>=8.0,<8.1.0a0|8.*|9.*|9.0.*|8.0.*|7.5.*']
cudatoolkit
torchaudio -> pytorch==1.8.1 -> cudatoolkit[version='10.0.*|>=10.0,<10.1|>=10.1,<10.2|>=11.1,<11.2|>=10.2,<10.3|>=11.0,<11.1|>=9.2,<9.3|>=10.1.243,<10.2.0a0|>=9.2,<9.3.0a0|>=10.0.130,<10.1.0a0|9.2.*|>=9.0,<9.1|>=9.0,<9.1.0a0']

Package nccl conflicts for:
torchvision -> pytorch[version='>=0.4'] -> nccl[version='<2']
pytorch -> nccl[version='<2']

Package pytorch conflicts for:
pytorch
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.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']

Package _libgcc_mutex conflicts for:
cudatoolkit -> libgcc-ng[version='>=7.3.0'] -> _libgcc_mutex=[build=main]
torchvision -> libgcc-ng[version='>=7.3.0'] -> _libgcc_mutex=[build=main]
python=3.9 -> libgcc-ng[version='>=7.3.0'] -> _libgcc_mutex=[build=main]
pytorch -> libgcc-ng[version='>=7.3.0'] -> _libgcc_mutex=[build=main]The following specifications were found to be incompatible with your system:

  - feature:/linux-64::__glibc==2.33=0
  - feature:|@/linux-64::__glibc==2.33=0
  - pytorch -> cudatoolkit[version='>=11.1,<11.2'] -> __glibc[version='>=2.17,<3.0.a0']
  - torchvision -> cudatoolkit[version='>=11.1,<11.2'] -> __glibc[version='>=2.17,<3.0.a0']

Your installed version is: 2.33

My cuda version from nvidia-smi -

+-----------------------------------------------------------------------------+
| NVIDIA-SMI 460.80       Driver Version: 460.80       CUDA Version: 11.2     |
|-------------------------------+----------------------+----------------------+
| GPU  Name        Persistence-M| Bus-Id        Disp.A | Volatile Uncorr. ECC |
| Fan  Temp  Perf  Pwr:Usage/Cap|         Memory-Usage | GPU-Util  Compute M. |
|                               |                      |               MIG M. |
|===============================+======================+======================|
|   0  GeForce GTX 108...  Off  | 00000000:01:00.0 Off |                  N/A |
|  0%   90C    P5    29W / 250W |    131MiB / 11178MiB |      2%      Default |
|                               |                      |                  N/A |

It seems that at least two PyTorch packages are conflicting as 1.8.1 and 1.4.0. Did you also activate this new environment? If so, which Python version are you using?

Yes I have activated the environment and the python version is 3.8.10, it is the default version that Conda created.

I’m unable to reproduce the issue, as I can create a new env and install the packages there.
Could you also create a new env without the prefix usage via:

conda create -n tmp python=3.8
conda activate tmp
conda install pytorch torchvision torchaudio cudatoolkit=11.1 -c pytorch -c nvidia
python -c "import torch; print(torch.__version__)"