pytorch报错:libcusparse.so.12: undefined symbol: __nvJitLinkComplete_12_4, version libnvJitLink.so.12
解决方法:(参考:https://github.com/vllm-project/vllm/issues/10300 )

具体解释:
When import torch causes error ImportError: ... libcusparse.so.12: undefined symbol: __nvJitLinkAddData_12_1, version libnvJitLink.so.12, the reason is your shell had LD_LIBRARY_PATH pointing to a system CUDA toolkit (i.e., check echo $LD_LIBRARY_PATH). The dynamic linker picked libnvJitLink from the system instead of the PyTorch wheel.
To resolve, we have to clear LD_LIBRARY_PATH to let PyTorch use its bundled CUDA libs and import correctly.
Doing this by unset LD_LIBRARY_PATH before installing with uv sync.

个人的电脑上的设置(Linux):终端中设置环境变量
export LD_LIBRARY_PATH=~/anaconda3/envs/swarm-rl/lib/python3.11/site-packages/nvidia/nvjitlink/lib:$LD_LIBRARY_PATH
posted on 2026-11-16 16:24 Angry_Panda 阅读(9) 评论(0) 收藏 举报
浙公网安备 33010602011771号