Search code examples
pythonpytorchanacondanvcc

Does pytorch use the cudatoolkit in the conda environment or the system?


I installed pytorch and torchvision in my conda environment with pip install torch==1.5.1+cu101 torchvision==0.6.1+cu101, to my understanding this means that the pytorch library is compiled with cuda10.1. And upon running nvcc --version , I get

nvcc: NVIDIA (R) Cuda compiler driver
Copyright (c) 2005-2017 NVIDIA Corporation
Built on Fri_Nov__3_21:07:56_CDT_2017
Cuda compilation tools, release 9.1, V9.1.85

And I assume this means that the cudatoolkit in my system is cuda9.1, but if I then go on to install a different version of cudatoolkit in my conda environment with conda install -c anaconda cudatoolkit=10.1. Which cudatoolkit will pytorch use?


I used pip install for pytorch because this was the instruction given in the original repo I am planning to use.


Solution

  • Yes, the pip wheels and conda binaries ship with their own CUDA runtime (as well as cuDNN. NCCL etc.) so you would only need to install the NVIDIA driver. If you want to build PyTorch from source or a custom CUDA extension, the local CUDA toolkit will be used.

    As answered in the link here.