8000 torch wheels are unusable if CUDA RPMs are installed on the system (was Import error in nvidia/cuda:12.6.3-cudnn-devel-rockylinux9) · Issue #150399 · pytorch/pytorch · GitHub
[go: up one dir, main page]

Skip to content

torch wheels are unusable if CUDA RPMs are installed on the system (was Import error in nvidia/cuda:12.6.3-cudnn-devel-rockylinux9) #150399

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
hzhangxyz opened this issue Apr 1, 2025 · 8 comments
Assignees
Labels
has workaround module: binaries Anything related to official binaries that we release to users module: cuda Related to torch.cuda, and CUDA support in general module: third_party triaged This issue has been looked at a team member, and triaged and prioritized into an appropriate module
Milestone

Comments

@hzhangxyz
Copy link
hzhangxyz commented Apr 1, 2025

🐛 Describe the bug

import torch

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: Rocky Linux 9.5 (Blue Onyx) (x86_64)
GCC version: (GCC) 11.5.0 20240719 (Red Hat 11.5.0-5)
Clang version: Could not collect
CMake version: Could not collect
Libc version: glibc-2.34

Python version: 3.12.5 (main, Dec 3 2024, 00:00:00) [GCC 11.5.0 20240719 (Red Hat 11.5.0-2)] (64-bit runtime)
Python platform: Linux-6.8.0-55-generic-x86_64-with-glibc2.34
Is CUDA available: N/A
CUDA runtime version: 12.6.85
CUDA_MODULE_LOADING set to: N/A
GPU models and configuration: Could not collect
Nvidia driver version: Could not collect
cuDNN version: Probably one of the following:
/usr/lib64/libcudnn.so.9.8.0
/usr/lib64/libcudnn_adv.so.9.8.0
/usr/lib64/libcudnn_cnn.so.9.8.0
/usr/lib64/libcudnn_engines_precompiled.so.9.8.0
/usr/lib64/libcudnn_engines_runtime_compiled.so.9.8.0
/usr/lib64/libcudnn_graph.so.9.8.0
/usr/lib64/libcudnn_heuristic.so.9.8.0
/usr/lib64/libcudnn_ops.so.9.8.0
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): 64
On-line CPU(s) list: 0-63
Vendor ID: GenuineIntel
Model name: Intel(R) Xeon(R) Gold 6226R CPU @ 2.90GHz
CPU family: 6
Model: 85
Thread(s) per core: 2
Core(s) per socket: 16
Socket(s): 2
Stepping: 7
CPU(s) scaling MHz: 57%
CPU max MHz: 3900.0000
CPU min MHz: 1200.0000
BogoMIPS: 5800.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 cpuid aperfmperf 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 cpuid_fault epb cat_l3 cdp_l3 intel_ppin ssbd mba ibrs ibpb stibp ibrs_enhanced tpr_shadow flexpriority ept vpid ept_ad fsgsbase tsc_adjust bmi1 avx2 smep bmi2 erms invpcid cqm mpx rdt_a avx512f avx512dq rdseed adx smap clflushopt clwb intel_pt avx512cd avx512bw avx512vl xsaveopt xsavec xgetbv1 xsaves cqm_llc cqm_occup_llc cqm_mbm_total cqm_mbm_local dtherm ida arat pln pts vnmi pku ospke avx512_vnni md_clear flush_l1d arch_capabilities
Virtualization: VT-x
L1d cache: 1 MiB (32 instances)
L1i cache: 1 MiB (32 instances)
L2 cache: 32 MiB (32 instances)
L3 cache: 44 MiB (2 instances)
NUMA node(s): 2
NUMA node0 CPU(s): 0-15,32-47
NUMA node1 CPU(s): 16-31,48-63
Vulnerability Gather data sampling: Mitigation; Microcode
Vulnerability Itlb multihit: KVM: Mitigation: VMX disabled
Vulnerability L1tf: Not affected
Vulnerability Mds: Not affected
Vulnerability Meltdown: Not affected
Vulnerability Mmio stale data: Mitigation; Clear CPU buffers; SMT vulnerable
Vulnerability Reg file data sampling: Not affected
Vulnerability Retbleed: Mitigation; Enhanced IBRS
Vulnerability Spec rstack overflow: 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; Enhanced / Automatic IBRS; IBPB conditional; RSB filling; PBRSB-eIBRS SW sequence; BHI SW loop, KVM SW loop
Vulnerability Srbds: Not affected
Vulnerability Tsx async abort: Mitigation; TSX disabled

Versions of relevant libraries:
[pip3] numpy==1.26.4
[pip3] nvidia-cublas-cu12==12.4.5.8
[pip3] nvidia-cuda-cupti-cu12==12.4.127
[pip3] nvidia-cuda-nvrtc-cu12==12.4.127
[pip3] nvidia-cuda-runtime-cu12==12.4.127
[pip3] nvidia-cudnn-cu12==9.1.0.70
[pip3] nvidia-cufft-cu12==11.2.1.3
[pip3] nvidia-curand-cu12==10.3.5.147
[pip3] nvidia-cusolver-cu12==11.6.1.9
[pip3] nvidia-cusparse-cu12==12.3.1.170
[pip3] nvidia-cusparselt-cu12==0.6.2
[pip3] nvidia-nccl-cu12==2.21.5
[pip3] nvidia-nvjitlink-cu12==12.4.127
[pip3] nvidia-nvtx-cu12==12.4.127
[pip3] torch==2.6.0
[pip3] triton==3.2.0
[conda] Could not collect

cc @ezyang @gchanan @zou3519 @kadeng @msaroufim @seemethere @malfet @osalpekar @atalman @ptrblck @eqy

