Pytorch 2.0 doesnt detect CUDA in arch linux

ash_ds: <p>i tried to download pytorch with cuda support however after checking</p>
<pre><code class="lang-auto">torch.cuda.is_available()
- false
</code></pre>
<p>i went to try this</p>
<pre><code class="lang-auto"> python -m torch.utils.collect_env
</code></pre>
<p>which returned<br>
<div class="lightbox-wrapper"><a class="lightbox" href="https://discuss.pytorch.org/uploads/default/original/3X/c/d/cddc1cd55bd6236f8ad91ce51b9877232fad3edd.png" data-download-href="https://discuss.pytorch.org/uploads/default/cddc1cd55bd6236f8ad91ce51b9877232fad3edd" title="Screenshot from 2023-05-10 13-30-29"><img src="https://discuss.pytorch.org/uploads/default/original/3X/c/d/cddc1cd55bd6236f8ad91ce51b9877232fad3edd.png" alt="Screenshot from 2023-05-10 13-30-29" data-base62-sha1="tn7taTX28YJnCwhdITFlS6kFVYV" width="477" height="500" data-dominant-color="2A292A"><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">Screenshot from 2023-05-10 13-30-29</span><span class="informations">526×551 28.5 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>
<p>Would like to know how to resolve the issue.<br>
i downloaded both cuda and cudann using yay</p>
<p>Thanks in advance.</p>

rouniuyizu: <p>have you actually installed the CUDA package? It seemed only cuDNN installed…</p>

ash_ds: <p><img src="https://discuss.pytorch.org/uploads/default/original/3X/2/8/2856c1058e52b645c6d500bea99ba41f9f50366b.png" alt="Screenshot from 2023-05-10 20-06-13" data-base62-sha1="5KQY2tCxGNTjqJUNCbpkPM25X7l" width="486" height="98"><br>
Here is the cuda version</p>

ptrblck: <p>You don’t need to install a full CUDA toolkit as PyTorch ships with its own CUDA dependencies. The locally installed CUDA toolkit will be used if you build PyTorch from source or a custom extension. Could you post the full output of <code>python -m torch utils.collect_env</code> and <code>pip list | grep torch</code> instead of cropped screenshots?</p>

ash_ds: <p><img src="https://discuss.pytorch.org/uploads/default/original/3X/f/f/ffafca9f4dbc25a2df12e903bb1d7e39a4d1c00c.png" alt="Screenshot from 2023-05-10 23-02-02" data-base62-sha1="AtUnXIdiuFXRDRBCDERJKoGEFNG" width="298" height="80"></p>
<p>I am quite a new user to arch , would be helpful if you show the required steps to install perfectly</p>

ash_ds: <pre><code class="lang-auto">Collecting environment information...
PyTorch version: 2.0.1
Is debug build: False
CUDA used to build PyTorch: Could not collect
ROCM used to build PyTorch: N/A

OS: Arch Linux (x86_64)
GCC version: (GCC) 13.1.1 20230429
Clang version: Could not collect
CMake version: Could not collect
Libc version: glibc-2.37

Python version: 3.11.3 (main, Apr 19 2023, 23:54:32) [GCC 11.2.0] (64-bit runtime)
Python platform: Linux-6.3.1-zen1-1-zen-x86_64-with-glibc2.37
Is CUDA available: False
CUDA runtime version: 12.1.105
CUDA_MODULE_LOADING set to: N/A
GPU models and configuration: GPU 0: NVIDIA GeForce RTX 3060 Laptop GPU
Nvidia driver version: 530.41.03
cuDNN version: Probably one of the following:
/usr/lib/libcudnn.so.8.8.0
/usr/lib/libcudnn_adv_infer.so.8.8.0
/usr/lib/libcudnn_adv_train.so.8.8.0
/usr/lib/libcudnn_cnn_infer.so.8.8.0
/usr/lib/libcudnn_cnn_train.so.8.8.0
/usr/lib/libcudnn_ops_infer.so.8.8.0
/usr/lib/libcudnn_ops_train.so.8.8.0
HIP runtime version: N/A
MIOpen runtime version: N/A
Is XNNPACK available: True

