PyTorch Installation-RTX 3060

amir_mm: <p>Hello, I have been working diligently to install Pytorch but I haven’t been successful so far. Here’s the summary of my situation:<br>
Using NVIDIA RTX 3060 GPU (with the latest updates).<br>
Installed CUDA 11.7, cuDNN 8.9.3, running Python 3.8.17 on my conda environment.<br>
Correct Paths are set in the environment variables.</p>
<p>Tried the following commands to install Pytorch:</p>
<ol>
<li>conda install pytorch torchvision torchaudio pytorch-cuda=11.7 -c pytorch -c nvidia</li>
<li>pip3 install torch torchvision torchaudio --index-url <a href="https://download.pytorch.org/whl/cu117" rel="noopener nofollow ugc">https://download.pytorch.org/whl/cu117</a></li>
<li>conda install pytorch==2.0.0 torchvision==0.15.0 torchaudio==2.0.0 pytorch-cuda=11.7 -c pytorch -c nvidia<br>
4)conda install pytorch torchvision torchaudio -c pytorch</li>
</ol>
<p>Neither of them work and getting the same errors as following:<br>
AssertionError: Torch not compiled with CUDA enabled<br>
GPU not available, using CPU.<br>
cuDNN Version: None</p>
<p>Could you please assist me in diagnosing and resolving this issue?<br>
Thanks a lot</p>

ptrblck: <p>The error message explains that you’ve installed the CPU-only binary. A simple <code>pip install torch</code> install command will install <code>2.0.1+cu117</code> and will work on your GPU.</p>

amir_mm: <p>Thanks a lot for your message.<br>
I just created a new environment and installed:<br>
pip install torch==2.0.1+cu117 torchvision==0.15.2+cu117 --extra-index-url <a href="https://download.pytorch.org/whl/cu117" rel="noopener nofollow ugc">https://download.pytorch.org/whl/cu117</a></p>
<p>But again getting the same error and doesn’t recognize the GPU. So weird!</p>

ptrblck: <p>Could you post the install log here so that I could have a look at it, please?</p>

