Repository: pytorch
Issue: [bug] import torch failed after install the cpu version of pytorch
Labels: needs reproduction,module: binaries,triaged

### 🐛 Describe the bug

# install CPU version 
pip install torch==2.3.1 torchvision==0.18.1 torchaudio==2.3.1 --index-url https://download.pytorch.org/whl/cpu

# verify torch
python -c 'import torch; print(torch.cuda.is_available())'

Traceback (most recent call last):
  File "<string>", line 1, in <module>
  File "/home/bhlin6nctu/miniconda3/envs/xfaster/lib/python3.10/site-packages/torch/__init__.py", line 1480, in <modul
e>
    _C._initExtension(manager_path())
  File "/home/bhlin6nctu/miniconda3/envs/xfaster/lib/python3.10/site-packages/torch/cuda/__init__.py", line 91, in <mo
dule>
    has_magma: bool = torch._C._has_magma
AttributeError: module 'torch._C' has no attribute '_has_magma'


### Versions

Collecting environment information...
PyTorch version: N/A
Is debug build: N/A
CUDA used to build PyTorch: N/A
ROCM used to build PyTorch: N/A

OS: Ubuntu 22.04.3 LTS (x86_64)
GCC version: (Ubuntu 11.4.0-1ubuntu1~22.04) 11.4.0
Clang version: Could not collect
CMake version: version 3.27.7
Libc version: glibc-2.35

Python version: 3.10.14 | packaged by conda-forge | (main, Mar 20 2024, 12:45:18) [GCC 12.3.0] (64-bit runtime)
Python platform: Linux-3.10.0-1127.el7.x86_64-x86_64-with-glibc2.35
Is CUDA available: N/A
CUDA runtime version: 12.3.52
CUDA_MODULE_LOADING set to: N/A
GPU models and configuration: 
GPU 0: Tesla V100-SXM2-32GB
GPU 1: Tesla V100-SXM2-32GB
GPU 2: Tesla V100-SXM2-32GB
GPU 3: Tesla V100-SXM2-32GB
GPU 4: Tesla V100-SXM2-32GB
GPU 5: Tesla V100-SXM2-32GB
GPU 6: Tesla V100-SXM2-32GB
GPU 7: Tesla V100-SXM2-32GB

Nvidia driver version: 470.161.03
cuDNN version: Probably one of the following:
/usr/lib/x86_64-linux-gnu/libcudnn.so.8.9.6
/usr/lib/x86_64-linux-gnu/libcudnn_adv_infer.so.8.9.6
/usr/lib/x86_64-linux-gnu/libcudnn_adv_train.so.8.9.6
/usr/lib/x86_64-linux-gnu/libcudnn_cnn_infer.so.8.9.6
/usr/lib/x86_64-linux-gnu/libcudnn_cnn_train.so.8.9.6
/usr/lib/x86_64-linux-gnu/libcudnn_ops_infer.so.8.9.6
/usr/lib/x86_64-linux-gnu/libcudnn_ops_train.so.8.9.6
HIP runtime version: N/A
MIOpen runtime version: N/A
Is XNNPACK available: N/A

CPU:
Architecture:        x86_64
CPU op-mode(s):      32-bit, 64-bit
Address sizes:       46 bits physical, 48 bits virtual
Byte Order:          Little Endian
CPU(s):              36
On-line CPU(s) list: 0-35
Vendor ID:           GenuineIntel
Model name:          Intel(R) Xeon(R) Gold 6154 CPU @ 3.00GHz
CPU family:          6
Model:               85
Thread(s) per core:  1
Core(s) per socket:  18
Socket(s):           2
Stepping:            4
BogoMIPS:            6000.00
Flags:               fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush dts acpi mmx fxsr sse sse2 ss ht tm pbe syscall nx pdpe1gb rdtscp lm constant_tsc art arch_perfmon pebs bts rep_good nopl xtopology nonstop_tsc aperfmperf eagerfpu pni pclmulqdq dtes64 monitor ds_cpl vmx smx est tm2 ssse3 sdbg fma cx16 xtpr pdcm pcid dca sse4_1 sse4_2 x2apic movbe popcnt tsc_deadline_timer aes xsave avx f16c rdrand lahf_lm abm 3dnowprefetch epb cat_l3 cdp_l3 invpcid_single intel_ppin intel_pt ssbd mba ibrs ibpb stibp tpr_shadow vnmi flexpriority ept vpid fsgsbase tsc_adjust bmi1 hle avx2 smep bmi2 erms invpcid rtm cqm mpx rdt_a avx512f avx512dq rdseed adx smap clflushopt clwb avx512cd avx512bw avx512vl xsaveopt xsavec xgetbv1 cqm_llc cqm_occup_llc cqm_mbm_total cqm_mbm_local dtherm ida arat pln pts hwp_epp pku ospke md_clear spec_ctrl intel_stibp flush_l1d
Virtualization:      VT-x
L1d cache:           1.1 MiB (36 instances)
L1i cache:           1.1 MiB (36 instances)
L2 cache:            36 MiB (36 instances)
L3 cache:            49.5 MiB (2 instances)
NUMA node(s):        2
NUMA node0 CPU(s):   0-17
NUMA node1 CPU(s):   18-35

Versions of relevant libraries:
[pip3] numpy==1.26.3
[pip3] torch==2.3.1+cpu
[pip3] torchaudio==2.3.1+cpu
[pip3] torchvision==0.18.1+cpu
[pip3] triton==2.3.0
[conda] numpy                     1.26.3                   pypi_0    pypi
[conda] torch                     2.3.1+cpu                pypi_0    pypi
[conda] torchaudio                2.3.1+cpu                pypi_0    pypi
[conda] torchvision               0.18.1+cpu               pypi_0    pypi
[conda] triton                    2.3.0                    pypi_0    pypi


cc @seemethere @malfet @osalpekar @atalman