CPU:
Architecture:                    x86_64
CPU op-mode(s):                  32-bit, 64-bit
Address sizes:                   48 bits physical, 48 bits virtual
Byte Order:                      Little Endian
CPU(s):                          16
On-line CPU(s) list:             0-15
Vendor ID:                       AuthenticAMD
Model name:                      AMD Ryzen 7 5800H with Radeon Graphics
CPU family:                      25
Model:                           80
Thread(s) per core:              2
Core(s) per socket:              8
Socket(s):                       1
Stepping:                        0
Frequency boost:                 enabled
CPU(s) scaling MHz:              71%
CPU max MHz:                     4462.5000
CPU min MHz:                     1200.0000
BogoMIPS:                        6388.32
Flags:                           fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush mmx fxsr sse sse2 ht syscall nx mmxext fxsr_opt pdpe1gb rdtscp lm constant_tsc rep_good nopl nonstop_tsc cpuid extd_apicid aperfmperf rapl pni pclmulqdq monitor ssse3 fma cx16 sse4_1 sse4_2 movbe popcnt aes xsave avx f16c rdrand lahf_lm cmp_legacy svm extapic cr8_legacy abm sse4a misalignsse 3dnowprefetch osvw ibs skinit wdt tce topoext perfctr_core perfctr_nb bpext perfctr_llc mwaitx cpb cat_l3 cdp_l3 hw_pstate ssbd mba ibrs ibpb stibp vmmcall fsgsbase bmi1 avx2 smep bmi2 erms invpcid cqm rdt_a rdseed adx smap clflushopt clwb sha_ni xsaveopt xsavec xgetbv1 xsaves cqm_llc cqm_occup_llc cqm_mbm_total cqm_mbm_local clzero irperf xsaveerptr rdpru wbnoinvd cppc arat npt lbrv svm_lock nrip_save tsc_scale vmcb_clean flushbyasid decodeassists pausefilter pfthreshold avic v_vmsave_vmload vgif v_spec_ctrl umip pku ospke vaes vpclmulqdq rdpid overflow_recov succor smca fsrm
Virtualization:                  AMD-V
L1d cache:                       256 KiB (8 instances)
L1i cache:                       256 KiB (8 instances)
L2 cache:                        4 MiB (8 instances)
L3 cache:                        16 MiB (1 instance)
NUMA node(s):                    1
NUMA node0 CPU(s):               0-15
Vulnerability Itlb multihit:     Not affected
Vulnerability L1tf:              Not affected
Vulnerability Mds:               Not affected
Vulnerability Meltdown:          Not affected
Vulnerability Mmio stale data:   Not affected
Vulnerability Retbleed:          Not affected
Vulnerability Spec store bypass: Mitigation; Speculative Store Bypass disabled via prctl
Vulnerability Spectre v1:        Mitigation; usercopy/swapgs barriers and __user pointer sanitization
Vulnerability Spectre v2:        Mitigation; Retpolines, IBPB conditional, IBRS_FW, STIBP always-on, RSB filling, PBRSB-eIBRS Not affected
Vulnerability Srbds:             Not affected
Vulnerability Tsx async abort:   Not affected

Versions of relevant libraries:
[pip3] numpy==1.24.3
[pip3] torch==2.0.1
[pip3] torchaudio==2.0.2
[pip3] torchvision==0.15.2
[conda] blas                      1.0                         mkl  
[conda] mkl                       2021.4.0           h06a4308_640  
[conda] mkl-service               2.4.0           py311h5eee18b_0  
[conda] mkl_fft                   1.3.1           py311h30b3d60_0  
[conda] mkl_random                1.2.2           py311hba01205_0  
[conda] numpy                     1.24.3          py311hc206e33_0  
[conda] numpy-base                1.24.3          py311hfd5febd_0  
[conda] pytorch                   2.0.1              py3.11_cpu_0    pytorch
[conda] pytorch-cuda              11.7                 h778d358_5    pytorch
[conda] pytorch-mutex             1.0                         cpu    fastchan
[conda] torchaudio                2.0.2                 py311_cpu    pytorch
[conda] torchvision               0.15.2                py311_cpu    pytorch
</code></pre>
<p>this is the output for <code>python -m torch.utils.collect_env</code>.</p>

ptrblck: <p>Thanks for the update. Based on:</p>
<pre><code class="lang-auto">[conda] pytorch                   2.0.1              py3.11_cpu_0
</code></pre>
<p>You have installed the CPU-only packages and would need to install the ones coming with the CUDA dependencies.<br>
I would recommend either uninstalling all PyTorch-related packages in the current environment before reinstalling the right one or creating a new and empty virtual environment.</p>

ash_ds: <p>well i have a doubt though , cause my cuda version is 12.01 and the one present in pytorch is 11.8 or 11.7 , would there be an error.</p>

ptrblck: <p>No, there won’t be an error as described in my previous post:</p>
<blockquote>
<p>You don’t need to install a full CUDA toolkit as PyTorch ships with its own CUDA dependencies. The locally installed CUDA toolkit will be used if you build PyTorch from source or a custom extension.</p>
</blockquote>

ash_ds: <p>Thanks a lot, I created a new environment and installed it as you mentioned works right now.</p>