Xtra-Computing / thundersvm

ThunderSVM: A Fast SVM Library on GPUs and CPUs
Apache License 2.0
1.55k stars 215 forks source link

Issue importing thundersvm on google colab #213

Open partizanos opened 4 years ago

partizanos commented 4 years ago

The issue can be replicated with runtime cpu and runtime gpu

I also issues just importing. Steps to reproduce

  1. installing (runs successfully)
    !pip install thundersvm
    ! pip freeze > req.txt
    !cat  req.txt | grep thundersvm
    # output 
    thundersvm==0.3.12

2) Importing fails


---------------------------------------------------------------------------
OSError                                   Traceback (most recent call last)
<ipython-input-1-4dbd1c645e09> in <module>()
      1 get_ipython().system('pip install thundersvm')
----> 2 from thundersvm import SVC
      3 clf = SVC()

2 frames
/usr/lib/python3.6/ctypes/__init__.py in __init__(self, name, mode, handle, use_errno, use_last_error)
    346 
    347         if handle is None:
--> 348             self._handle = _dlopen(self._name, mode)
    349         else:
    350             self._handle = handle

OSError: libcusparse.so.9.0: cannot open shared object file: No such file or directory```
tudor-paraschivescu commented 4 years ago

I was able to kinda make it work following these steps, but I agree that it might not be the most elegant way:

%%shell
# Clone ThunderSVM repository
git clone https://github.com/Xtra-Computing/thundersvm.git

# Build ThunderSVM
cd thundersvm
mkdir build
cd build
cmake ..
make -j
from importlib.machinery import SourceFileLoader
thundersvm = SourceFileLoader("thundersvm", "/content/thundersvm/python/thundersvm/thundersvm.py").load_module()

svc = svm.SVC(verbose=True)
shijiashuai commented 4 years ago

This is because of the CUDA version in colab is different from which we built pypi packages with, but I have not figured out how to make a package compatible with many CUDA versions.

But you can try this:

in colab

%pip install https://github.com/Xtra-Computing/thundersvm/releases/download/v0.3.4/thundersvm_cuda10.1-0.3.4-cp36-cp36m-linux_x86_64.whl
Collecting thundersvm-cuda10.1==0.3.4
  Downloading https://github.com/Xtra-Computing/thundersvm/releases/download/v0.3.4/thundersvm_cuda10.1-0.3.4-cp36-cp36m-linux_x86_64.whl (514kB)
     |████████████████████████████████| 522kB 3.8MB/s 
Requirement already satisfied: scikit-learn in /usr/local/lib/python3.6/dist-packages (from thundersvm-cuda10.1==0.3.4) (0.22.2.post1)
Requirement already satisfied: scipy in /usr/local/lib/python3.6/dist-packages (from thundersvm-cuda10.1==0.3.4) (1.4.1)
Requirement already satisfied: numpy in /usr/local/lib/python3.6/dist-packages (from thundersvm-cuda10.1==0.3.4) (1.18.3)
Requirement already satisfied: joblib>=0.11 in /usr/local/lib/python3.6/dist-packages (from scikit-learn->thundersvm-cuda10.1==0.3.4) (0.14.1)
Installing collected packages: thundersvm-cuda10.1
Successfully installed thundersvm-cuda10.1-0.3.4

where the links for wheels can be found here

SifatMd commented 3 years ago

The CUDA version in Google Colab is 10.x. But, to run thundersvm in colab, we need CUDA 9.0. I have listed all the instructions to install and run with possible speedups with thundersvm. You can check it out here: https://medium.com/analytics-vidhya/how-to-install-and-run-thundersvm-in-google-colab-de1fe49eef85

vincentmele commented 3 years ago

I am able to use Thundersvm in Colab just fine by building and installing with the following cell:

! git clone https://github.com/Xtra-Computing/thundersvm.git
! cd thundersvm && mkdir build && cd build && cmake .. && make -j
! python /content/thundersvm/python/setup.py install
ganiyuolalekan commented 2 years ago

The CUDA version in Google Colab is 10.x. But, to run thundersvm in colab, we need CUDA 9.0. I have listed all the instructions to install and run with possible speedups with thundersvm. You can check it out here: https://medium.com/analytics-vidhya/how-to-install-and-run-thundersvm-in-google-colab-de1fe49eef85

error

This is the error I got on !wget https://developer.nvidia.com/compute/cuda/9.0/Prod/local_installers/cuda-repo-ubuntu1704-9-0-local_9.0.176-1_amd64-deb