You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

在Kaggle中安装ThundersVM遇库文件缺失问题的解决求助

解决Kaggle中安装ThundersVM时libcusparse.so.9.0找不到的问题

在Kaggle环境中执行!pip install thundersvm后,导入thundersvm.SVC时出现如下错误:

---------------------------------------------------------------------------
OSError                                   Traceback (most recent call last)
Cell In[6], line 3
      1 get_ipython().run_line_magic('pip', 'install thundersvm')
      2 get_ipython().run_line_magic('pip', 'install keras_tuner')
----> 3 from thundersvm import SVC
      4 from sklearn.preprocessing import StandardScaler
      5 from sklearn.metrics import classification_report

File /opt/conda/lib/python3.10/site-packages/thundersvm/__init__.py:10
      3 """
      4  * Name        : __init__.py
      5  * Author      : Locke <luojiahuan001@gmail.com>
      6  * Version     : 0.0.1
      7  * Description :
      8 """
      9 name = "thundersvm"
---> 10 from .thundersvm import *

File /opt/conda/lib/python3.10/site-packages/thundersvm/thundersvm.py:39
     36         lib_path = path.join(dirname, shared_library_name)
     38 if path.exists(lib_path):
---> 39     thundersvm = CDLL(lib_path)
     40 else:
     41     # try the build directory
     42     if platform == "linux" or platform == "linux2":

File /opt/conda/lib/python3.10/ctypes/__init__.py:374, in CDLL.__init__(self, name, mode, handle, use_errno, use_last_error, winmode)
    371 self._FuncPtr = _FuncPtr
    373 if handle is None:
---> 374     self._handle = _dlopen(self._name, mode)
    375 else:
    376     self._handle = handle

OSError: libcusparse.so.9.0: cannot open shared object file: No such file or directory

手动安装CUDA 9.0后问题仍未解决,以下是可行修复方案:

问题根源

Kaggle默认提供的CUDA版本通常高于9.0,手动安装CUDA9.0后未正确配置环境变量,且预编译的ThundersVM包依赖旧版本CUDA,与当前环境不兼容。

可行解决方案

方案1:编译适配Kaggle当前CUDA版本的ThundersVM(推荐)

这是最稳定的解决方式,步骤如下:

  • 卸载已安装的ThundersVM:
    !pip uninstall -y thundersvm
    
  • 克隆ThundersVM源码:
    !git clone https://github.com/Xtra-Computing/thundersvm.git
    
  • 进入源码目录并编译:
    %cd thundersvm
    !mkdir build && cd build
    !cmake ..
    !make -j4
    
  • 安装编译好的Python包:
    !cd ../python && pip install .
    
  • 验证导入:
    from thundersvm import SVC
    

方案2:配置环境变量指向CUDA9.0(不推荐)

若坚持使用CUDA9.0,需让系统找到对应库文件:

  • 设置环境变量:
    !export LD_LIBRARY_PATH=/usr/local/cuda-9.0/lib64:$LD_LIBRARY_PATH
    !export PATH=/usr/local/cuda-9.0/bin:$PATH
    
  • 重新导入ThundersVM:
    from thundersvm import SVC
    

注意:Kaggle默认CUDA版本与9.0共存可能引发依赖冲突,此方法稳定性较差。

前置检查:确认Kaggle当前CUDA版本

先执行以下命令查看当前环境的CUDA版本,确保后续操作与版本匹配:

!nvcc --version

内容的提问来源于stack exchange,提问作者Sadegh

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.06.15 20:55:54