Facing Issue While Install Pytorch on CUDA version: 11.4

username: GAME_IS_ON
cooked: <p>Hello,<br>
I am trying to install PyTorch on the AWS EC2 Instance but am not able to access the GPU<br>
<strong>EC2 Instance Details:</strong><br>
<strong>Instance Name:</strong> Deep Learning AMI GPU CUDA 11.4.3 (Amazon Linux 2)<br>
<strong>Instance Type:</strong> t2.xlarge<br>
<strong>NVIDIA driver version:</strong> 510.47.03<br>
<strong>CUDA version:</strong> 11.4</p>
<p>(base) [ec2-user@ip-XXXXX ~]$ nvcc --version<br>
nvcc: NVIDIA (R) Cuda compiler driver<br>
Copyright (c) 2005-2021 NVIDIA Corporation<br>
Built on Mon_Oct_11_21:27:02_PDT_2021<br>
Cuda compilation tools, release 11.4, V11.4.152<br>
Build cuda_11.4.r11.4/compiler.30521435_0</p>
<p><strong>GPU Details:</strong><br>
(base) [ec2-user@ip-XXXXX ~]$ lspci | grep VGA<br>
00:02.0 VGA compatible controller: Cirrus Logic GD 5446</p>
<p>(test) [ec2-user@ip-XXXXX ~]$ python<br>
Python 3.7.13 (default, Mar 29 2022, 02:18:16)<br>
[GCC 7.5.0] :: Anaconda, Inc. on linux<br>
Type “help”, “copyright”, “credits” or “license” for more information.</p>
<blockquote>
<blockquote>
<blockquote>
<p>import torch<br>
torch.cuda.is_available()<br>
False</p>
</blockquote>
</blockquote>
</blockquote>
<p>Thanks in advance for any help…</p>

username: ptrblck
cooked: <p>How did you install PyTorch?<br>
As no CUDA runtime is available I would guess you’ve installed the CPU-only binaries?</p>

username: GAME_IS_ON
cooked: <p>I am installing PyTorch using the below command<br>
<strong>pip3 install torch torchvision torchaudio --extra-index-url <a href="https://download.pytorch.org/whl/cu113" rel="noopener nofollow ugc">https://download.pytorch.org/whl/cu113</a></strong></p>

username: ptrblck
cooked: <p>What is <code>torch.version.cuda</code> returning?</p>

username: GAME_IS_ON
cooked: <aside class="quote no-group" data-username="ptrblck" data-post="4" data-topic="152797">
<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/ptrblck/48/1823_2.png" class="avatar"> ptrblck:</div>
<blockquote>
<p><code>torch.version.cuda</code></p>
</blockquote>
</aside>
<blockquote>
<blockquote>
<blockquote>
<p>torch.version.cuda<br>
‘11.3’</p>
</blockquote>
</blockquote>
</blockquote>

username: ptrblck
cooked: <p>In that case it seems your setup has trouble communicating with the GPU so maybe try to use a plain NVIDIA CUDA docker container, install the binaries there and see if it can find the GPU(s).<br>
Alternatively also try to run any other CUDA application in your current setup and see if the device can be used.</p>

username: GAME_IS_ON
cooked: <p>I have not installed CUDA, it’s by default installed by the AWS.<br>
While I am running nvidia-smi I got the response like this.<br>
NVIDIA-SMI has failed because it couldn’t communicate with the NVIDIA driver. Make sure that the latest NVIDIA driver is installed and running.</p>

username: ptrblck
cooked: <p>This sounds indeed like a setup issue as the driver seems to be in a bad state.<br>
Could you restart the node or lease another one to check if this would solve the issue? Once <code>nvidia-smi</code> is able to communicate with the driver again, try to run any CUDA sample and then a PyTorch application on the GPU.</p>