How to find CUDA path inside venv

username: aghand0ur
cooked: <p>Hello,</p>
<p>I am installing a project that asks to set environment variable <code>CUDA_HOME</code>.<br>
I have installed Pytorch inside venv using:<br>
<code>pip3 install torch torchvision torchaudio --index-url https://download.pytorch.org/whl/cu118</code></p>
<p>How would I know CUDA path, especiallt that <code>nvcc</code> is not installed?</p>
<p>Ali</p>

username: ptrblck
cooked: <p>The PyTorch binaries ship with their own CUDA runtime dependencies, not with a full CUDA toolkit including the compiler.<br>
Since a project requires <code>CUDA_HOME</code> I assume it’s asking for a full CUDA Toolkit, which you would need to install separately.</p>

username: aghand0ur
cooked: <p><a class="mention" href="/u/ptrblck">@ptrblck</a><br>
Would it be fine to install CUDA via conda first:<br>
<code>conda install -c "nvidia/label/cuda-11.8.0" cuda-toolkit</code></p>
<p>then follow instructions here to build torch:</p><aside class="onebox allowlistedgeneric" data-onebox-src="https://github.com/pytorch/pytorch#from-source">
  <header class="source">
      <img src="https://github.githubassets.com/favicons/favicon.svg" class="site-icon" width="32" height="32">

      <a href="https://github.com/pytorch/pytorch#from-source" target="_blank" rel="noopener nofollow ugc">GitHub</a>
  </header>

  <article class="onebox-body">
    <div class="aspect-image" style="--aspect-ratio:690/344;"><img src="https://opengraph.githubassets.com/e1e07625eb4318b00c80b982a52ff43a165d447a7544d081a52c64c722b16b8f/pytorch/pytorch" class="thumbnail" width="690" height="345"></div>

<h3><a href="https://github.com/pytorch/pytorch#from-source" target="_blank" rel="noopener nofollow ugc">GitHub - pytorch/pytorch: Tensors and Dynamic neural networks in Python with...</a></h3>

  <p>Tensors and Dynamic neural networks in Python with strong GPU acceleration - GitHub - pytorch/pytorch: Tensors and Dynamic neural networks in Python with strong GPU acceleration</p>


  </article>

  <div class="onebox-metadata">
    
    
  </div>

  <div style="clear: both"></div>
</aside>


username: ptrblck
cooked: <p>I’m unsure why you want to build PyTorch from source as it seems a 3rd party package complains about the missing CUDA compiler.<br>
Also, <code>cuda-toolkit</code> might just ship the runtime and headers.</p>

username: aghand0ur
cooked: <p>The library I am using relies on pytorch and CUDA…<br>
You mentioned that I might need to install full CUDA Toolkit.<br>
I am planning to do that via:<br>
<code>conda install -c "nvidia/label/cuda-11.8.0" cuda-toolkit</code></p>
<p>then, I need to install <code>pytorch</code> next. I assumed that I cannot simply install the binary via <code>pip</code> so I have to build it from source.</p>
<p>Did I get things wrong?</p>

username: ptrblck
cooked: <aside class="quote no-group" data-username="aghand0ur" data-post="5" data-topic="191075">
<div class="title">
<div class="quote-controls"></div>
<img loading="lazy" alt="" width="24" height="24" src="https://discuss.pytorch.org/user_avatar/discuss.pytorch.org/aghand0ur/48/55512_2.png" class="avatar"> aghand0ur:</div>
<blockquote>
<p>You mentioned that I might need to install full CUDA Toolkit.</p>
</blockquote>
</aside>
<p>Yes, and you can download it from e.g. <a href="https://developer.nvidia.com/cuda-downloads">here</a>.</p>
<aside class="quote no-group" data-username="aghand0ur" data-post="5" data-topic="191075">
<div class="title">
<div class="quote-controls"></div>
<img loading="lazy" alt="" width="24" height="24" src="https://discuss.pytorch.org/user_avatar/discuss.pytorch.org/aghand0ur/48/55512_2.png" class="avatar"> aghand0ur:</div>
<blockquote>
<p>I am planning to do that via:<br>
<code>conda install -c "nvidia/label/cuda-11.8.0" cuda-toolkit</code></p>
</blockquote>
</aside>
<p>This won’t work as it’s the CUDA runtime conda package and would not contain the compiler.</p>
<aside class="quote no-group" data-username="aghand0ur" data-post="5" data-topic="191075">
<div class="title">
<div class="quote-controls"></div>
<img loading="lazy" alt="" width="24" height="24" src="https://discuss.pytorch.org/user_avatar/discuss.pytorch.org/aghand0ur/48/55512_2.png" class="avatar"> aghand0ur:</div>
<blockquote>
<p>then, I need to install <code>pytorch</code> next. I assumed that I cannot simply install the binary via <code>pip</code> so I have to build it from source.</p>
</blockquote>
</aside>
<p>You still can install PyTorch from source assuming the error pointing to the missing <code>CUDA_HOME</code> comes from a 3rd party package.</p>