Difference in pip install and conda install pytorch with GPU

I want to download pytorch with cuda=11.7. I find not only pip install but also conda install will download the cudatoolkit.
The pip comand is

pip install torch==1.13.1+cu117 torchvision==0.14.1+cu117 torchaudio==0.13.1 --extra-index-url https://download.pytorch.org/whl/cu117

The conda comand is :

conda install pytorch==1.13.1 torchvision==0.14.1 torchaudio==0.13.1 pytorch-cuda=11.7 -c pytorch -c nvidia

Why does these two methods will all download the cudatoolkit?

I’m not sure I understand the question completely, but both binaries ship with their CUDA dependencies and allow you to execute PyTorch code directly without installing a full CUDA toolkit locally. You would only need to install the NVIDIA drivers.

1 Like

That is what I need! Thanks so much. I find there is some slight difference between Pytorch versions. For example in v1.12.1 the download command is :

conda install pytorch==1.12.1 torchvision==0.13.1 torchaudio==0.12.1 cudatoolkit=11.6 -c pytorch -c conda-forge

And in Pytorch v1.13.1 it is :

conda install pytorch==1.13.1 torchvision==0.14.1 torchaudio==0.13.1 pytorch-cuda=11.6 -c pytorch -c nvidia

Does the v1.12.1 download the cudatoolkit while v1.13.1 only download CUDA runtime and other binaries such as cudnn and cublas rather than cudatoolkit?

The install commands can differ depending on our build process but both should install a PyTorch conda binary able to execute workloads on the GPU.

Thanks! An awesome reply.