How to update from CPU only install to CUDA install?

AlphaBetaGamma96: <p>Hi All,</p>
<p>A bit of a stupid question but how can I upgrade from my CPU only install to one that has CUDA? I did read this question <a href="https://discuss.pytorch.org/t/upgrading-from-cpu-only-to-gpu/64168">here</a> but it hasn’t worked.</p>
<p>I ran the following command to update to pytorch with CUDA support: <code>conda install pytorch torchvision torchaudio cudatoolkit=11.1 -c pytorch -c nvidia</code> but when I tried to see if cuda is available it doesn’t appear. I.e,</p>
<pre><code class="lang-auto">torch.cuda.is_available() #returns False
</code></pre>
<p>I even uninstalled all of pytorch AND anaconda itself, yet to reinstall anaconda but pytorch stills exist in a CPU-only state. I’m sure I’m doing something really stupid but any help would be greatly appreciated!</p>
<p>Thank you!</p>

ptrblck: <p>Could you create a new conda environment and reinstall the PyTorch binary with <code>cudatoolkit</code>? During the installation check the log / terminal output and make sure that the CUDA version is indeed selected and installed.<br>
If the GPU still cannot be used, check that you have recent NVIDIA drivers installed on your machine.</p>

AlphaBetaGamma96: <p>Hi <a class="mention" href="/u/ptrblck">@ptrblck</a>!</p>
<p>I’ve managed to get it all working! The only issue I can is that I’m using Python with conda yet python seems to be using my pip install of PyTorch. For example, when I installed it via conda it found conflicts and wouldn’t detect my GPu at all (via <code>torch.cuda.is_available()</code>), but when I installed via pip. It worked and detect my GPU. A little bit strange to me!</p>
<p>Is it advisable to run PyTorch from conda rather than pip?</p>
<p>Thank you! <img src="https://discuss.pytorch.org/images/emoji/apple/slight_smile.png?v=9" title=":slight_smile:" class="emoji" alt=":slight_smile:"></p>

ptrblck: <aside class="quote no-group" data-username="AlphaBetaGamma96" data-post="3" data-topic="123885">
<div class="title">
<div class="quote-controls"></div>
<img loading="lazy" alt="" width="24" height="24" src="https://discuss.pytorch.org/letter_avatar_proxy/v4/letter/a/3da27b/48.png" class="avatar"> AlphaBetaGamma96:</div>
<blockquote>
<p>Is it advisable to run PyTorch from conda rather than pip?</p>
</blockquote>
</aside>
<p>I don’t think so and it depends on your workflow. While I’m using conda to manage my environments, I’m installing a lot of different conda, pip, and source builds into them to test and debug different setups.<br>
I also make sure that my base environment in coda is “clean”, i.e. no additional packages are installed there to avoid any conflicts.<br>
I’m also sure that others prefer to use <code>pip</code> more and have valid reasons for it. <img src="https://discuss.pytorch.org/images/emoji/apple/wink.png?v=12" title=":wink:" class="emoji" alt=":wink:" loading="lazy" width="20" height="20"></p>

AlphaBetaGamma96: <p>Well, the only reason I’m using pip is because python seems to default to it even though Python says it’s using Anaconda! <img src="https://discuss.pytorch.org/images/emoji/apple/sweat_smile.png?v=9" title=":sweat_smile:" class="emoji" alt=":sweat_smile:"> I assume this is because I’m defaulting to pip even though the Python interpreter says in using Anaconda in the start-up when I use <code>python3</code> via command line?</p>