Why conda installs old pytorch with by default with cudatoolkit=11.2

I am trying to install conda for cudatoolkit=11.2 on google colab using:

conda install pytorch cudatoolkit=11.2 -c pytorch -c nvidia

But why does it install old pytorch=1.0.0 version not something >1.6?

If I try to force install pytorch=1.6, it gives the following error:

UnsatisfiableError: The following specifications were found to be incompatible with a past
explicit spec that is not an explicit spec in this operation (cudatoolkit):

  - cudatoolkit=11.2
  - pytorch=1.6 -> cudatoolkit[version='>=10.1,<10.2|>=10.2,<10.3|>=9.2,<9.3']

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

Output in format: Requested package -> Available versions

Package setuptools conflicts for:
setuptools
python=3.7 -> pip -> setuptools
conda[version='>=4.10.3'] -> setuptools[version='>=31.0.1']
wheel -> setuptools
pip -> setuptools
...

I basically want to work with the latest versions of pytorch with cudatoolkit=11.2.

The PyTorch binaries are not built with CUDA11.2 and you would have to stick to the install commands provided here.

conda install pytorch cudatoolkit=11.1 -c pytorch -c nvidia

Can this work for even cudatoolkit=11.2?

No, you cannot install the PyTorch binaries built with CUDA11.2, since they are not available.
If you want to use this specific CUDA version, you could build from source.
Alternatively, you could install the nightly binaries with CUDA11.3 using:

pip install --pre torch -f https://download.pytorch.org/whl/nightly/cu113/torch_nightly.html

Thanks for the reply, I guess you overlooked cudatoolkit=11.1 in my previous reply?

No, I haven’t overlooked it.
Your posted command using cudatoolkit=11.1 will work.

No, this won’t work.

ok. I am curious why it did install cudatoolkit=11.1 even though my cuda version is actually 11.2.

The binaries ship with their own CUDA runtime so your local CUDA toolkit (assuming that’s what you mean by “cuda 11.2”) won’t be used unless you are building from source or a custom CUDA extension.

1 Like

So this solution should work also with cuda version 11.2, isn’t it?

I’m unsure which “solution” you are referring to, but in case it’s my initial post mentioning to use the supported install commands, then yes. The PyTorch binaries use their own CUDA runtime and your local CUDA toolkit will only be used if you are building from source or a custom CUDA extension.

I’m reffering to the following command:

pip install --pre torch -f https://download.pytorch.org/whl/nightly/cu113/torch_nightly.html

Would it allow me to use pytorch with cuda 11.2?

No, since the PyTorch binaries were not built for CUDA 11.2.