Xtra-Computing / thundersvm

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

Using virtual environment "Please build the library first!" #165

Closed BramVanroy closed 4 years ago

BramVanroy commented 5 years ago

I am trying to use thundersvm in Python but I am running into many issues, unfortunately. The steps that I followed are below. I am using Ubuntu 18.04.2.

  1. Clone repo into my project directory
  2. Successfully built thundersvm
  3. Activate virtual environment in my project directory
  4. Install thundersvm/python
  5. Try to run a Python script from the venv

But I get the error that I have to install the library first. I assume that the installed Python package is installed in the site-packages of the venv, e.g. /home/bram/.local/share/virtualenvs/predicting-syntactic-equivalence-g0sIkWgJ/lib/python3.7/site-packages/thundersvm-0.3.3-py3.7.egg/. But because thundersvm was built in another directory, it cannot find the bin files.

Traceback (most recent call last):
  File "/home/bram/predict/predicting-syntactic-equivalence/ml/ml_s2v.py", line 15, in <module>
    from thundersvm import SVR
  File "<frozen importlib._bootstrap>", line 983, in _find_and_load
  File "<frozen importlib._bootstrap>", line 967, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 668, in _load_unlocked
  File "<frozen importlib._bootstrap>", line 638, in _load_backward_compatible
  File "/home/bram/.local/share/virtualenvs/predicting-syntactic-equivalence-g0sIkWgJ/lib/python3.7/site-packages/thundersvm-0.3.3-py3.7.egg/thundersvm/__init__.py", line 10, in <module>
  File "<frozen importlib._bootstrap>", line 983, in _find_and_load
  File "<frozen importlib._bootstrap>", line 967, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 668, in _load_unlocked
  File "<frozen importlib._bootstrap>", line 638, in _load_backward_compatible
  File "/home/bram/.local/share/virtualenvs/predicting-syntactic-equivalence-g0sIkWgJ/lib/python3.7/site-packages/thundersvm-0.3.3-py3.7.egg/thundersvm/thundersvm.py", line 53, in <module>
FileNotFoundError: Please build the library first!

Perhaps a better solution is to either let the user decide where the built binaries are, OR also look into e.g. opt/, bin/, /usr/bin/.

QinbinLi commented 5 years ago

Hi, @BramVanroy

I have tried both "pip3 install thundersvm" and "python3 setup.py install" in virtualenv and they all work fine. If you have successfully installed the python package, there shouldn't be the error message "Please build the library first" when you run the script. Can you tell me the specific instructions that you used to install thundersvm/python? Thanks.