CUDA initialization: CUDA driver initialization failed, you might not have a CUDA gpu

torchlearner: <p>I am getting the following error :-</p>
<blockquote>
<blockquote>
<blockquote>
<p>import torch</p>
<p>torch._C._cuda_getDeviceCount()</p>
</blockquote>
</blockquote>
</blockquote>
<p>:1: UserWarning: CUDA initialization: CUDA driver initialization failed, you might not have a CUDA gpu. (Triggered internally at …/c10/cuda/CUDAFunctions.cpp:109.)<br>
0</p>
<blockquote>
<blockquote>
<blockquote></blockquote>
</blockquote>
</blockquote>
<hr>
<p>torch version cuda is 11.7</p>
<blockquote>
<blockquote>
<blockquote>
<p>torch.version.cuda<br>
‘11.7’</p>
</blockquote>
</blockquote>
</blockquote>
<hr>
<h2><a name="nvcc-v-nvcc-nvidia-r-cuda-compiler-driver-copyright-c-2005-2022-nvidia-corporation-built-on-wed_sep_21_103358_pdt_2022-cuda-compilation-tools-release-118-v11889-build-cuda_118r118compiler31833905_0-1" class="anchor" href="#nvcc-v-nvcc-nvidia-r-cuda-compiler-driver-copyright-c-2005-2022-nvidia-corporation-built-on-wed_sep_21_103358_pdt_2022-cuda-compilation-tools-release-118-v11889-build-cuda_118r118compiler31833905_0-1"></a>nvcc - V<br>
nvcc: NVIDIA (R) Cuda compiler driver<br>
Copyright (c) 2005-2022 NVIDIA Corporation<br>
Built on Wed_Sep_21_10:33:58_PDT_2022<br>
Cuda compilation tools, release 11.8, V11.8.89<br>
Build cuda_11.8.r11.8/compiler.31833905_0</h2>
<blockquote>
<blockquote>
<blockquote>
<p>print(torch. <strong>version</strong>)<br>
2.0.0+cu117</p>
</blockquote>
</blockquote>
</blockquote>
<p>From the release compatibility matrix I know that torch version 2.0.0 is compatible with cuda 11.7 stable and 11.8 experimental.</p><aside class="onebox githubblob" data-onebox-src="https://github.com/pytorch/pytorch/blob/main/RELEASE.md#release-compatibility-matrix">
  <header class="source">

      <a href="https://github.com/pytorch/pytorch/blob/main/RELEASE.md#release-compatibility-matrix" target="_blank" rel="noopener nofollow ugc">github.com</a>
  </header>

  <article class="onebox-body">
    <h4><a href="https://github.com/pytorch/pytorch/blob/main/RELEASE.md#release-compatibility-matrix" target="_blank" rel="noopener nofollow ugc">pytorch/pytorch/blob/main/RELEASE.md#release-compatibility-matrix</a></h4>


      <pre><code class="lang-md"># Releasing PyTorch

&lt;!-- toc --&gt;

  - [Release Compatibility Matrix](#release-compatibility-matrix)
  - [Release Cadence](#release-cadence)
  - [General Overview](#general-overview)
    - [Frequently Asked Questions](#frequently-asked-questions)
  - [Cutting a release branch preparations](#cutting-a-release-branch-preparations)
  - [Cutting release branches](#cutting-release-branches)
    - [`pytorch/pytorch`](#pytorchpytorch)
    - [`pytorch/builder` / PyTorch domain libraries](#pytorchbuilder--pytorch-domain-libraries)
    - [Making release branch specific changes for PyTorch](#making-release-branch-specific-changes-for-pytorch)
    - [Making release branch specific changes for domain libraries](#making-release-branch-specific-changes-for-domain-libraries)
  - [Drafting RCs (Release Candidates) for PyTorch and domain libraries](#drafting-rcs-release-candidates-for-pytorch-and-domain-libraries)
    - [Release Candidate Storage](#release-candidate-storage)
    - [Release Candidate health validation](#release-candidate-health-validation)
    - [Cherry Picking Fixes](#cherry-picking-fixes)
    - [Cherry Picking Reverts](#cherry-picking-reverts)
  - [Promoting RCs to Stable](#promoting-rcs-to-stable)
</code></pre>



  This file has been truncated. <a href="https://github.com/pytorch/pytorch/blob/main/RELEASE.md#release-compatibility-matrix" target="_blank" rel="noopener nofollow ugc">show original</a>

  </article>

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

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

<p>Can you please suggest on what might be the issue here ?</p>

ptrblck: <p>Your system seems to have issues initializing the driver. I don’t know if this system was working before but you might need to reinstall a proper NVIDIA driver.</p>

Huang_Wade: <p>I am using docker enviroment and face the same issue.</p>
<ol>
<li>torch version is ‘2.0.1+cu118’</li>
<li>NVIDIA-SMI 515.105.01   Driver Version: 515.105.01   CUDA Version: 11.8<br>
Any help will be thankful, thanks.</li>
</ol>
<p><div class="lightbox-wrapper"><a class="lightbox" href="https://discuss.pytorch.org/uploads/default/original/3X/b/a/bae55e3841c68eeddfce94713ec4fe4c7d1c60a7.png" data-download-href="https://discuss.pytorch.org/uploads/default/bae55e3841c68eeddfce94713ec4fe4c7d1c60a7" title="image"><img src="https://discuss.pytorch.org/uploads/default/optimized/3X/b/a/bae55e3841c68eeddfce94713ec4fe4c7d1c60a7_2_690x163.png" alt="image" data-base62-sha1="qFme9urnFYZXhEKxNFAQVGCa8ej" width="690" height="163" srcset="https://discuss.pytorch.org/uploads/default/optimized/3X/b/a/bae55e3841c68eeddfce94713ec4fe4c7d1c60a7_2_690x163.png, https://discuss.pytorch.org/uploads/default/optimized/3X/b/a/bae55e3841c68eeddfce94713ec4fe4c7d1c60a7_2_1035x244.png 1.5x, https://discuss.pytorch.org/uploads/default/original/3X/b/a/bae55e3841c68eeddfce94713ec4fe4c7d1c60a7.png 2x" data-dominant-color="F3E7E7"><div class="meta"><svg class="fa d-icon d-icon-far-image svg-icon" aria-hidden="true"><use href="#far-image"></use></svg><span class="filename">image</span><span class="informations">1164×275 25.1 KB</span><svg class="fa d-icon d-icon-discourse-expand svg-icon" aria-hidden="true"><use href="#discourse-expand"></use></svg></div></a></div></p>

cjoyv: <p>Is this resolved? I am facing this same issue.</p>