amir_mm: <p>I am not sure if you are asking for this, but hope this is the one:</p>
<p>Using pip 23.2.1 from C:\Users\seyed\anaconda3\envs\pytorch_rtx\lib\site-packages\pip (python 3.8)<br>
Looking in indexes: <a href="https://pypi.org/simple" class="inline-onebox" rel="noopener nofollow ugc">Simple index</a>, <a href="https://download.pytorch.org/whl/cu117" rel="noopener nofollow ugc">https://download.pytorch.org/whl/cu117</a><br>
Requirement already satisfied: torch==2.0.1+cu117 in c:\users\seyed\anaconda3\envs\pytorch_rtx\lib\site-packages (2.0.1+cu117)<br>
Requirement already satisfied: torchvision==0.15.2+cu117 in c:\users\seyed\anaconda3\envs\pytorch_rtx\lib\site-packages (0.15.2+cu117)<br>
Requirement already satisfied: filelock in c:\users\seyed\anaconda3\envs\pytorch_rtx\lib\site-packages (from torch==2.0.1+cu117) (3.12.3)<br>
Requirement already satisfied: typing-extensions in c:\users\seyed\anaconda3\envs\pytorch_rtx\lib\site-packages (from torch==2.0.1+cu117) (4.7.1)<br>
Requirement already satisfied: sympy in c:\users\seyed\anaconda3\envs\pytorch_rtx\lib\site-packages (from torch==2.0.1+cu117) (1.12)<br>
Requirement already satisfied: networkx in c:\users\seyed\anaconda3\envs\pytorch_rtx\lib\site-packages (from torch==2.0.1+cu117) (3.1)<br>
Requirement already satisfied: jinja2 in c:\users\seyed\anaconda3\envs\pytorch_rtx\lib\site-packages (from torch==2.0.1+cu117) (3.1.2)<br>
Requirement already satisfied: numpy in c:\users\seyed\anaconda3\envs\pytorch_rtx\lib\site-packages (from torchvision==0.15.2+cu117) (1.24.4)<br>
Requirement already satisfied: requests in c:\users\seyed\anaconda3\envs\pytorch_rtx\lib\site-packages (from torchvision==0.15.2+cu117) (2.31.0)<br>
Requirement already satisfied: pillow!=8.3.*,&gt;=5.3.0 in c:\users\seyed\anaconda3\envs\pytorch_rtx\lib\site-packages (from torchvision==0.15.2+cu117) (10.0.0)<br>
Requirement already satisfied: MarkupSafe&gt;=2.0 in c:\users\seyed\anaconda3\envs\pytorch_rtx\lib\site-packages (from jinja2-&gt;torch==2.0.1+cu117) (2.1.3)<br>
Requirement already satisfied: charset-normalizer&lt;4,&gt;=2 in c:\users\seyed\anaconda3\envs\pytorch_rtx\lib\site-packages (from requests-&gt;torchvision==0.15.2+cu117) (3.2.0)<br>
Requirement already satisfied: idna&lt;4,&gt;=2.5 in c:\users\seyed\anaconda3\envs\pytorch_rtx\lib\site-packages (from requests-&gt;torchvision==0.15.2+cu117) (3.4)<br>
Requirement already satisfied: urllib3&lt;3,&gt;=1.21.1 in c:\users\seyed\anaconda3\envs\pytorch_rtx\lib\site-packages (from requests-&gt;torchvision==0.15.2+cu117) (2.0.4)<br>
Requirement already satisfied: certifi&gt;=2017.4.17 in c:\users\seyed\anaconda3\envs\pytorch_rtx\lib\site-packages (from requests-&gt;torchvision==0.15.2+cu117) (2023.7.22)<br>
Requirement already satisfied: mpmath&gt;=0.19 in c:\users\seyed\anaconda3\envs\pytorch_rtx\lib\site-packages (from sympy-&gt;torch==2.0.1+cu117) (1.3.0)</p>
<hr>
<h2><a name="nvcc-nvidia-r-cuda-compiler-driver-copyright-c-2005-2022-nvidia-corporation-built-on-wed_jun__8_165934_pacific_daylight_time_2022-cuda-compilation-tools-release-117-v11799-build-cuda_117r117compiler31442593_0-1" class="anchor" href="#nvcc-nvidia-r-cuda-compiler-driver-copyright-c-2005-2022-nvidia-corporation-built-on-wed_jun__8_165934_pacific_daylight_time_2022-cuda-compilation-tools-release-117-v11799-build-cuda_117r117compiler31442593_0-1"></a>nvcc: NVIDIA (R) Cuda compiler driver<br>
Copyright (c) 2005-2022 NVIDIA Corporation<br>
Built on Wed_Jun__8_16:59:34_Pacific_Daylight_Time_2022<br>
Cuda compilation tools, release 11.7, V11.7.99<br>
Build cuda_11.7.r11.7/compiler.31442593_0</h2>
<blockquote>
<blockquote>
<blockquote>
<p>import torch<br>
print(torch.<strong>version</strong>)<br>
2.0.1+cu117</p>
</blockquote>
</blockquote>
</blockquote>
<hr>
<p>Python 3.8.17 (default, Jul  5 2023, 20:44:21) [MSC v.1916 64 bit (AMD64)] :: Anaconda, Inc. on win32<br>
Type “help”, “copyright”, “credits” or “license” for more information.</p>

ptrblck: <p><code>2.0.1+cu117</code> is already installed. What does this return:</p>
<pre><code class="lang-python">import torch
print(torch.__version__)
print(torch.version.cuda)
print(torch.randn(1).cuda())
</code></pre>

amir_mm: <p>2.0.1+cpu<br>
None<br>
AssertionError: Torch not compiled with CUDA enabled</p>

ptrblck: <p>Your environment is apparently mixing up different PyTorch installations since the install log shows <code>2.0.1+cu117</code> while now it’s printing <code>2.0.1+cpu</code>.<br>
Uninstall all PyTorch binaries until <code>pip</code> and <code>conda</code> complain they cannot find any installation and install a single binary with the CUDA dependencies once.</p>

amir_mm: <p>Thank you so much. I uninstalled all PyTorch binaries from all environments, created a new environment, and installed version 2.0.1+cu117. Finally, I achieved the desired results:</p>
<p>2.0.1+cu117<br>
11.7<br>
tensor([0.4651], device=‘cuda:0’)</p>
<p>However, I encountered the same error when using Jupyter Notebook. But, it’s now working perfectly in PyCharm, and I’m pretty happy about it.<br>
Thanks again for your help.</p>

ptrblck: <p>Great! Your Jupyter environment might still use another PyTorch binary. You could check and compare the paths via <code>print(torch.__path__)</code> between the working and failing environment.</p>

amir_mm: <p>Sure, will do. thanks a lot!</p>

Lachter0808: <p>Hi i’m having a similar issue like this would you be able to help me?</p>