@hzhangxyz
Copy link
Author

To reproduce this error:

  1. Start docker container from nvidia/cuda:12.6.3-cudnn-devel-rockylinux9
  2. dnf install python3.12
  3. python3.12 -m ensurepip
  4. pip3.12 install --upgrade pip
  5. pip3.12 install torch
  6. python3.12 -c "import torch"

@hzhangxyz
Copy link
Author

It seems it is because of /usr/local/lib64/python3.12/site-packages/torch/lib/libtorch_global_deps.so can be loaded successful, so pytorch does not scan folders to locate cuda library.

@zou3519
Copy link
Contributor
zou3519 commented Apr 2, 2025

For triage review: I am not sure there's anything we can do, we dont own this docker container

@hzhangxyz
Copy link
Author

However, It is not about docker, it means in such system, torch cannot be installed correctly. Besides, it seems to be an issue that torch can fix, it seems we only need to add some essential dependencies onto libtorch_global_deps.so ?

@atalman atalman added this to the 2.7.0 milestone Apr 7, 2025
@malfet malfet added the module: binaries Anything related to official binaries that we release to users label Apr 7, 2025
@malfet
Copy link
Contributor
malfet commented Apr 7, 2025

This feels weirdly related to #150742
And there are probably another issue to warn user when multiple cuda binaries are installed... It would be nice to see the import error message somewhere in the issue description (trying to repro it now)

Also, moved milestone to 2.7.1 as it does not look like a regression (i.e. it was broken in 2.6.0)

>>> import torch
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/usr/local/lib64/python3.9/site-packages/torch/__init__.py", line 405, in <module>
    from torch._C import *  # noqa: F403
ImportError: libcusparseLt.so.0: cannot open shared object file: No such file or directory

And same is true for 2.7.0

@malfet malfet modified the milestones: 2.7.0, 2.7.1 Apr 7, 2025
@jbschlosser jbschlosser added triaged This issue has been looked at a team member, and triaged and prioritized into an appropriate module high priority and removed triage review labels Apr 7, 2025
@malfet malfet modified the milestones: 2.7.1, 2.7.0 Apr 7, 2025
@malfet malfet added module: cuda Related to torch.cuda, and CUDA support in general and removed module: docker labels Apr 7, 2025
@malfet
8000 Copy link
Contributor
malfet commented Apr 7, 2025

Why or why all CUDA wheels can not be package using the same scripts? cc: @ptrblck

# find /usr/local/lib/ -iname "*cusp*.s*"
/usr/local/lib/python3.9/site-packages/cusparselt/lib/libcusparseLt.so.0
/usr/local/lib/python3.9/site-packages/nvidia/cusparse/lib/libcusparse.so.12

@jbschlosser
Copy link
Contributor

High pri to verify that this was fixed in 2.7

@malfet malfet changed the title Import error in nvidia/cuda:12.6.3-cudnn-devel-rockylinux9 torch is unusable if local CUDA installation exists (was Import error in nvidia/cuda:12.6.3-cudnn-devel-rockylinux9) Apr 7, 2025
@malfet malfet changed the title torch is unusable if local CUDA installation exists (was Import error in nvidia/cuda:12.6.3-cudnn-devel-rockylinux9) torch wheels are unusable if CUDA RPMs are installed on the system (was Import error in nvidia/cuda:12.6.3-cudnn-devel-rockylinux9) Apr 7, 2025
@malfet
Copy link
Contributor
malfet commented Apr 7, 2025

If CUDA toolkit is installed on the system via RPMs, it becomes a preferred provider of all the libraries, but if such installation for some reason misses extra packages, such as cudnn (which is not) or NCLL (which is again not the case in the abovementioned example), than package resolution will fail.
dnf install libcusparselt0 indeed solves the problem:

[root@aa42baaaa831 /]# python3
Python 3.9.19 (main, Sep 11 2024, 00:00:00) 
[GCC 11.5.0 20240719 (Red Hat 11.5.0-2)] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import torch
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/usr/local/lib64/python3.9/site-packages/torch/__init__.py", line 405, in <module>
    from torch._C import *  # noqa: F403
ImportError: libcusparseLt.so.0: cannot open shared object file: No such file or directory
>>> 

[root@aa42baaaa831 /]# dnf install  -y libcusparselt0
Last metadata expiration check: 0:03:34 ago on Mon Apr  7 18:16:32 2025.
...
Installed:
  libcusparselt0-0.7.1.0-1.x86_64                                                                                                                                                                                 

Complete!
[root@aa42baaaa831 /]# python3
Python 3.9.19 (main, Sep 11 2024, 00:00:00) 
[GCC 11.5.0 20240719 (Red Hat 11.5.0-2)] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import torch
/usr/local/lib64/python3.9/site-packages/torch/_subclasses/functional_tensor.py:275: UserWarning: Failed to initialize NumPy: No module named 'numpy' (Triggered internally at /pytorch/torch/csrc/utils/tensor_numpy.cpp:81.)
  cpu = _conversion_method_template(device=torch.device("cpu"))
>>> 

With that in mind, removing high priority and tentatively targeting 2.7.1

@malfet malfet modified the milestones: 2.7.0, 2.7.1 Apr 7, 2025
@atalman atalman self-assigned this May 15, 2025
@atalman atalman modified the milestones: 2.7.1, 2.8.0 May 15, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
has workaround module: binaries Anything related to official binaries that we release to users module: cuda Related to torch.cuda, and CUDA support in general module: third_party triaged This issue has been looked at a team member, and triaged and prioritized into an appropriate module
Projects
None yet
Development

No branches or pull requests

5 participants
0