# How does PyTorch detect the CUDA installation?

**URL:** <https://discuss.pytorch.org/t/how-does-pytorch-detect-the-cuda-installation/103552>\
**Category:** Uncategorized\
**Created:** [November 20, 2020, 5:15pm UTC](https://discuss.pytorch.org/t/how-does-pytorch-detect-the-cuda-installation/103552 "2020-11-20T17:15:15Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![lykius](https://discuss.pytorch.org/letter_avatar_proxy/v4/letter/l/aeb1de/32.png) [@lykius](https://discuss.pytorch.org/u/lykius)\
**Post date:** [November 20, 2020, 5:15pm UTC](https://discuss.pytorch.org/t/how-does-pytorch-detect-the-cuda-installation/103552/1 "2020-11-20T17:15:15Z")

</div>

Hi, a question mainly out of curiosity: how does PyTorch detect the CUDA installation on the pc?  
For instance, on my pc I have CUDA-10.1 installed in /usr/local/cuda-10.1 but I have not added it neither to PATH or to LD\_LIBRARY\_PATH. Nevertheless, PyTorch detects its seamlessly and everything works out fine. How is this done?

Thanks in advance for any hint!

---

<div class="post-metadata">

**Author:** ![ptrblck](https://discuss.pytorch.org/user_avatar/discuss.pytorch.org/ptrblck/32/1823_2.png) [@ptrblck](https://discuss.pytorch.org/u/ptrblck)\
**Post date:** [November 23, 2020, 5:44am UTC](https://discuss.pytorch.org/t/how-does-pytorch-detect-the-cuda-installation/103552/2 "2020-11-23T05:44:43Z")

</div>

The conda binaries and pip wheels ship with their own CUDA runtime and your local CUDA toolkit will not be used.  
You would only need to provide a sufficiently new NVIDIA driver and it should work.  
Your local CUDA toolkit would be used, if you are building PyTorch from source or are building custom CUDA extensions.

---

<div class="post-metadata">

**Author:** ![lykius](https://discuss.pytorch.org/letter_avatar_proxy/v4/letter/l/aeb1de/32.png) [@lykius](https://discuss.pytorch.org/u/lykius)\
**Post date:** [November 23, 2020, 8:39am UTC](https://discuss.pytorch.org/t/how-does-pytorch-detect-the-cuda-installation/103552/3 "2020-11-23T08:39:40Z")

</div>

Thank you very much @ptrblck, that makes a lot of sense!  
And also, it’s a great deploy strategy, a big thumbs up for PyTorch once again!
