machine-learninggpusvmkaggle

Using Thundersvm in Kaggle


While I wanted to install thundersvm in kaggle using !pip install thundersvm, I encountered this error:

---------------------------------------------------------------------------
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

in order to fix this, I tried this:

# Download and install CUDA 9.0
wget https://developer.nvidia.com/compute/cuda/9.0/Prod/local_installers/cuda_9.0.176_384.81_linux-run
sudo sh cuda_9.0.176_384.81_linux-run

which didn't work either. How can I fix this?


Solution

  • In order to fix this issue you need to install some dependencies and make the downloaded file executable.

    # Install missing libraries
    !sudo apt-get update
    !sudo apt-get install -y libglu1-mesa libx11-dev libxi-dev libxmu-dev libgl-dev
    
    # Download and install CUDA 9.0 silently with --override to replace the current one
    !wget -q https://developer.nvidia.com/compute/cuda/9.0/Prod/local_installers/cuda_9.0.176_384.81_linux-run -O cuda_9.0.176_384.81_linux-run
    !chmod +x cuda_9.0.176_384.81_linux-run
    !sudo sh cuda_9.0.176_384.81_linux-run --silent --override --toolkit --samples
    
    # Manually specify the toolkit and sample directories
    !sudo sh /usr/local/cuda-9.0/bin/cuda-install-samples-9.0.sh /root
    

    after this, you can install and import thundersvm library.